Skip to content

Commit fbb62bd

Browse files
Merge pull request #146 from mozilla/vs/test_check_for_updates
vs/ Test for checking the state of the update button from abou:prefs
2 parents fa0aab0 + 1d6ea49 commit fbb62bd

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed

modules/data/about_prefs.components.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,18 @@
353353
"groups": []
354354
},
355355

356+
"update_available_button": {
357+
"selectorData": "updateButton",
358+
"strategy": "id",
359+
"groups": []
360+
},
361+
362+
"up_to_date_button": {
363+
"selectorData": "checkForUpdatesButton3",
364+
"strategy": "id",
365+
"groups": []
366+
},
367+
356368
"cookies-privacy-label": {
357369
"selectorData": "description[data-l10n-id='sitedata-delete-on-close-private-browsing2']",
358370
"strategy": "css",
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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 [("app.update.disabledForTesting", False)]
14+
15+
16+
def test_check_for_updates(driver: Firefox):
17+
"""
18+
C143572 - The check for updates button is available and responsive
19+
The Button changes text to "Restart to update" if an update is available
20+
"""
21+
22+
Navigation(driver).open()
23+
about_prefs = AboutPrefs(driver, category="general").open()
24+
time.sleep(2)
25+
26+
# Find the 'updateButton' and 'checkForUpdatesButton3' elements
27+
update_available_button = about_prefs.get_element("update_available_button")
28+
up_to_date_button = about_prefs.get_element("up_to_date_button")
29+
time.sleep(2)
30+
31+
# Check the label of the buttons and assert they are correct
32+
if update_available_button.is_displayed():
33+
label = update_available_button.text
34+
assert (
35+
label == "Restart to Update Firefox"
36+
), f"Expected label to be 'Restart to Update Firefox' but got '{label}'"
37+
assert (
38+
update_available_button.is_enabled()
39+
), "The 'Restart to Update Firefox' button is not clickable"
40+
elif up_to_date_button.is_displayed():
41+
label = up_to_date_button.text
42+
assert (
43+
label == "Check for updates"
44+
), f"Expected label to be 'Check for updates' but got '{label}'"
45+
assert (
46+
up_to_date_button.is_enabled()
47+
), "The 'Check for updates' button is not clickable"

0 commit comments

Comments
 (0)