Skip to content

Commit c48240f

Browse files
committed
MOBILE-3320 behat: Update quiz tests
1 parent 2a3e452 commit c48240f

File tree

3 files changed

+72
-107
lines changed

3 files changed

+72
-107
lines changed

mod/quiz/tests/behat/app_basic_usage.feature

Lines changed: 49 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@mod @mod_quiz @app @app_upto3.9.4 @javascript
1+
@mod @mod_quiz @app @javascript
22
Feature: Attempt a quiz in app
33
As a student
44
In order to demonstrate what I know
@@ -42,7 +42,7 @@ Feature: Attempt a quiz in app
4242
| Test questions | shortanswer | TF4 | Text of the second question |
4343
| Test questions | numerical | TF5 | Text of the third question |
4444
| Test questions | essay | TF6 | Text of the fourth question |
45-
| Test questions | ddwtos | TF7 | Text of the fifth question |
45+
| Test questions | ddwtos | TF7 | The [[1]] brown [[2]] jumped over the [[3]] dog. |
4646
| Test questions | truefalse | TF8 | Text of the sixth question |
4747
| Test questions | match | TF9 | Text of the seventh question |
4848
And quiz "Quiz 2" contains the following questions:
@@ -55,60 +55,58 @@ Feature: Attempt a quiz in app
5555
| TF8 | 6 |
5656
| TF9 | 7 |
5757

58-
@app @3.8.0
5958
Scenario: View a quiz entry page (attempts, status, etc.)
6059
When I enter the app
6160
And I log in as "student1"
6261
And I press "Course 1" near "Course overview" in the app
6362
And I press "Quiz 1" in the app
6463
And I press "Attempt quiz now" in the app
65-
Then I should see "Text of the first question"
66-
But I should not see "Text of the second question"
64+
Then I should find "Text of the first question" in the app
65+
But I should not find "Text of the second question" in the app
6766

6867
When I press "Next" near "Question 1" in the app
69-
Then I should see "Text of the second question"
70-
But I should not see "Text of the first question"
68+
Then I should find "Text of the second question" in the app
69+
But I should not find "Text of the first question" in the app
7170

7271
When I press "Previous" near "Question 2" in the app
73-
Then I should see "Text of the first question"
74-
But I should not see "Text of the second question"
72+
Then I should find "Text of the first question" in the app
73+
But I should not find "Text of the second question" in the app
7574

7675
When I press "Next" near "Quiz 1" in the app
77-
Then I should see "Text of the second question"
78-
But I should not see "Text of the first question"
76+
Then I should find "Text of the second question" in the app
77+
But I should not find "Text of the first question" in the app
7978

8079
When I press "Previous" near "Quiz 1" in the app
81-
Then I should see "Text of the first question"
82-
But I should not see "Text of the second question"
80+
Then I should find "Text of the first question" in the app
81+
But I should not find "Text of the second question" in the app
8382

8483
When I press "Next" near "Question 1" in the app
8584
And I press "Next" near "Quiz 1" in the app
86-
Then I should see "Summary of attempt"
85+
Then I should find "Summary of attempt" in the app
8786

8887
When I press "Return to attempt" in the app
89-
Then I should see "Text of the second question"
90-
But I should not see "Text of the first question"
88+
Then I should find "Text of the second question" in the app
89+
But I should not find "Text of the first question" in the app
9190

9291
When I press "Next" in the app
9392
And I press "Submit all and finish" in the app
94-
Then I should see "Once you submit"
93+
Then I should find "Once you submit" in the app
9594

9695
When I press "Cancel" near "Once you submit" in the app
97-
Then I should see "Summary of attempt"
96+
Then I should find "Summary of attempt" in the app
9897

9998
When I press "Submit all and finish" in the app
10099
And I press "OK" near "Once you submit" in the app
101-
Then I should see "Review of attempt 1"
102-
And I should see "Started on"
103-
And I should see "State"
104-
And I should see "Completed on"
105-
And I should see "Time taken"
106-
And I should see "Marks"
107-
And I should see "Grade"
108-
And I should see "Question 1"
109-
And I should see "Question 2"
100+
Then I should find "Review of attempt 1" in the app
101+
And I should find "Started on" in the app
102+
And I should find "State" in the app
103+
And I should find "Completed on" in the app
104+
And I should find "Time taken" in the app
105+
And I should find "Marks" in the app
106+
And I should find "Grade" in the app
107+
And I should find "Question 1" in the app
108+
And I should find "Question 2" in the app
110109

111-
@app @3.8.0
112110
Scenario: Attempt a quiz (all question types)
113111
When I enter the app
114112
And I log in as "student1"
@@ -117,31 +115,37 @@ Feature: Attempt a quiz in app
117115
And I press "Attempt quiz now" in the app
118116
And I press "Four" in the app
119117
And I press "Three" in the app
120-
And I press "Next" near "Question 1" in the app
118+
And I press "Next" "ion-button" near "Quiz 2" in the app
121119
And I set the field "Answer" to "testing" in the app
122-
And I press "Next" near "Question 2" in the app
120+
And I press "Next" "ion-button" near "Question 2" in the app
123121
And I set the field "Answer" to "5" in the app
124-
And I press "Next" near "Question 3" in the app
122+
And I press "Next" "ion-button" near "Question 3" in the app
125123
And I set the field "Answer" to "Testing an essay" in the app
126-
And I press "Next" near "Question 4" in the app
127-
And I press "lazy" in the app
128-
And I press "Next" near "Question 5" in the app
124+
And I press "Next" "ion-button" near "Question 4" in the app
125+
And I press "quick" ".drag" in the app
126+
And I press "" ".place1.drop" in the app
127+
And I press "fox" ".drag" in the app
128+
And I press "" ".place2.drop" in the app
129+
And I press "lazy" ".drag" in the app
130+
And I press "" ".place3.drop" in the app
131+
And I press "Next" "ion-button" near "Question 5" in the app
129132
And I press "True" in the app
130-
And I press "Next" near "Question 6" in the app
131-
And I press "Choose..." near "frog" in the app
133+
And I press "Next" "ion-button" near "Question 6" in the app
134+
And I press "Choose... , frog" in the app
132135
And I press "amphibian" in the app
133-
And I press "Choose..." near "newt" in the app
136+
And I press "Choose... , newt" in the app
134137
And I press "insect" in the app
135-
And I press "Choose..." near "cat" in the app
138+
And I press "Choose... , cat" in the app
136139
And I press "mammal" in the app
137-
And I press "Next" near "Question 7" in the app
138-
And I press "Submit all and finish" in the app
140+
And I press "Next" "ion-button" near "Question 7" in the app
141+
Then I should not find "Not yet answered" in the app
142+
143+
When I press "Submit all and finish" in the app
139144
And I press "OK" in the app
140-
Then I should see "Review of attempt 1"
141-
And I should see "Finished"
142-
And I should see "Not yet graded"
145+
Then I should find "Review of attempt 1" in the app
146+
And I should find "Finished" in the app
147+
And I should find "Not yet graded" in the app
143148

144-
@app @3.8.0
145149
Scenario: Submit a quiz & Review a quiz attempt
146150
When I enter the app
147151
And I log in as "student1"
@@ -154,7 +158,7 @@ Feature: Attempt a quiz in app
154158
And I press "Next" near "Question 2" in the app
155159
And I press "Submit all and finish" in the app
156160
And I press "OK" in the app
157-
Then I should see "Review of attempt 1"
161+
Then I should find "Review of attempt 1" in the app
158162

159163
When I enter the app
160164
And I log in as "teacher1"
Lines changed: 22 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@mod @mod_quiz @app @app_upto3.9.4 @javascript
1+
@mod @mod_quiz @app @javascript
22
Feature: Attempt a quiz in app
33
As a student
44
In order to demonstrate what I know
@@ -29,81 +29,42 @@ Feature: Attempt a quiz in app
2929
| TF1 | 1 |
3030
| TF2 | 2 |
3131

32-
@app_upto3.7.0
33-
Scenario: Next and previous navigation in the 3.6 app
32+
Scenario: Next and previous navigation
3433
Given I enter the app
3534
And I log in as "student1"
3635
When I press "Course 1" near "Course overview" in the app
3736
And I press "Quiz 1" in the app
3837
And I press "Attempt quiz now" in the app
39-
Then I should see "Text of the first question"
40-
And I should not see "Text of the second question"
38+
Then I should find "Text of the first question" in the app
39+
And I should not find "Text of the second question" in the app
4140
And I press "Next" near "Question 1" in the app
42-
And I should see "Text of the second question"
43-
And I should not see "Text of the first question"
41+
And I should find "Text of the second question" in the app
42+
And I should not find "Text of the first question" in the app
4443
And I press "Previous" near "Question 2" in the app
45-
And I should not see "Text of the second question"
46-
And I should see "Text of the first question"
44+
And I should not find "Text of the second question" in the app
45+
And I should find "Text of the first question" in the app
4746
And I press "Next" near "Quiz 1" in the app
48-
And I should see "Text of the second question"
49-
And I should not see "Text of the first question"
47+
And I should find "Text of the second question" in the app
48+
And I should not find "Text of the first question" in the app
5049
And I press "Previous" near "Quiz 1" in the app
51-
And I should not see "Text of the second question"
52-
And I should see "Text of the first question"
50+
And I should not find "Text of the second question" in the app
51+
And I should find "Text of the first question" in the app
5352
And I press "Next" near "Question 1" in the app
5453
And I press "Next" near "Quiz 1" in the app
55-
And I should see "Summary of attempt"
54+
And I should find "Summary of attempt" in the app
5655
And I press "Return to attempt" in the app
57-
And I should see "Text of the second question"
58-
And I should not see "Text of the first question"
56+
And I should find "Text of the second question" in the app
57+
And I should not find "Text of the first question" in the app
5958
And I press "Next" in the app
6059
And I press "Submit all and finish" in the app
61-
And I should see "Once you submit"
60+
And I should find "Once you submit" in the app
6261
And I press "Cancel" near "Once you submit" in the app
63-
And I should see "Summary of attempt"
62+
And I should find "Summary of attempt" in the app
6463
And I press "Submit all and finish" in the app
6564
And I press "OK" near "Once you submit" in the app
66-
And I should see "Review"
67-
And I press "home" in the app
68-
And I should see "Acceptance test site"
69-
70-
@app_from3.7.1
71-
Scenario: Next and previous navigation in the 3.7 app
72-
Given I enter the app
73-
And I log in as "student1"
74-
When I press "Course 1" near "Course overview" in the app
75-
And I press "Quiz 1" in the app
76-
And I press "Attempt quiz now" in the app
77-
Then I should see "Text of the first question"
78-
And I should not see "Text of the second question"
79-
And I press "Next" near "Question 1" in the app
80-
And I should see "Text of the second question"
81-
And I should not see "Text of the first question"
82-
And I press "Previous" near "Question 2" in the app
83-
And I should not see "Text of the second question"
84-
And I should see "Text of the first question"
85-
And I press "Next" near "Quiz 1" in the app
86-
And I should see "Text of the second question"
87-
And I should not see "Text of the first question"
88-
And I press "Previous" near "Quiz 1" in the app
89-
And I should not see "Text of the second question"
90-
And I should see "Text of the first question"
91-
And I press "Next" near "Question 1" in the app
92-
And I press "Next" near "Quiz 1" in the app
93-
And I should see "Summary of attempt"
94-
And I press "Return to attempt" in the app
95-
And I should see "Text of the second question"
96-
And I should not see "Text of the first question"
97-
And I press "Next" in the app
98-
And I press "Submit all and finish" in the app
99-
And I should see "Once you submit"
100-
And I press "Cancel" near "Once you submit" in the app
101-
And I should see "Summary of attempt"
102-
And I press "Submit all and finish" in the app
103-
And I press "OK" near "Once you submit" in the app
104-
And I should see "Review"
105-
And I press "home" in the app
106-
And I should see "Are you sure"
107-
And I should see "OK"
65+
And I should find "Review" in the app
66+
And I press "Home" in the app
67+
And I should find "Are you sure" in the app
68+
And I should find "OK" in the app
10869
And I press "OK" in the app
109-
And I should see "Acceptance test site"
70+
And I should find "Acceptance test site" in the app

tests/behat/behat_app.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ public function i_switch_offline_mode(string $offline) {
812812
* @return object
813813
*/
814814
public function parse_element_locator($text): object {
815-
preg_match('/^"((?:[^"]|\\")+?)"(?: "([^"]+?)")?(?: near "((?:[^"]|\\")+?)"(?: "([^"]+?)")?)?$/', $text, $matches);
815+
preg_match('/^"((?:[^"]|\\")*?)"(?: "([^"]*?)")?(?: near "((?:[^"]|\\")*?)"(?: "([^"]*?)")?)?$/', $text, $matches);
816816

817817
$locator = [
818818
'text' => str_replace('\\"', '"', $matches[1]),

0 commit comments

Comments
 (0)