Skip to content

Commit bf32cc3

Browse files
committed
/vs Add a test for checking the state of the update button from about:prefs
1 parent 2f13cf6 commit bf32cc3

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

modules/data/about_prefs.components.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,5 +256,15 @@
256256
"selectorData": "primaryBrowserLocale",
257257
"strategy": "id",
258258
"groups": []
259+
},
260+
"update_available_button": {
261+
"selectorData": "updateButton",
262+
"strategy": "id",
263+
"groups": []
264+
},
265+
"up_to_date_button": {
266+
"selectorData": "checkForUpdatesButton3",
267+
"strategy": "id",
268+
"groups": []
259269
}
260270
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import time
2+
3+
import pytest
4+
from selenium.webdriver import Firefox
5+
6+
from modules.browser_object import Navigation
7+
from modules.page_object_about_prefs import AboutPrefs
8+
9+
10+
@pytest.fixture()
11+
def set_prefs():
12+
"""Set prefs"""
13+
return [
14+
("app.update.disabledForTesting", False)
15+
]
16+
17+
18+
def test_check_for_updates(driver: Firefox):
19+
"""
20+
C143572 - The check for updates button is available and responsive
21+
The Button changes text to "Restart to update" if an update is available
22+
"""
23+
24+
Navigation(driver).open()
25+
about_prefs = AboutPrefs(driver, category="general").open()
26+
time.sleep(2)
27+
28+
# Find the 'updateButton' and 'checkForUpdatesButton3' elements
29+
update_available_button = about_prefs.get_element("update_available_button")
30+
up_to_date_button = about_prefs.get_element("up_to_date_button")
31+
time.sleep(2)
32+
33+
# Check the label of the buttons and assert they are correct
34+
if update_available_button.is_displayed():
35+
label = update_available_button.text
36+
assert label == "Restart to Update Firefox", f"Expected label to be 'Restart to Update Firefox' but got '{label}'"
37+
assert update_available_button.is_enabled(), "The 'Restart to Update Firefox' button is not clickable"
38+
elif up_to_date_button.is_displayed():
39+
label = up_to_date_button.text
40+
assert label == "Check for updates", f"Expected label to be 'Check for updates' but got '{label}'"
41+
assert up_to_date_button.is_enabled(), "The 'Check for updates' button is not clickable"

0 commit comments

Comments
 (0)