[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/mod/forum/tests/behat/ -> posts_ordering_general.feature (source)

   1  @mod @mod_forum
   2  Feature: New discussions and discussions with recently added replies are displayed first
   3    In order to use forum as a discussion tool
   4    As a user
   5    I need to see currently active discussions first
   6  
   7    Background:
   8      Given the following "users" exist:
   9        | username  | firstname | lastname  | email                 |
  10        | teacher1  | Teacher   | 1         | teacher1@example.com  |
  11        | student1  | Student   | 1         | student1@example.com  |
  12      And the following "courses" exist:
  13        | fullname  | shortname | category  |
  14        | Course 1  | C1        | 0         |
  15      And the following "course enrolments" exist:
  16        | user      | course    | role            |
  17        | teacher1  | C1        | editingteacher  |
  18        | student1  | C1        | student         |
  19      And I log in as "teacher1"
  20      And I follow "Course 1"
  21      And I turn editing mode on
  22      And I add a "Forum" to section "1" and I fill the form with:
  23        | Forum name  | Course general forum                |
  24        | Description | Single discussion forum description |
  25        | Forum type  | Standard forum for general use      |
  26      And I log out
  27  
  28    #
  29    # We need javascript/wait to prevent creation of the posts in the same second. The threads
  30    # would then ignore each other in the prev/next navigation as the Forum is unable to compute
  31    # the correct order.
  32    #
  33    @javascript
  34    Scenario: Replying to a forum post or editing it puts the discussion to the front
  35      Given I log in as "student1"
  36      And I follow "Course 1"
  37      And I follow "Course general forum"
  38      #
  39      # Add three posts into the forum.
  40      #
  41      When I add a new discussion to "Course general forum" forum with:
  42        | Subject | Forum post 1            |
  43        | Message | This is the first post  |
  44      And I add a new discussion to "Course general forum" forum with:
  45        | Subject | Forum post 2            |
  46        | Message | This is the second post |
  47      And I add a new discussion to "Course general forum" forum with:
  48        | Subject | Forum post 3            |
  49        | Message | This is the third post  |
  50      #
  51      # Edit one of the forum posts.
  52      #
  53      And I follow "Forum post 2"
  54      And I click on "Edit" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' forumpost ')][contains(., 'Forum post 2')]" "xpath_element"
  55      And I set the following fields to these values:
  56        | Subject | Edited forum post 2     |
  57      And I press "Save changes"
  58      And I wait to be redirected
  59      And I log out
  60      #
  61      # Reply to another forum post.
  62      #
  63      And I log in as "teacher1"
  64      And I follow "Course 1"
  65      And I follow "Course general forum"
  66      And I follow "Forum post 1"
  67      And I click on "Reply" "link" in the "//div[@aria-label='Forum post 1 by Student 1']" "xpath_element"
  68      And I set the following fields to these values:
  69        | Message | Reply to the first post |
  70      And I press "Post to forum"
  71      And I wait to be redirected
  72      And I am on site homepage
  73      And I follow "Course 1"
  74      And I follow "Course general forum"
  75      #
  76      # Make sure the order of the forum posts is as expected (most recently participated first).
  77      #
  78      Then I should see "Forum post 3" in the "//tr[contains(concat(' ', normalize-space(@class), ' '), ' discussion ')][position()=3]" "xpath_element"
  79      And I should see "Edited forum post 2" in the "//tr[contains(concat(' ', normalize-space(@class), ' '), ' discussion ')][position()=2]" "xpath_element"
  80      And I should see "Forum post 1" in the "//tr[contains(concat(' ', normalize-space(@class), ' '), ' discussion ')][position()=1]" "xpath_element"
  81      #
  82      # Make sure the next/prev navigation uses the same order of the posts.
  83      #
  84      And I follow "Edited forum post 2"
  85      And "//a[@aria-label='Next discussion: Forum post 1']" "xpath_element" should exist
  86      And "//a[@aria-label='Previous discussion: Forum post 3']" "xpath_element" should exist


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1