Skip to content

Commit 6e7be9c

Browse files
committed
finish test
1 parent c2beebc commit 6e7be9c

File tree

2 files changed

+58
-14
lines changed

2 files changed

+58
-14
lines changed

modules/data/about_prefs.components.json

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
},
7979

8080
"prefs-button": {
81-
"selectorData": "button[label=\"{name}\"]",
81+
"selectorData": "button[label='{name}']",
8282
"strategy": "css",
8383
"groups": []
8484
},
@@ -168,11 +168,48 @@
168168
},
169169

170170
"language-set-alternatives-popup-select-language-search-more": {
171-
"selectorData": "menuitem[label=\"Search for more languages…\"]",
171+
"selectorData": "menuitem[label='Search for more languages…']",
172172
"strategy": "css",
173173
"groups": []
174174
},
175175

176+
"language-set-alternatives-popup-select-language-italian": {
177+
"selectorData": "menuitem[label='Italiano']",
178+
"strategy": "css",
179+
"groups": []
180+
},
181+
182+
"languages-shadow-root": {
183+
"selectorData": "dialog[buttons='accept,cancel,help']",
184+
"strategy": "css",
185+
"groups": []
186+
},
187+
188+
"language-accept-button": {
189+
"selectorData": "button[dlgtype='accept']",
190+
"strategy": "css",
191+
"shadowParent": "languages-shadow-root",
192+
"groups": []
193+
},
194+
195+
"language-add-button": {
196+
"selectorData": "add",
197+
"strategy": "id",
198+
"groups": []
199+
},
200+
201+
"language-list-item": {
202+
"selectorData": "locale-it",
203+
"strategy": "id",
204+
"groups": []
205+
},
206+
207+
"html-root": {
208+
"selectorData": "preferences-root",
209+
"strategy": "id",
210+
"groups": []
211+
},
212+
176213
"home-new-tabs-dropdown": {
177214
"selectorData": "newTabMode",
178215
"strategy": "id",
Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,50 @@
1-
from time import sleep
21

32
from selenium.webdriver import Firefox
43

54
from modules.page_object import AboutPrefs
6-
from modules.util import BrowserActions, Utilities
5+
from modules.util import BrowserActions
76

87

98
def test_language_pack_install_about_preferences(driver: Firefox):
109
"""
1110
C1549409: language packs can be installed from about:preferences and firefox is correctly localized
1211
"""
12+
# instantiate objects
1313
about_prefs = AboutPrefs(driver, category="general").open()
1414
ba = BrowserActions(driver)
15-
util = Utilities()
16-
about_prefs.get_element("language-set-alternatives-button").click()
15+
alternative_button = about_prefs.get_element("language-set-alternatives-button")
16+
alternative_button.click()
1717

18+
# press the alternatives button and find italian
1819
iframe = about_prefs.get_element("browser-popup")
1920
ba.switch_to_iframe_context(iframe)
2021
about_prefs.get_element("language-set-alternatives-popup-select-language").click()
21-
2222
about_prefs.element_clickable(
2323
"language-set-alternatives-popup-select-language-search-more"
2424
)
25-
2625
more_languages_option = about_prefs.get_element(
2726
"language-set-alternatives-popup-select-language-search-more"
2827
)
29-
3028
about_prefs.double_click(more_languages_option)
31-
sleep(10)
3229

30+
# waiting for the language install to be sucessful
3331
about_prefs.custom_wait(timeout=20).until(
3432
lambda _: about_prefs.get_element(
3533
"language-set-alternatives-popup-select-language"
3634
).get_attribute("label")
3735
== "Select a language to add…"
3836
)
3937

40-
about_prefs.get_element("language-set-alternatives-popup-select-language").click()
41-
42-
util.write_html_content("contents", driver, False)
43-
util.write_html_content("contentschrome", driver, True)
38+
# activate the italian language
39+
dropdown_selection = about_prefs.get_element("language-set-alternatives-popup-select-language")
40+
dropdown_selection.click()
41+
about_prefs.get_element("language-set-alternatives-popup-select-language-italian").click()
42+
dropdown_selection.click()
43+
about_prefs.get_element("language-add-button").click()
44+
about_prefs.get_element("language-list-item").click()
45+
about_prefs.get_element("language-accept-button").click()
46+
47+
# final asserts to ensure language is set
48+
ba.switch_to_content_context()
49+
assert about_prefs.get_element("html-root").get_attribute("lang") == "it"
50+
assert alternative_button.get_attribute("label") == "Imposta alternative…"

0 commit comments

Comments
 (0)