MDL-38960 behat: New test
[moodle.git] / mod / wiki / tests / behat / page_history.feature
blob92d8712de954c656871d99080cdb8a7b380753fd
1 @mod_wiki @mod
2 Feature: A history of each wiki page is available
3   In order to know how a wiki page evolved over the time and how changed what
4   As a moodle user
5   I need to check the history of a wiki page
7   @javascript
8   Scenario: Wiki page edition history changes list
9     Given the following "users" exists:
10       | username | firstname | lastname | email |
11       | teacher1 | Teacher | 1 | teacher1@asd.com |
12       | student1 | Student | 1 | student1@asd.com |
13       | student2 | Student | 2 | student2@asd.com |
14     And the following "courses" exists:
15       | fullname | shortname | category |
16       | Course 1 | C1 | 0 |
17     And the following "course enrolments" exists:
18       | user | course | role |
19       | teacher1 | C1 | editingteacher |
20       | student1 | C1 | student |
21       | student2 | C1 | student |
22     And I log in as "teacher1"
23     And I follow "Course 1"
24     And I turn editing mode on
25     And I add a "Wiki" to section "1" and I fill the form with:
26       | Wiki name | Test wiki name |
27       | Description | Test wiki description |
28       | First page name | First page |
29       | Wiki mode | Collaborative wiki |
30     And I follow "Test wiki name"
31     And I press "Create page"
32     And I fill the moodle form with:
33       | HTML format | First edition |
34     And I press "Save"
35     And I log out
36     When I log in as "student1"
37     And I follow "Course 1"
38     And I follow "Test wiki name"
39     And I follow "Edit"
40     And I fill the moodle form with:
41       | HTML format | Second edition |
42     And I press "Save"
43     And I log out
44     And I log in as "student2"
45     And I follow "Course 1"
46     And I follow "Test wiki name"
47     And I follow "Edit"
48     And I fill the moodle form with:
49       | HTML format | Third edition |
50     And I press "Save"
51     And I follow "History"
52     # Checking that there are 3 history items (the first one is are th)
53     And "//div[@class='region-content']/descendant::table/descendant::tr[4]" "xpath_element" should exists
54     And I click on "1" "link" in the "Teacher 1" table row
55     And I should see "First edition"
56     And I should see "Teacher 1"
57     And I follow "History"
58     And I click on "2" "link" in the "Student 1" table row
59     And I should see "Second edition"
60     And I should see "Student 1"
61     And I follow "History"
62     And I click on "3" "link" in the "Student 2" table row
63     And I should see "Third edition"
64     And I should see "Student 2" in the ".region-content" "css_element"
65     And I follow "History"
66     And I click on "comparewith" "radio" in the "Student 1" table row
67     And I click on "compare" "radio" in the "Teacher 1" table row
68     And I press "Compare selected"
69     And I should see "Comparing version 1 with version 3"
70     And I follow "Next"
71     And I should see "Comparing version 2 with version 3"