MDL-43620 Chat: Behat test for course reset
[moodle.git] / mod / chat / tests / behat / chat_course_reset.feature
CommitLineData
8cf5ac4a
SB
1@mod @mod_chat
2Feature: Chat reset
3 In order to reuse past chat activities
4 As a teacher
5 I need to remove all previous data.
6
7 Background:
8 Given the following "users" exist:
9 | username | firstname | lastname | email |
10 | teacher1 | Tina | Teacher1 | teacher1@example.com |
11 | student1 | Sam | Student1 | 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 the following "activities" exist:
20 | activity | name | Description | course | idnumber |
21 | chat | Test chat name | Test chat description | C1 | chat1 |
22
23 Scenario: Use course reset to update chat start date
24 And I log in as "teacher1"
25 And I follow "Course 1"
26 And I turn editing mode on
27 And I navigate to "Edit settings" node in "Course administration"
28 And I set the following fields to these values:
29 | startdate[day] | 1 |
30 | startdate[month] | January |
31 | startdate[year] | 2020 |
32 And I press "Save and display"
33 And I follow "Test chat name"
34 And I navigate to "Edit settings" node in "Chat administration"
35 And I set the following fields to these values:
36 | chattime[day] | 1 |
37 | chattime[month] | January |
38 | chattime[year] | 2020 |
39 | chattime[hour] | 12 |
40 | chattime[minute] | 00 |
41 And I press "Save and display"
42 When I navigate to "Reset" node in "Course administration"
43 And I set the following fields to these values:
44 | id_reset_start_date_enabled | 1 |
45 | reset_start_date[day] | 1 |
46 | reset_start_date[month] | January |
47 | reset_start_date[year] | 2030 |
48 And I press "Reset course"
49 And I should see "Date changed" in the "Chats" "table_row"
50 And I press "Continue"
51 Then I follow "Course 1"
52 And I follow "Test chat name"
53 And I navigate to "Edit settings" node in "Chat administration"
54 And I expand all fieldsets
55 And the "id_chattime_year" select box should contain "2030"