(co-authored with @AntoineSolutions)

Note: After talking about it, we realized we actually don't know what conditions drive whether an issue in the 'Your Posts' view is tagged as 'new' or 'updated' - a good example of why this is a useful process!

Feature: Logged-in user views list of own posts

  As a logged-in user of Drupal.org
  I want to view a list of my own posts
  So that I can view recent activity on my posts

  Scenario: No posts

  Given I have no posts
  When I view my posts page
  Then I should see an empty results message.

  Scenario: Yes posts

  Given I have made a post on drupal.org
  When I view my posts page
  Then I should see a listing of my posts

  Scenario: Listing posts  

  Given I am viewing a list of posts
  When I am seeing an individual post’s entry
  Then it should list its type
  And it should list its title
  And it should list its author
  And it should list its number of replies
  And it should list last updated time

  Scenario: Post should be flagged as ‘new’
  
  Given I am viewing a list of posts
  When I am seeing an individual posts’s entry
  And it is new (?) 
  Then it should be flagged as new
  And it should show the number of new replies

  Scenario: Post should be flagged as ‘updated’

  Given I am viewing a list of posts
  When I am seeing an individual posts’s entry
  And it has been updated (?)
  Then it should be flagged as updated
  And it should show the number of new replies

Comments

pradeeprkara’s picture

Please let me know if someone is working on this issue.

Thank you

eliza411’s picture

No one is actively working on this. We took a trial run at writing features at our user group meetup, and this is one of those issues. Please feel free to start working on it.

sachin2dhoni’s picture

Assigned: Unassigned » sachin2dhoni

I will start working on this.

sachin2dhoni’s picture

Issue tags: +sprint 3

Tagging to sprint 3

sachin2dhoni’s picture

StatusFileSize
new6.08 KB

As we are not able to login with any user in the git6site ,I have written the feature by taking reference of drupal.org with logged in user as "ksbalajisundar" and taken the posts based on this user.

Once the git6site issue: #1720134: Script the re-creation of all needed test user accounts and passwords for git6site is fixed, I will change the "logged in user" with git user and take the posts of the changed user and modify in the feature and update the patch accordingly.

Attaching the patch file.

sachin2dhoni’s picture

Status: Active » Needs review
eliza411’s picture

Status: Needs review » Needs work

Please review the Given/When/Then structures in the .feature file
http://drupal.org/node/1578324#important

sachin2dhoni’s picture

Status: Needs work » Needs review
StatusFileSize
new8.4 KB
new8.4 KB

I have modified the structures in the .feature file as per standards.

Attaching the updated patch file.

eliza411’s picture

Status: Needs review » Needs work

I'm getting the following PHP Fatal error after applying and running:

    And I should see the following <texts>                 # FeatureContext::iShouldSeeTheFollowingTexts()
      | texts        |
      | Type         |
      | Posts        |
      | Author       |
      | Replies      |
      | Last updated |
PHP Fatal error:  Call to a member function find() on a non-object in /home/melissa/doobie/features/bootstrap/FeatureContext.php on line 1943
pradeeprkara’s picture

Issue tags: +sprint 4

tagging as sprint 4

sachin2dhoni’s picture

Status: Needs work » Needs review
StatusFileSize
new7.48 KB

Made corrections and uploaded the patch.

Please review it.

eliza411’s picture

Status: Needs review » Needs work

While you're making changes, would you tab out the table endings for readability?

+++ b/features/drupalorg/your_posts.feature
@@ -0,0 +1,63 @@
+Feature: Logged-in user views list of own posts

We need the full Feature statement:

In order to keep track of responses to issues I've posted
As an authenticated user
I want to find them listed all in a single place

+++ b/features/drupalorg/your_posts.feature
@@ -0,0 +1,63 @@
+    And I should see the following <texts>

This is your Then statement (and this is one of those weird ones that has no When in the scenario; that seems right in this case)

+++ b/features/drupalorg/your_posts.feature
@@ -0,0 +1,63 @@
+    Then I should see at least "5" replies for the post

This should be And, not then, because of the adjustment above.

+++ b/features/drupalorg/your_posts.feature
@@ -0,0 +1,63 @@
+  Scenario: Verify pagination links: First page
+    And I should see the following <links>
+    | links |
+    | next |
+    | last |
+    | 1 |
+    | 2 |
+    And I should not see the link "first"

This scenario should begin with a Then statement and all of the first page pagination scenarios should probably precede the scenarios that follow posts.

sachin2dhoni’s picture

Status: Needs work » Needs review

Made necessary changes as below.
Commit log:75dfa57
Once confirmed will roll out a patch.

eliza411’s picture

Status: Needs review » Needs work

One small style correction remains:

Feature: In order to keep track of responses to issues I've posted
As an authenticated user
I want to find them listed all in a single place

should be more like:

Feature:  Your posts
  In order to keep track of responses to issues I've posted
  As an authenticated user
  I want to find them listed all in a single place

Some larger content questions:
Site user will be recreated every time a new database is pulled. All the data for site user will be blank. We need an effective strategy to:

a) delete any posts for the site user if they exist
b) create the data necessary to execute the test

This is something we need to be looking at for all tests: will this pass on both a new copy of the database and one that's been around a while?

eliza411’s picture

Additionally, the step definitions in the patch are missing from this commit, so the tests can't really be executed. Note that I just did a clean up of step language to account for both singular and plural ... any time that you're counting 'at least X' the step should account for the variation.

For example,
@Given /^I should see at least \'(\d+)" new replies for the post$/
would read
@Given /^I should see at least \'(\d+)" new (?:reply|replies) for the post$/

The ?: allows you to group this without creating a backreference (which means it won't be awkwardly bolded in the test output).

With more regular plurals, you may see something more like post(?:|s) which allows either nothing or an s on the end of post.

Also, this particular definition has a mismatched quotes: \'(\d+)" should be "(\d+)"

eliza411’s picture

Title: Proposed .feature: Viewing 'Your Posts' » Viewing 'Your Posts' (your_posts.feature)

See #1742962: [meta] Create data for tests re: creating test data.

sachin2dhoni’s picture

Status: Needs work » Needs review

Made the above suggested changes as per comment no:15 .

please check the commit logs :eb20637
AND 532d9fa,3d6d843

sachin2dhoni’s picture

Issue tags: +sprint 5

Tagging

eliza411’s picture

Component: Feature/Scenarios » Step definitions

I'm not comfortable with defining the post title in the yml file; I'm advancing this to jhedstrom for code review because we really need to contend with this issue. The rest of the feature file looks good.

jhedstrom’s picture

Status: Needs review » Needs work

I agree with #19, if the post title is static enough to go into the yml file, can't we have it be a variable in the feature context? Alternatively, couldn't we grab a post title from the top of a list of posts and save that title in the class variable? If not, let's discuss potential ways around this--the getPostTitleObject() method is confusing to me at this point.

eliza411’s picture

Unless we create data on behalf of 'site user' each time the site is set up or as part of the given statement, this test will fail because we can't guarantee there will be any posts at all when this test runs.

jhedstrom’s picture

Unless we create data on behalf of 'site user' each time the site is set up or as part of the given statement

I'm inclined towards doing this as a 'given' for now, until we have an easier way for people to run d.o. locally and have full bootstrap capabilities.

pradeeprkara’s picture

Issue tags: +sprint 6

tagging

sachin2dhoni’s picture

Status: Needs work » Needs review

As more steps are required to create test data, adding them in Given will make it bulky, I think. So I have Added a separate scenario to achieve it.

Uploading to the dev branch.
Please check the commit log: a8dae2e

Please review it.

jhedstrom’s picture

Status: Needs review » Reviewed & tested by the community

Looks good.

jhedstrom’s picture

Status: Reviewed & tested by the community » Fixed

This was merged to master.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

pradeeprkara’s picture

Version: » 6.x-1.x-dev

Please follow up #1846698: Update user_your_posts.feature for further developments.