1
- from time import sleep
2
1
3
2
from selenium .webdriver import Firefox
4
3
5
4
from modules .page_object import AboutPrefs
6
- from modules .util import BrowserActions , Utilities
5
+ from modules .util import BrowserActions
7
6
8
7
9
8
def test_language_pack_install_about_preferences (driver : Firefox ):
10
9
"""
11
10
C1549409: language packs can be installed from about:preferences and firefox is correctly localized
12
11
"""
12
+ # instantiate objects
13
13
about_prefs = AboutPrefs (driver , category = "general" ).open ()
14
14
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 ()
17
17
18
+ # press the alternatives button and find italian
18
19
iframe = about_prefs .get_element ("browser-popup" )
19
20
ba .switch_to_iframe_context (iframe )
20
21
about_prefs .get_element ("language-set-alternatives-popup-select-language" ).click ()
21
-
22
22
about_prefs .element_clickable (
23
23
"language-set-alternatives-popup-select-language-search-more"
24
24
)
25
-
26
25
more_languages_option = about_prefs .get_element (
27
26
"language-set-alternatives-popup-select-language-search-more"
28
27
)
29
-
30
28
about_prefs .double_click (more_languages_option )
31
- sleep (10 )
32
29
30
+ # waiting for the language install to be sucessful
33
31
about_prefs .custom_wait (timeout = 20 ).until (
34
32
lambda _ : about_prefs .get_element (
35
33
"language-set-alternatives-popup-select-language"
36
34
).get_attribute ("label" )
37
35
== "Select a language to add…"
38
36
)
39
37
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