1 |
efrain |
1 |
@javascript @theme_boost
|
|
|
2 |
Feature: Language selector menu
|
|
|
3 |
To be able to set the preferred language for the site
|
|
|
4 |
As a user
|
|
|
5 |
I need to be presented with a language selector menu
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given remote langimport tests are enabled
|
|
|
9 |
And the following "courses" exist:
|
|
|
10 |
| fullname | shortname |
|
|
|
11 |
| Course 1 | C1 |
|
|
|
12 |
And the following "users" exist:
|
|
|
13 |
| username | firstname | lastname | email |
|
|
|
14 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
15 |
And the following "course enrolments" exist:
|
|
|
16 |
| user | course | role |
|
|
|
17 |
| teacher1 | C1 | editingteacher |
|
|
|
18 |
And the following "language pack" exists:
|
|
|
19 |
| language | en_ar |
|
|
|
20 |
|
|
|
21 |
Scenario: Logged user is presented with a language selector which is placed within the user menu
|
|
|
22 |
Given I log in as "teacher1"
|
|
|
23 |
And I am on site homepage
|
|
|
24 |
# The language selector menu is not present in the navbar when a user is logged in.
|
|
|
25 |
And language selector menu should not exist in the navbar
|
|
|
26 |
# The language selector is present within the user menu.
|
|
|
27 |
And "Language" "link" should exist in the user menu
|
|
|
28 |
When I follow "Language" in the user menu
|
|
|
29 |
Then I should see "Language selector" user submenu
|
|
|
30 |
And "English ‎(en)‎" "link" should exist in the "Language selector" user submenu
|
|
|
31 |
And "English (pirate) ‎(en_ar)‎" "link" should exist in the "Language selector" user submenu
|
|
|
32 |
|
|
|
33 |
Scenario: Non-logged user is presented with a language selector which is placed within the navbar
|
|
|
34 |
Given I am on site homepage
|
|
|
35 |
# The language selector menu is present in the navbar when a user is not logged in.
|
|
|
36 |
And language selector menu should exist in the navbar
|
|
|
37 |
And "English ‎(en)‎" "link" should exist in the language selector menu
|
|
|
38 |
And "English (pirate) ‎(en_ar)‎" "link" should exist in the language selector menu
|
|
|
39 |
|
|
|
40 |
Scenario: Logged user is not presented with a language selector in a course if a language is forced in that context
|
|
|
41 |
Given I log in as "teacher1"
|
|
|
42 |
And I am on "Course 1" course homepage
|
|
|
43 |
And I navigate to "Settings" in current page administration
|
|
|
44 |
And I expand all fieldsets
|
|
|
45 |
And I set the following fields to these values:
|
|
|
46 |
| id_lang | en |
|
|
|
47 |
And I press "Save and display"
|
|
|
48 |
# The language selector is not present within the user menu in the course context when a language is enforced.
|
|
|
49 |
When I am on "Course 1" course homepage
|
|
|
50 |
And "Language" "link" should not exist in the user menu
|
|
|
51 |
# The language selector is present within the user menu in other contexts.
|
|
|
52 |
And I am on site homepage
|
|
|
53 |
And "Language" "link" should exist in the user menu
|
|
|
54 |
|
|
|
55 |
Scenario: Logged user is not presented with a language selector if there is less than two installed languages
|
|
|
56 |
Given I log in as "admin"
|
|
|
57 |
And I navigate to "Language > Language packs" in site administration
|
|
|
58 |
And I set the field "Installed language packs" to "en_ar"
|
|
|
59 |
And I press "Uninstall selected language pack(s)"
|
|
|
60 |
And I click on "Yes" "button" in the "Uninstall selected language pack(s)" "dialogue"
|
|
|
61 |
And the "Installed language packs" select box should not contain "en_ar"
|
|
|
62 |
When I am on site homepage
|
|
|
63 |
# The language selector is not present within the user menu.
|
|
|
64 |
And "Language" "link" should not exist in the user menu
|
|
|
65 |
|
|
|
66 |
Scenario: Non-logged user is not presented with a language selector if there is less than two installed languages
|
|
|
67 |
Given I log in as "admin"
|
|
|
68 |
And I navigate to "Language > Language packs" in site administration
|
|
|
69 |
And I set the field "Installed language packs" to "en_ar"
|
|
|
70 |
And I press "Uninstall selected language pack(s)"
|
|
|
71 |
And I click on "Yes" "button" in the "Uninstall selected language pack(s)" "dialogue"
|
|
|
72 |
And the "Installed language packs" select box should not contain "en_ar"
|
|
|
73 |
And I log out
|
|
|
74 |
When I am on site homepage
|
|
|
75 |
# The language selector menu is not present in the navbar.
|
|
|
76 |
Then language selector menu should not exist in the navbar
|