MDL-68750 analytics: Correct behat test modal checks
[moodle.git] / analytics / tests / behat / manage_models.feature
CommitLineData
a9e58c14
VDF
1@core @core_analytics @javascript
2Feature: Manage analytics models
3 In order to manage analytics models
4 As a manager
5 I need to create and use a model
6
7 Background:
8 Given the following config values are set as admin:
9 | onlycli | 0 | analytics |
10 And the following "users" exist:
11 | username | firstname | lastname | email |
12 | teacher1 | Teacher | 1 | teacher1@example.com |
13 | manager1 | Manager | 1 | manager1@example.com |
14 | student0 | Student | 0 | student0@example.com |
15 | student1 | Student | 1 | student1@example.com |
16 | student2 | Student | 2 | student2@example.com |
17 | student3 | Student | 3 | student3@example.com |
18 | student4 | Student | 4 | student4@example.com |
19 | student5 | Student | 5 | student5@example.com |
20 | student6 | Student | 6 | student6@example.com |
21 And the following "system role assigns" exist:
22 | user | course | role |
23 | manager1 | Acceptance test site | manager |
24 And the following "courses" exist:
25 | fullname | shortname | category | enddate | startdate | enablecompletion |
26 | Course 1 | C1 | 0 | ## yesterday ## | ## 2 days ago ## | 1 |
27 | Course 2 | C2 | 0 | ## yesterday ## | ## 2 days ago ## | 1 |
28 | Course 3 | C3 | 0 | ## tomorrow ## | ## 2 days ago ## | 1 |
29 And the following "course enrolments" exist:
30 | user | course | role | timeend | timestart |
31 | teacher1 | C1 | editingteacher | ## 1 day ago ## | ## 2 days ago ## |
32 | student0 | C1 | student | ## 1 day ago ## | ## 2 days ago ## |
33 | student1 | C1 | student | ## 1 day ago ## | ## 2 days ago ## |
34 | student2 | C1 | student | ## 1 day ago ## | ## 2 days ago ## |
35 | teacher1 | C2 | editingteacher | ## 1 day ago ## | ## 2 days ago ## |
36 | student3 | C2 | student | ## 1 day ago ## | ## 2 days ago ## |
37 | student4 | C2 | student | ## 1 day ago ## | ## 2 days ago ## |
38 | teacher1 | C3 | editingteacher | 0 | ## 2 days ago ## |
39 | manager1 | C3 | manager | 0 | ## 2 days ago ## |
40 | student5 | C3 | student | 0 | ## 2 days ago ## |
41 | student6 | C3 | student | 0 | ## 2 days ago ## |
42 And the following "activities" exist:
43 | activity | name | intro | course | idnumber | section | completion | completionview |
44 | assign | assign1 | A1 desc | C1 | assign1 | 0 | 2 | 1 |
45 | assign | assign2 | A2 desc | C2 | assign2 | 0 | 2 | 1 |
46 | assign | assign3 | A3 desc | C3 | assign3 | 0 | 2 | 1 |
47 And the following "analytics model" exist:
48 | target | indicators | timesplitting | enabled |
49 | \core_course\analytics\target\course_completion | \core\analytics\indicator\any_write_action,\core\analytics\indicator\read_actions | \core\analytics\time_splitting\single_range | true |
50 And I log in as "manager1"
51 And I navigate to "Analytics > Analytics models" in site administration
52
53 Scenario: Create a model
93c539d2
VDF
54 When I open the action menu in ".top-nav" "css_element"
55 And I choose "Create model" in the open action menu
a9e58c14
VDF
56 And I set the field "Enabled" to "Enable"
57 And I select "__core_course__analytics__target__course_completion" from the "target" singleselect
58 And I open the autocomplete suggestions list
59 And I click on "Read actions amount" item in the autocomplete list
60 And I open the autocomplete suggestions list
61 And I click on "Any write action in the course" item in the autocomplete list
62 And I select "__core__analytics__time_splitting__single_range" from the "timesplitting" singleselect
63 And I press "Save changes"
64 Then I should see "No predictions available yet" in the "Students at risk of not meeting the course completion conditions" "table_row"
65
66 Scenario: Evaluate a model
67 Given I am on "Course 1" course homepage
68 And I navigate to "Course completion" in current page administration
69 And I expand all fieldsets
70 And I set the following fields to these values:
71 | Assignment - assign1 | 1 |
72 And I click on "Save changes" "button"
73 And I am on "Course 2" course homepage
74 And I navigate to "Course completion" in current page administration
75 And I expand all fieldsets
76 And I set the following fields to these values:
77 | Assignment - assign2 | 1 |
78 And I click on "Save changes" "button"
79 And I am on "Course 3" course homepage
80 And I navigate to "Course completion" in current page administration
81 And I expand all fieldsets
82 And I set the following fields to these values:
83 | Assignment - assign3 | 1 |
84 And I click on "Save changes" "button"
85 And I am on site homepage
86 And I navigate to "Analytics > Analytics models" in site administration
93c539d2
VDF
87 And I open the action menu in "Students at risk of not meeting the course completion conditions" "table_row"
88 And I choose "Evaluate" in the open action menu
a9e58c14
VDF
89 And I press "Evaluate"
90 And I should see "Evaluate model"
91 And I press "Continue"
92 # Evaluation log
93c539d2
VDF
93 And I open the action menu in "Students at risk of not meeting the course completion conditions" "table_row"
94 And I choose "Evaluation log" in the open action menu
a9e58c14
VDF
95 And I should see "Configuration"
96 And I click on "View" "link"
97 And I should see "Log extra info"
98 And I click on "Close" "button"
99 And I click on "Analytics models" "link"
100 # Execute scheduled analysis
93c539d2
VDF
101 And I open the action menu in "Students at risk of not meeting the course completion conditions" "table_row"
102 And I choose "Execute scheduled analysis" in the open action menu
a9e58c14
VDF
103 And I should see "Training results"
104 And I press "Continue"
105 # Check notifications
106 Then I should see "1" in the "#nav-notification-popover-container [data-region='count-container']" "css_element"
107 And I open the notification popover
108 And I click on "View full notification" "link" in the ".popover-region-notifications" "css_element"
109 And I should see "Students at risk in Course 3 course"
110 When I am on site homepage
111 And I navigate to "Analytics > Analytics models" in site administration
112 # View predictions
113 When I select "C3" from the "contextid" singleselect
386d1091 114 And I click on "View prediction details" "icon" in the "Student 6" "table_row"
a9e58c14
VDF
115 And I should see "Prediction details"
116 And I should see "Any write action"
117 And I should see "Read actions amount"
386d1091
DM
118 And I click on "Select Student 6 for bulk action" "checkbox" in the "Student 6" "table_row"
119 And I click on "Accept" "button"
120 And I click on "Confirm" "button" in the "Accept" "dialogue"
121 And I click on "View prediction details" "icon" in the "Student 5" "table_row"
122 And I click on "Select Student 5 for bulk action" "checkbox" in the "Student 5" "table_row"
123 And I click on "Not applicable" "button"
124 And I click on "Confirm" "button" in the "Not applicable" "dialogue"
a9e58c14
VDF
125 And I should see "No insights reported"
126 # Clear predictions
127 When I am on site homepage
128 And I navigate to "Analytics > Analytics models" in site administration
129 And I should see "No insights reported" in the "Students at risk of not meeting the course completion conditions" "table_row"
93c539d2
VDF
130 And I open the action menu in "Students at risk of not meeting the course completion conditions" "table_row"
131 And I choose "Clear predictions" in the open action menu
a9e58c14
VDF
132 And I press "Clear predictions"
133 Then I should see "No predictions available yet" in the "Students at risk of not meeting the course completion conditions" "table_row"
134
135 Scenario: Edit a model
93c539d2
VDF
136 When I open the action menu in "Students at risk of not meeting the course completion conditions" "table_row"
137 And I choose "Edit" in the open action menu
a9e58c14
VDF
138 And I click on "Read actions amount" "text" in the ".form-autocomplete-selection" "css_element"
139 And I press "Save changes"
140 And I should not see "Read actions amount"
141
142 Scenario: Disable a model
93c539d2
VDF
143 When I open the action menu in "Students at risk of not meeting the course completion conditions" "table_row"
144 And I choose "Disable" in the open action menu
a9e58c14
VDF
145 Then I should see "Disabled model" in the "Students at risk of not meeting the course completion conditions" "table_row"
146
147 Scenario: Export model
93c539d2
VDF
148 When I open the action menu in "Students at risk of not meeting the course completion conditions" "table_row"
149 And I choose "Export" in the open action menu
a9e58c14
VDF
150 And I click on "Actions" "link" in the "Students at risk of not meeting the course completion conditions" "table_row"
151 And following "Export" should download between "100" and "500" bytes
152
153 Scenario: Check invalid site elements
93c539d2
VDF
154 When I open the action menu in "Students at risk of not meeting the course completion conditions" "table_row"
155 And I choose "Invalid site elements" in the open action menu
a9e58c14
VDF
156 Then I should see "Invalid analysable elements"
157
158 Scenario: Delete model
93c539d2
VDF
159 When I open the action menu in "Students at risk of not meeting the course completion conditions" "table_row"
160 And I choose "Delete" in the open action menu
a2bc97a3 161 And I click on "Delete" "button" in the "Delete" "dialogue"
a9e58c14 162 Then I should not see "Students at risk of not meeting the course completion conditions"