1- import pytest
21from typing import Literal
32
3+ import pytest
44from selenium .webdriver import Firefox
55
66from modules .browser_object import ReaderView
@@ -25,8 +25,16 @@ def test_case() -> str:
2525SliderDirection = Literal ["decrease" , "increase" ]
2626
2727SIZE_CONTROLS : list [SizeControl ] = ["minus" , "plus" ]
28- FONTS : list [Literal ["sans-serif" , "serif" , "monospace" ]] = ["sans-serif" , "serif" , "monospace" ]
29- ALIGNMENTS : list [tuple [AlignKey , AlignCSS ]] = [("left" , "start" ), ("right" , "right" ), ("center" , "center" )]
28+ FONTS : list [Literal ["sans-serif" , "serif" , "monospace" ]] = [
29+ "sans-serif" ,
30+ "serif" ,
31+ "monospace" ,
32+ ]
33+ ALIGNMENTS : list [tuple [AlignKey , AlignCSS ]] = [
34+ ("left" , "start" ),
35+ ("right" , "right" ),
36+ ("center" , "center" ),
37+ ]
3038SLIDER_DIRS : list [SliderDirection ] = ["decrease" , "increase" ]
3139
3240
@@ -49,7 +57,9 @@ def _css_int(util: Utilities, element, prop: str) -> int:
4957
5058@pytest .mark .ci
5159@pytest .mark .parametrize ("font" , FONTS )
52- def test_type_control_panel_font (driver : Firefox , font : Literal ["sans-serif" , "serif" , "monospace" ]) -> None :
60+ def test_type_control_panel_font (
61+ driver : Firefox , font : Literal ["sans-serif" , "serif" , "monospace" ]
62+ ) -> None :
5363 """
5464 C130919.1: Ensure the functionality of the type control panels works (font family).
5565 """
@@ -61,10 +71,14 @@ def test_type_control_panel_font(driver: Firefox, font: Literal["sans-serif", "s
6171 body = web_page .get_element ("page-body" )
6272
6373 # Ensure default is sans-serif first so the next wait has a stable baseline
64- reader_view .wait .until (lambda _ : "sans-serif" in body .value_of_css_property ("font-family" ))
74+ reader_view .wait .until (
75+ lambda _ : "sans-serif" in body .value_of_css_property ("font-family" )
76+ )
6577
6678 font_dropdown_root = reader_view .get_element ("toolbar-font-selector" )
67- font_dropdown = Dropdown (page = reader_view , require_shadow = False , root = font_dropdown_root )
79+ font_dropdown = Dropdown (
80+ page = reader_view , require_shadow = False , root = font_dropdown_root
81+ )
6882 font_dropdown .select_option (
6983 f"about-reader-font-type-{ font } " ,
7084 option_tag = "option" ,
@@ -91,16 +105,20 @@ def test_type_control_panel_size(driver: Firefox, control: SizeControl) -> None:
91105 reader_view .get_element (f"toolbar-textsize-{ control } " ).click ()
92106
93107 if control == "minus" :
94- reader_view .wait .until (lambda _ : _css_int (util , body , "--font-size" ) < size_before )
108+ reader_view .wait .until (
109+ lambda _ : _css_int (util , body , "--font-size" ) < size_before
110+ )
95111 else :
96- reader_view .wait .until (lambda _ : _css_int (util , body , "--font-size" ) > size_before )
112+ reader_view .wait .until (
113+ lambda _ : _css_int (util , body , "--font-size" ) > size_before
114+ )
97115
98116
99117@pytest .mark .parametrize ("alignment,intended_alignment" , ALIGNMENTS )
100118def test_type_control_panel_text_alignment (
101- driver : Firefox ,
102- alignment : AlignKey ,
103- intended_alignment : AlignCSS ,
119+ driver : Firefox ,
120+ alignment : AlignKey ,
121+ intended_alignment : AlignCSS ,
104122) -> None :
105123 """
106124 C130919.3: Ensure the functionality of the type control panels works (text alignment).
@@ -114,11 +132,16 @@ def test_type_control_panel_text_alignment(
114132 reader_view .open_advanced_options ()
115133
116134 reader_view .get_element (f"toolbar-text-align-{ alignment } " ).click ()
117- reader_view .wait .until (lambda _ : container .value_of_css_property ("--text-alignment" ) == intended_alignment )
135+ reader_view .wait .until (
136+ lambda _ : container .value_of_css_property ("--text-alignment" )
137+ == intended_alignment
138+ )
118139
119140
120141@pytest .mark .parametrize ("direction" , SLIDER_DIRS )
121- def test_type_control_panel_content_width (driver : Firefox , direction : SliderDirection ) -> None :
142+ def test_type_control_panel_content_width (
143+ driver : Firefox , direction : SliderDirection
144+ ) -> None :
122145 """
123146 C130919.4: Ensure the functionality of the type control panels works (content width slider).
124147 """
@@ -137,13 +160,19 @@ def test_type_control_panel_content_width(driver: Firefox, direction: SliderDire
137160 reader_view .change_slider_value (slider , increase = (direction == "increase" ))
138161
139162 if direction == "decrease" :
140- reader_view .wait .until (lambda _ : _css_int (util , body , "--content-width" ) < width_before )
163+ reader_view .wait .until (
164+ lambda _ : _css_int (util , body , "--content-width" ) < width_before
165+ )
141166 else :
142- reader_view .wait .until (lambda _ : _css_int (util , body , "--content-width" ) > width_before )
167+ reader_view .wait .until (
168+ lambda _ : _css_int (util , body , "--content-width" ) > width_before
169+ )
143170
144171
145172@pytest .mark .parametrize ("direction" , SLIDER_DIRS )
146- def test_type_control_panel_line_spacing (driver : Firefox , direction : SliderDirection ) -> None :
173+ def test_type_control_panel_line_spacing (
174+ driver : Firefox , direction : SliderDirection
175+ ) -> None :
147176 """
148177 C130919.5: Ensure the functionality of the type control panels works (line spacing slider).
149178 """
@@ -162,9 +191,13 @@ def test_type_control_panel_line_spacing(driver: Firefox, direction: SliderDirec
162191 reader_view .change_slider_value (slider , increase = (direction == "increase" ))
163192
164193 if direction == "decrease" :
165- reader_view .wait .until (lambda _ : _css_int (util , body , "block-size" ) < block_before )
194+ reader_view .wait .until (
195+ lambda _ : _css_int (util , body , "block-size" ) < block_before
196+ )
166197 else :
167- reader_view .wait .until (lambda _ : _css_int (util , body , "block-size" ) > block_before )
198+ reader_view .wait .until (
199+ lambda _ : _css_int (util , body , "block-size" ) > block_before
200+ )
168201
169202
170203def test_type_control_panel_character_spacing (driver : Firefox ) -> None :
@@ -186,7 +219,9 @@ def test_type_control_panel_character_spacing(driver: Firefox) -> None:
186219
187220 reader_view .change_slider_value (slider , increase = True )
188221
189- reader_view .wait .until (lambda _ : _css_int (util , container , "--letter-spacing" ) > letter_before )
222+ reader_view .wait .until (
223+ lambda _ : _css_int (util , container , "--letter-spacing" ) > letter_before
224+ )
190225
191226
192227def test_type_control_panel_word_spacing (driver : Firefox ) -> None :
@@ -208,4 +243,6 @@ def test_type_control_panel_word_spacing(driver: Firefox) -> None:
208243
209244 reader_view .change_slider_value (slider , increase = True )
210245
211- reader_view .wait .until (lambda _ : _css_int (util , container , "--word-spacing" ) > word_before )
246+ reader_view .wait .until (
247+ lambda _ : _css_int (util , container , "--word-spacing" ) > word_before
248+ )
0 commit comments