Skip to content

Commit e2e1792

Browse files
committed
MOBILE-4616 behat: Add an step to go back to root and go back many times
1 parent 038dfd1 commit e2e1792

File tree

52 files changed

+388
-309
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+388
-309
lines changed

local_moodleappbehat/tests/behat/behat_app.php

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ public function i_enter_the_activity_in_the_app(string $activity, string $activi
467467
/**
468468
* Presses standard buttons in the app.
469469
*
470-
* @When /^I press the (back|more menu|page menu|user menu|main menu) button in the app$/
470+
* @When /^I press the (back|more menu|page menu|user menu) button in the app$/
471471
* @param string $button Button type
472472
* @throws DriverException If the button push doesn't work
473473
*/
@@ -485,6 +485,51 @@ public function i_press_the_standard_button_in_the_app(string $button) {
485485
$this->wait_for_pending_js();
486486
}
487487

488+
/**
489+
* Presses go back repeatedly in the app.
490+
*
491+
* @When /^I go back( (\d+) times)? in the app$/
492+
* @param int $times
493+
* @throws DriverException If the navigation doesn't work
494+
*/
495+
public function i_go_back_x_times_in_the_app(?string $unused = null, ?int $times = 1) {
496+
if ($times < 1) {
497+
return;
498+
}
499+
500+
$this->spin(function() use ($times) {
501+
$result = $this->runtime_js("goBackTimes($times)");
502+
503+
if ($result !== 'OK') {
504+
throw new DriverException('Error navigating back - ' . $result);
505+
}
506+
507+
return true;
508+
});
509+
510+
$this->wait_for_pending_js();
511+
}
512+
513+
/**
514+
* Presses go back repeatedly until the app is in the main menu.
515+
*
516+
* @When /^I go back to the root page in the app$/
517+
* @throws DriverException If the navigation doesn't work
518+
*/
519+
public function i_go_back_to_root_in_the_app() {
520+
$this->spin(function() {
521+
$result = $this->runtime_js("goBackToRoot()");
522+
523+
if ($result !== 'OK') {
524+
throw new DriverException('Error navigating to root - ' . $result);
525+
}
526+
527+
return true;
528+
});
529+
530+
$this->wait_for_pending_js();
531+
}
532+
488533
/**
489534
* Receives push notifications.
490535
*

src/addons/calendar/tests/behat/create_events.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Feature: Test creation of calendar events in app
2323
# This test is flaky due to timestamp.
2424
Scenario: Create user event as student from monthly view
2525
Given I entered the app as "student1"
26-
When I press "More" in the app
26+
When I press the more menu button in the app
2727
And I press "Calendar" in the app
2828
And I press "New event" in the app
2929
# Flaky step, sometimes it fails due to minute change when checking.

src/addons/competency/tests/behat/navigation.feature

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,7 @@ Feature: Test competency navigation
115115
But I should not find "Cakes" in the app
116116

117117
# Learning plans
118-
When I press the back button in the app
119-
And I press the back button in the app
120-
And I press the back button in the app
118+
When I go back to the root page in the app
121119
And I press the user menu button in the app
122120
And I press "Learning plans" in the app
123121
Then I should find "Cookery" in the app
@@ -236,9 +234,7 @@ Feature: Test competency navigation
236234
But I should not find "Cakes" in the app
237235

238236
# User learning plans
239-
When I press the back button in the app
240-
And I press the back button in the app
241-
And I press the back button in the app
237+
When I go back to the root page in the app
242238
And I press "Messages" in the app
243239
And I press "Search people and messages" in the app
244240
And I set the field "Search" to "student" in the app
@@ -482,7 +478,7 @@ Feature: Test competency navigation
482478
When I entered the course "Course 1" as "student1" in the app
483479
Then I should not find "Competencies" in the app
484480

485-
When I press the back button in the app
481+
When I go back to the root page in the app
486482
And I press the user menu button in the app
487483

488484
Then I should not find "Learning plans" in the app

src/addons/messages/tests/behat/basic_usage.feature

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ Feature: Test basic usage of messages in app
5252
And I replace "/.*/" within ".message-time" with "[Date]"
5353
Then the UI should match the snapshot
5454

55-
When I press the back button in the app
55+
When I go back in the app
5656
And I press "Contacts" near "No contact requests" in the app
5757
Then the header should be "Contacts" in the app
5858
And I should find "Teacher teacher" in the app
5959

60-
When I press the back button in the app
60+
When I go back in the app
6161
And I press "Teacher teacher" in the app
6262
Then the header should be "Teacher teacher" in the app
6363
And I should find "heeey student" in the app
@@ -160,8 +160,7 @@ Feature: Test basic usage of messages in app
160160
And I press "Remove from contacts" in the app
161161
And I press "Remove" in the app
162162
And I wait loading to finish in the app
163-
And I press the back button in the app
164-
And I press the back button in the app
163+
And I go back 2 times in the app
165164
And I press "Display options" in the app
166165
Then I should find "Add to contacts" in the app
167166

@@ -188,7 +187,7 @@ Feature: Test basic usage of messages in app
188187
Then I should find "byee" in the app
189188

190189
When I switch network connection to wifi
191-
And I press the back button in the app
190+
And I go back in the app
192191
And I press "Student1 student1" in the app
193192
Then I should find "heeey student" in the app
194193
And I should find "byee" in the app
@@ -279,7 +278,7 @@ Feature: Test basic usage of messages in app
279278
When I press "star message" in the app
280279
And I press "Display options" in the app
281280
And I press "Star conversation" in the app
282-
And I press the back button in the app
281+
And I go back in the app
283282
Then I should find "Private (1)" in the app
284283
And I should find "Starred (2)" in the app
285284

@@ -345,7 +344,8 @@ Feature: Test basic usage of messages in app
345344
When I press "Mute" in the app
346345
Then I should find "Muted conversation" in the app
347346

348-
When I press "Messages" in the app
347+
When I go back to the root page in the app
348+
And I press "Messages" in the app
349349
And I press "Private (1)" in the app
350350
And I press "Student2 student2" in the app
351351
Then I should find "test message" in the app
@@ -367,7 +367,7 @@ Feature: Test basic usage of messages in app
367367
Then I should find "self conversation offline" in the app
368368

369369
When I switch network connection to wifi
370-
And I press the back button in the app
370+
And I go back in the app
371371
And I press "Student1 student1" in the app
372372
And I press "Display options" in the app
373373
Then I should find "Show delete messages" in the app
@@ -394,7 +394,7 @@ Feature: Test basic usage of messages in app
394394
Then I should not find "self conversation online" in the app
395395
And I should not find "self conversation offline" in the app
396396

397-
When I press the back button in the app
397+
When I go back in the app
398398
And I press "Search people and messages" in the app
399399
And I set the field "Search" to "Student1 student1" in the app
400400
And I press "Search" "button" in the app
@@ -403,8 +403,7 @@ Feature: Test basic usage of messages in app
403403
And I press "Send" in the app
404404
Then I should find "auto search test" in the app
405405

406-
When I press the back button in the app
407-
And I press the back button in the app
406+
When I go back 2 times in the app
408407
And I press "Private" in the app
409408
And I press "Student1 student1" in the app
410409
Then I should find "auto search test" in the app

src/addons/messages/tests/behat/navigation.feature

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,5 @@ Feature: Test messages navigation in the app
3737
Then I should not find "User info" in the app
3838

3939
When I close the popup in the app
40-
And I press the back button in the app
41-
And I press the back button in the app
40+
And I go back 2 times in the app
4241
Then I should find "Hi there" in the app

src/addons/mod/assign/tests/behat/basic_usage.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ Feature: Test basic usage of assignment activity in app
131131
Then I should find "This Assignment has offline data to be synchronised." in the app
132132

133133
When I switch network connection to wifi
134-
And I press the back button in the app
134+
And I go back in the app
135135
And I press "assignment1" in the app
136136
And I press "Information" in the app
137137
And I press "Refresh" in the app
@@ -159,7 +159,7 @@ Feature: Test basic usage of assignment activity in app
159159
Then I should find "This Assignment has offline data to be synchronised." in the app
160160

161161
When I switch network connection to wifi
162-
And I press the back button in the app
162+
And I go back in the app
163163
And I press "assignment1" in the app
164164
Then I should find "Submitted for grading" in the app
165165
And I should find "Submission test edited offline" in the app

src/addons/mod/assign/tests/behat/marking_workflow-404.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Feature: Test marking workflow in assignment activity in app
8484
And the field "Grade out of 100" matches value "50" in the app
8585
And I should not find "Graded by" in the app
8686

87-
When I press the back button in the app
87+
When I go back in the app
8888
And I press "Student3" in the app
8989
And I press "Grade" in the app
9090
Then I should find "Submitted for grading" in the app
@@ -109,7 +109,7 @@ Feature: Test marking workflow in assignment activity in app
109109
And I should find "In review" within "Marking workflow state" "ion-item" in the app
110110
And the field "Grade out of 100" matches value "60" in the app
111111

112-
When I press the back button in the app
112+
When I go back in the app
113113
And I press "Student3" in the app
114114
And I press "Grade" in the app
115115
When I set the field "Grade out of 100" to "80" in the app

src/addons/mod/assign/tests/behat/marking_workflow.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Feature: Test marking workflow in assignment activity in app
8484
And the field "Grade out of 100" matches value "50" in the app
8585
And I should not find "Graded by" in the app
8686

87-
When I press the back button in the app
87+
When I go back in the app
8888
And I press "Student3" in the app
8989
And I press "Grade" in the app
9090
Then I should find "Submitted for grading" in the app
@@ -109,7 +109,7 @@ Feature: Test marking workflow in assignment activity in app
109109
And I should find "In review" within "Marking workflow state" "ion-item" in the app
110110
And the field "Grade out of 100" matches value "60" in the app
111111

112-
When I press the back button in the app
112+
When I go back in the app
113113
And I press "Student3" in the app
114114
And I press "Grade" in the app
115115
When I set the field "Grade out of 100" to "80" in the app

src/addons/mod/assign/tests/behat/navigation.feature

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ Feature: Test assignments navigation
7272
And I should not find "Second Student" in the app
7373

7474
# Drafts
75-
When I press the back button in the app
76-
And I press the back button in the app
75+
When I go back 2 times in the app
7776
And I press "Drafts" in the app
7877
Then I should find "First Student" in the app
7978
And I should find "Third Student" in the app
@@ -97,8 +96,7 @@ Feature: Test assignments navigation
9796
And I should not find "Second Student" in the app
9897

9998
# Filter groups in assignment page
100-
When I press the back button in the app
101-
And I press the back button in the app
99+
When I go back 2 times in the app
102100
And I press "Separate groups" in the app
103101
And I press "Group 1" in the app
104102
Then I should find "2" near "Participants" in the app
@@ -126,7 +124,7 @@ Feature: Test assignments navigation
126124
And I should not find "Third Student" in the app
127125

128126
# Filter groups in submissions page
129-
When I press the back button in the app
127+
When I go back in the app
130128
And I press "Separate groups" in the app
131129
And I press "Group 2" in the app
132130
Then I should find "Second Student" in the app
@@ -176,7 +174,7 @@ Feature: Test assignments navigation
176174
And I should not find "Third Student" inside the split-view content in the app
177175

178176
# Drafts
179-
When I press the back button in the app
177+
When I go back in the app
180178
And I press "Drafts" in the app
181179
Then I should find "First Student" in the app
182180
And I should find "Third Student" in the app
@@ -193,7 +191,7 @@ Feature: Test assignments navigation
193191
And I should not find "Second Student" in the app
194192

195193
# Filter groups in assignment page
196-
When I press the back button in the app
194+
When I go back in the app
197195
And I press "Separate groups" in the app
198196
And I press "Group 1" in the app
199197
Then I should find "2" near "Participants" in the app

src/addons/mod/bigbluebuttonbn/tests/behat/basic_usage.feature

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ Feature: Test basic usage of BBB activity in app
2929
Then I should find "The session has not started yet." in the app
3030
And I should find "Saturday, 1 January 2050, 12:00 AM" within "Open" "ion-item" in the app
3131

32-
When I press the back button in the app
32+
When I go back in the app
3333
And I press "BBB 2" in the app
3434
Then I should find "The session has ended." in the app
3535
And I should find "Saturday, 1 January 2000, 12:00 AM" within "Close" "ion-item" in the app
3636

37-
When I press the back button in the app
37+
When I go back in the app
3838
And I press "BBB 3" in the app
3939
Then I should find "This room is ready. You can join the session now." in the app
4040
And I should find "Saturday, 1 January 2000, 12:00 AM" within "Open" "ion-item" in the app
@@ -113,13 +113,13 @@ Feature: Test basic usage of BBB activity in app
113113
And I should find "Recordings" in the app
114114
And I should find "There are no recordings available." in the app
115115

116-
When I press the back button in the app
116+
When I go back in the app
117117
And I press "Room only" in the app
118118
Then I should find "This room is ready. You can join the session now." in the app
119119
And I should be able to press "Join session" in the app
120120
But I should not find "Recordings" in the app
121121

122-
When I press the back button in the app
122+
When I go back in the app
123123
And I press "Recordings only" in the app
124124
Then I should find "Recordings" in the app
125125
But I should not find "This room is ready. You can join the session now." in the app

0 commit comments

Comments
 (0)