MDL-65475 forum: Fix discussion locking behat test
[moodle.git] / mod / forum / tests / behat / discussion_lock.feature
CommitLineData
f5b4320e
P
1@mod @mod_forum @javascript
2Feature: As a teacher, you can manually lock individual discussions when viewing the discussion
3
4 Background:
5 Given the following "users" exist:
6 | username | firstname | lastname | email |
7 | student1 | Student | 1 | student1@example.com |
8 And the following "courses" exist:
9 | fullname | shortname | category |
10 | Course 1 | C1 | 0 |
11 And the following "course enrolments" exist:
12 | user | course | role |
13 | student1 | C1 | student |
14 And I log in as "admin"
15 And I am on "Course 1" course homepage with editing mode on
16 And I add a "Forum" to section "1" and I fill the form with:
17 | Forum name | Test forum name |
18 | Description | Test forum description |
19 And I add a new discussion to "Test forum name" forum with:
20 | Subject | Discussion 1 |
21 | Message | Discussion contents 1, first message |
22 And I reply "Discussion 1" post from "Test forum name" forum with:
23 | Subject | Reply 1 to discussion 1 |
24 | Message | Discussion contents 1, second message |
25 And I add a new discussion to "Test forum name" forum with:
26 | Subject | Discussion 2 |
27 | Message | Discussion contents 2, first message |
28 And I reply "Discussion 2" post from "Test forum name" forum with:
29 | Subject | Reply 1 to discussion 2 |
30 | Message | Discussion contents 2, second message |
31 And I log out
32
33 Scenario: Lock a discussion and view
34 Given I log in as "admin"
35 And I am on "Course 1" course homepage
36 And I navigate to post "Discussion 1" in "Test forum name" forum
cda9da99 37 And I press "Settings"
b72780bc
MG
38 Then "Lock this discussion" "link" should be visible
39 And I follow "Lock this discussion"
cda9da99
P
40 Then I should see "This discussion has been locked so you can no longer reply to it."
41 And I press "Settings"
b72780bc
MG
42 Then "Lock this discussion" "link" should not be visible
43 Then "Unlock this discussion" "link" should be visible
cda9da99 44 And I press "Settings"
f5b4320e
P
45 And I follow "Discussion 2"
46 Then I should not see "This discussion has been locked so you can no longer reply to it."
47 And I log out
48 And I log in as "student1"
49 And I am on "Course 1" course homepage
50 And I navigate to post "Discussion 1" in "Test forum name" forum
51 Then I should see "This discussion has been locked so you can no longer reply to it."
52 And "Reply" "link" should not be visible