Skip to content

Commit ec52c86

Browse files
committed
MOBILE-4901 lang: Add behat testing for custom lang strings
1 parent 51e3fd4 commit ec52c86

File tree

3 files changed

+39
-25
lines changed

3 files changed

+39
-25
lines changed

src/core/features/mainmenu/pages/reload/reload.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
import { Component, OnInit } from '@angular/core';
15+
import { Component } from '@angular/core';
1616
import { CoreNavigator } from '@services/navigator';
1717
import { CoreSharedModule } from '@/core/shared.module';
1818

@@ -26,12 +26,15 @@ import { CoreSharedModule } from '@/core/shared.module';
2626
CoreSharedModule,
2727
],
2828
})
29-
export default class CoreMainMenuReloadPage implements OnInit {
29+
export default class CoreMainMenuReloadPage {
3030

3131
/**
32-
* @inheritdoc
32+
* Runs when the page has fully entered and is now the active page.
33+
* This event will fire, whether it was the first load or a cached page.
34+
*
35+
* This is not done on the ngOnInit because it can happen the page is revisited before destroyed.
3336
*/
34-
ngOnInit(): void {
37+
ionViewDidEnter(): void {
3538
CoreNavigator.navigate('/main', {
3639
reset: true,
3740
});

src/core/tests/behat/customlangstrings.feature

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/core/tests/behat/language.feature

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,37 @@ Feature: Test language changes
1616
And I press "Canvia a Català" in the app
1717
And I wait the app to restart
1818

19+
# core.courses.mycourses text
1920
Then I should find "Els meus cursos" in the app
2021

21-
When I change language to "es" in the app
22-
Then I should find "Mis cursos" in the app
22+
# Test parent language
23+
When I change language to "de-du" in the app
24+
# Find an specific text for German (du) translation.
25+
And I press the more menu button in the app
26+
# addon.blog.siteblogheading text from original German translation.
27+
And I press "Website-Blog" in the app
28+
# addon.blog.showonlyyourentries text from original German (du) translation.
29+
Then I should find "Nur deine Beiträge anzeigen" in the app
30+
But I should not find "Nur Ihre Beiträge anzeigen" in the app
31+
32+
Scenario: Custom lang strings
33+
Given I log in as "admin"
34+
And I navigate to "General > Mobile app > Mobile features" in site administration
35+
And I set the field "Custom language strings" to multiline:
36+
"""
37+
core.courses.mycourses|Foo|en
38+
core.courses.mycourses| Foo amb espais |ca
39+
addon.block_timeline.pluginname| No content here |en_us
40+
"""
41+
And I press "Save changes"
42+
43+
When I entered the app as "student1"
44+
Then I should be able to press "Foo" in the app
45+
Then I should not find "No content here" in the app
46+
47+
When I change language to "ca" in the app
48+
Then I should be able to press "Foo amb espais" in the app
49+
50+
When I change language to "en_us" in the app
51+
Then I should be able to press "Foo" in the app
52+
Then I should find "No content here" in the app

0 commit comments

Comments
 (0)