|
| 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