MDL-39586 behat: Closed list of stackeholders
[moodle.git] / mod / wiki / tests / behat / preview_page.feature
blob524bf7054016bdf961cb25170454343b6b4a6d5c
1 @mod @mod_wiki
2 Feature: Edited wiki pages may be previewed before saving
3   In order to avoid silly mistakes
4   As a user
5   I need to preview pages before saving changes
7   Background:
8     Given the following "users" exists:
9       | username | firstname | lastname | email |
10       | teacher1 | Teacher | 1 | teacher1@asd.com |
11       | student1 | Student | 1 | student1@asd.com |
12     And the following "courses" exists:
13       | fullname | shortname | category |
14       | Course 1 | C1 | 0 |
15     And the following "course enrolments" exists:
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 "Wiki" to section "1" and I fill the form with:
23       | Wiki name | Test wiki name |
24       | Description | Test wiki description |
25       | First page name | First page |
26       | Wiki mode | Collaborative wiki |
27     And I log out
28     And I log in as "student1"
29     And I follow "Course 1"
30     And I follow "Test wiki name"
31     When I press "Create page"
32     And I fill the moodle form with:
33       | HTML format | Student page contents to be previewed |
34     And I press "Preview"
35     Then I should see "This is a preview. Changes have not been saved yet"
36     And I should see "Student page contents to be previewed"
37     And I press "Save"
38     And I should see "Student page contents to be previewed"
39     And I follow "Edit"
41   @javascript
42   Scenario: Page contents preview before saving with Javascript enabled
43     Then the "HTML format" field should match "<p>Student page contents to be previewed</p>" value
44     And I press "Cancel"
46   Scenario: Page contents preview before saving with Javascript disabled
47     Then the "HTML format" field should match "Student page contents to be previewed" value
48     And I press "Cancel"