Skip to content

Commit 8c494dd

Browse files
authored
Merge pull request #4598 from crazyserver/MOBILE-4842
Mobile 4842
2 parents 17a6d95 + 8329bc3 commit 8c494dd

File tree

10 files changed

+219
-51
lines changed

10 files changed

+219
-51
lines changed

.github/workflows/acceptance.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ jobs:
4141
working-directory: app
4242
run: npm ci --no-audit
4343

44+
- name: Install languages
45+
working-directory: app
46+
run: |
47+
npx gulp lang
48+
npm run lang:update-langpacks
49+
4450
- name: Build app
4551
working-directory: app
4652
run: npm run build:test

local_moodleappbehat/tests/behat/behat_app.php

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ public function i_enter_the_activity_in_the_app(string $activity, string $activi
476476
/**
477477
* Presses standard buttons in the app.
478478
*
479-
* @When /^I press the (back|more menu|page menu|user menu) button in the app$/
479+
* @When /^I press the (back|more menu|page context menu|user menu) button in the app$/
480480
* @param string $button Button type
481481
* @throws DriverException If the button push doesn't work
482482
*/
@@ -485,7 +485,30 @@ public function i_press_the_standard_button_in_the_app(string $button) {
485485
$result = $this->runtime_js("pressStandard('$button')");
486486

487487
if ($result !== 'OK') {
488-
throw new DriverException('Error pressing standard button - ' . $result);
488+
throw new DriverException("Error pressing $button button - $result");
489+
}
490+
491+
return true;
492+
});
493+
494+
$this->wait_for_pending_js();
495+
}
496+
497+
/**
498+
* Presses deprecated page menu button in the app.
499+
*
500+
* @When /^I press the page menu button in the app$/
501+
* @throws DriverException If the button push doesn't work
502+
* @deprecated since 5.1 Use "I press the page context menu button in the app" instead.
503+
*/
504+
public function i_press_the_page_menu_button_in_the_app() {
505+
$button = 'page context menu';
506+
507+
$this->spin(function() use ($button) {
508+
$result = $this->runtime_js("pressStandard('$button')");
509+
510+
if ($result !== 'OK') {
511+
throw new DriverException('Error pressing deprecated page menu button - ' . $result);
489512
}
490513

491514
return true;
@@ -1325,6 +1348,27 @@ public function i_open_the_calendar_for($month, $year) {
13251348
$this->zone_js("navigator.navigateToSitePath('/calendar/index', $options)");
13261349
}
13271350

1351+
/**
1352+
* Change language in the app
1353+
*
1354+
* @When /^I change language to "(.+)" in the app$/
1355+
* @param string $language Language code.
1356+
*/
1357+
public function i_change_language(string $langcode) {
1358+
$this->spin(function() use ($langcode) {
1359+
$result = $this->runtime_js("changeLanguage('$langcode')");
1360+
1361+
if ($result !== 'OK') {
1362+
throw new DriverException('Error changing language - ' . $result);
1363+
}
1364+
1365+
return true;
1366+
});
1367+
1368+
// Wait the app to be restarted.
1369+
$this->prepare_browser();
1370+
}
1371+
13281372
/**
13291373
* Change the viewport size in the browser running the Moodle App.
13301374
*

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Feature: Test creation of calendar events in app
5757
And I should find "Barcelona" in the app
5858
But I should not find "Ending time" in the app
5959

60-
When I press "Display options" in the app
60+
When I press the page context menu button in the app
6161
Then I should find "Edit" in the app
6262
And I should find "Delete" in the app
6363

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ Feature: Test competency navigation
240240
And I set the field "Search" to "student" in the app
241241
And I press "Search" "button" in the app
242242
And I press "Student first" in the app
243-
And I press "Display options" in the app
243+
And I press the page context menu button in the app
244244
And I press "User info" in the app
245245
And I press "Learning plans" in the app
246246
Then I should find "Cookery" in the app
@@ -428,7 +428,7 @@ Feature: Test competency navigation
428428
And I press "Search people and messages" in the app
429429
And I set the field "Search" to "student" in the app
430430
And I press "Search" "button" in the app
431-
And I press "Display options" in the app
431+
And I press the page context menu button in the app
432432
And I press "User info" in the app
433433
And I press "Learning plans" in the app
434434
Then I should find "Cookery is important" in the app

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

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Feature: Test basic usage of messages in app
3131
And I press "Student1 student1" in the app
3232
And I set the field "New message" to "heeey student" in the app
3333
And I press "Send" in the app
34-
And I press "Display options" in the app
34+
And I press the page context menu button in the app
3535
And I press "Add to contacts" in the app
3636
And I press "Add" near "Are you sure you want to add Student1 student1 to your contacts?" in the app
3737
Then I should find "Contact request sent" in the app
@@ -133,7 +133,7 @@ Feature: Test basic usage of messages in app
133133
And I press "Send" in the app
134134
Then I should find "heeey student" in the app
135135

136-
When I press "Display options" in the app
136+
When I press the page context menu button in the app
137137
And I press "Add to contacts" in the app
138138
And I press "Add" in the app
139139
Then I should find "Contact request sent" in the app
@@ -148,20 +148,20 @@ Feature: Test basic usage of messages in app
148148
When I press "Accept and add to contacts" in the app
149149
Then I should not find "Teacher teacher would like to contact you" in the app
150150

151-
When I press "Display options" in the app
151+
When I press the page context menu button in the app
152152
And I press "User info" in the app
153153
And I press "Message" in the app
154154
And I set the field "New message" to "hi" in the app
155155
And I press "Send" "button" in the app
156156
Then I should find "heeey student" in the app
157157
And I should find "hi" in the app
158158

159-
When I press "Display options" in the app
159+
When I press the page context menu button in the 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
163163
And I go back 2 times in the app
164-
And I press "Display options" in the app
164+
And I press the page context menu button in the app
165165
Then I should find "Add to contacts" in the app
166166

167167
When I press "Delete conversation" in the app
@@ -276,7 +276,7 @@ Feature: Test basic usage of messages in app
276276
And I should find "Starred (1)" in the app
277277

278278
When I press "star message" in the app
279-
And I press "Display options" in the app
279+
And I press the page context menu button in the app
280280
And I press "Star conversation" in the app
281281
And I go back in the app
282282
Then I should find "Private (1)" in the app
@@ -291,7 +291,7 @@ Feature: Test basic usage of messages in app
291291
When I press "Participants" in the app
292292
And I press "Student1 student1" in the app
293293
And I press "Message" in the app
294-
And I press "Display options" in the app
294+
And I press the page context menu button in the app
295295
And I press "Block user" in the app
296296
And I press "Block user" near "Are you sure you want to block Student1 student1?" in the app
297297
Then I should find "You have blocked this user" in the app
@@ -306,7 +306,7 @@ Feature: Test basic usage of messages in app
306306
When I press "Participants" in the app
307307
And I press "Student1 student1" in the app
308308
And I press "Message" in the app
309-
And I press "Display options" in the app
309+
And I press the page context menu button in the app
310310
Then I should find "Unblock user" in the app
311311
But I should not find "Block user" in the app
312312

@@ -332,15 +332,15 @@ Feature: Test basic usage of messages in app
332332
And I press "Send" in the app
333333
Then I should find "test message" in the app
334334

335-
When I press "Display options" in the app
335+
When I press the page context menu button in the app
336336
And I press "Mute" in the app
337337
Then I should find "Muted conversation" in the app
338338

339-
When I press "Display options" in the app
339+
When I press the page context menu button in the app
340340
And I press "Unmute" in the app
341341
Then I should not find "Muted conversation" in the app
342342

343-
When I press "Display options" in the app
343+
When I press the page context menu button in the app
344344
When I press "Mute" in the app
345345
Then I should find "Muted conversation" in the app
346346

@@ -369,12 +369,12 @@ Feature: Test basic usage of messages in app
369369
When I switch network connection to wifi
370370
And I go back in the app
371371
And I press "Student1 student1" in the app
372-
And I press "Display options" in the app
372+
And I press the page context menu button in the app
373373
Then I should find "Show delete messages" in the app
374374
And I should find "Delete conversation" in the app
375375

376376
When I press "Unstar conversation" in the app
377-
And I press "Display options" in the app
377+
And I press the page context menu button in the app
378378
Then I should find "Star conversation" in the app
379379
And I should find "Delete conversation" in the app
380380

@@ -388,7 +388,7 @@ Feature: Test basic usage of messages in app
388388
Then I should find "self conversation online" in the app
389389
But I should not find "self conversation offline" in the app
390390

391-
When I press "Display options" in the app
391+
When I press the page context menu button in the app
392392
And I press "Delete conversation" in the app
393393
And I press "Delete" near "Are you sure you would like to delete this entire personal conversation?" in the app
394394
Then I should not find "self conversation online" in the app

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ Feature: Test messages navigation in the app
2626
And I press "Send" in the app
2727
Then I should find "Hi there" in the app
2828

29-
When I press "Display options" in the app
29+
When I press the page context menu button in the app
3030
And I press "User info" in the app
3131
Then I should find "Details" in the app
3232

3333
When I press "Message" in the app
3434
Then I should find "Hi there" in the app
3535

36-
When I press "Display options" in the app
36+
When I press the page context menu button in the app
3737
Then I should not find "User info" in the app
3838

3939
When I close the popup in the app

src/core/features/comments/tests/behat/basic_usage.feature

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Feature: Test basic usage of comments in app
8484
When I go back in the app
8585
And I press "Comments (0)" in the app
8686
And I switch network connection to wifi
87-
And I press "Display options" in the app
87+
And I press the page context menu button in the app
8888
And I press "Synchronise now" in the app
8989
And I close the popup in the app
9090
Then I should find "comment test" in the app
@@ -104,7 +104,7 @@ Feature: Test basic usage of comments in app
104104
When I go back in the app
105105
And I press "Comments (1)" in the app
106106
And I switch network connection to wifi
107-
And I press "Display options" in the app
107+
And I press the page context menu button in the app
108108
And I press "Synchronise now" in the app
109109
And I close the popup in the app
110110
Then I should not see "There are offline comments to be synchronised."
@@ -171,7 +171,7 @@ Feature: Test basic usage of comments in app
171171
When I go back in the app
172172
And I press "Comments (0)" in the app
173173
And I switch network connection to wifi
174-
And I press "Display options" in the app
174+
And I press the page context menu button in the app
175175
And I press "Synchronise now" in the app
176176
And I close the popup in the app
177177
Then I should find "comment test" in the app
@@ -191,7 +191,7 @@ Feature: Test basic usage of comments in app
191191
When I go back in the app
192192
And I press "Comments (1)" in the app
193193
And I switch network connection to wifi
194-
And I press "Display options" in the app
194+
And I press the page context menu button in the app
195195
And I press "Synchronise now" in the app
196196
And I close the popup in the app
197197
Then I should not see "There are offline comments to be synchronised."
@@ -253,7 +253,7 @@ Feature: Test basic usage of comments in app
253253
When I go back in the app
254254
And I press "Comments (0)" in the app
255255
And I switch network connection to wifi
256-
And I press "Display options" in the app
256+
And I press the page context menu button in the app
257257
And I press "Synchronise now" in the app
258258
And I close the popup in the app
259259
Then I should find "comment test" in the app
@@ -273,7 +273,7 @@ Feature: Test basic usage of comments in app
273273
When I go back in the app
274274
And I press "Comments (1)" in the app
275275
And I switch network connection to wifi
276-
And I press "Display options" in the app
276+
And I press the page context menu button in the app
277277
And I press "Synchronise now" in the app
278278
And I close the popup in the app
279279
Then I should not see "There are offline comments to be synchronised."
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
@core_lang @app @javascript
2+
Feature: Test language changes
3+
4+
Background:
5+
Given the following "users" exist:
6+
| username |
7+
| student1 |
8+
9+
Scenario: User can change language
10+
Given I entered the app as "student1"
11+
When I press the more menu button in the app
12+
And I press "App settings" in the app
13+
And I press "General" in the app
14+
And I press "Language" in the app
15+
And I press "Català" in the app
16+
And I press "Canvia a Català" in the app
17+
And I wait the app to restart
18+
19+
Then I should find "Els meus cursos" in the app
20+
21+
When I change language to "es" in the app
22+
Then I should find "Mis cursos" in the app

0 commit comments

Comments
 (0)