[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

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

   1  @mod @mod_forum
   2  Feature: Teachers can edit or delete any forum post
   3    In order to refine the forum contents
   4    As a teacher
   5    I need to edit or delete any user's forum posts
   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 | Test forum name |
  24        | Description | Test forum description |
  25      And I add a new discussion to "Test forum name" forum with:
  26        | Subject | Teacher post subject |
  27        | Message | Teacher post message |
  28      And I log out
  29      And I log in as "student1"
  30      And I follow "Course 1"
  31      And I reply "Teacher post subject" post from "Test forum name" forum with:
  32        | Subject | Student post subject |
  33        | Message | Student post message |
  34  
  35    Scenario: A teacher can delete another user's posts
  36      Given I log out
  37      And I log in as "teacher1"
  38      When I follow "Course 1"
  39      And I follow "Test forum name"
  40      And I follow "Teacher post subject"
  41      And I click on "Delete" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' forumpost ')][contains(., 'Student post subject')]" "xpath_element"
  42      And I press "Continue"
  43      Then I should not see "Student post subject"
  44      And I should not see "Student post message"
  45  
  46    Scenario: A teacher can edit another user's posts
  47      Given I log out
  48      And I log in as "teacher1"
  49      When I follow "Course 1"
  50      And I follow "Test forum name"
  51      And I follow "Teacher post subject"
  52      And I click on "Edit" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' forumpost ')][contains(., 'Student post subject')]" "xpath_element"
  53      And I set the following fields to these values:
  54        | Subject | Edited student subject |
  55      And I press "Save changes"
  56      And I wait to be redirected
  57      Then I should see "Edited student subject"
  58      And I should see "Edited by Teacher 1 - original submission"
  59  
  60    Scenario: A student can't edit or delete another user's posts
  61      When I follow "Teacher post subject"
  62      Then I should not see "Edit" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' forumpost ')][contains(., 'Teacher post subject')]" "xpath_element"
  63      And I should not see "Delete" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' forumpost ')][contains(., 'Teacher post subject')]" "xpath_element"


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