Skip to content

Commit 652ead0

Browse files
authored
Merge pull request #522 from mozilla/as/dev-ed-server-not-found
Anca/ Dev Edition - server not found test stabilization
2 parents 1b2c87d + 80e2663 commit 652ead0

File tree

1 file changed

+17
-22
lines changed

1 file changed

+17
-22
lines changed

tests/address_bar_and_search/test_server_not_found_error.py

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ def test_case():
1515

1616
CHECK_SITE = "http://example"
1717
SHORT_SITE = CHECK_SITE.split("/")[-1]
18-
1918
ERROR_TITLES = ["Hmm. We’re having trouble finding that site."]
2019

2120

@@ -30,12 +29,10 @@ def test_server_not_found_error(driver: Firefox, version: str):
3029
tabs = TabBar(driver)
3130
error_page = ErrorPage(driver)
3231

33-
# Auto-detect if this is a Nightly build by checking the version string
34-
is_nightly = any(identifier in version.lower() for identifier in ["a1", "nightly"])
35-
32+
# Navigate to the desired site
3633
nav.search(CHECK_SITE)
3734

38-
# Verify the tab title
35+
# Wait until the tab title updates to "Server Not Found"
3936
WebDriverWait(driver, 30).until(
4037
lambda d: tabs.get_tab_title(tabs.get_tab(1)) == "Server Not Found"
4138
)
@@ -47,30 +44,28 @@ def test_server_not_found_error(driver: Firefox, version: str):
4744
in error_page.get_error_short_description()
4845
)
4946

50-
# Set the permission text based on what version is actually running
51-
if is_nightly:
52-
permission_message = (
53-
"Check that Nightly has permission to access the web (you might be connected but behind "
54-
"a firewall)"
55-
)
56-
else:
57-
permission_message = (
58-
"Check that Firefox has permission to access the web (you might be connected but behind "
59-
"a firewall)"
60-
)
47+
# Define all possible valid permission messages (exact matches) for different Firefox channels
48+
possible_permission_messages = [
49+
"Check that Firefox has permission to access the web (you might be connected but behind a firewall)",
50+
"Check that Firefox Developer Edition has permission to access the web (you might be connected but behind a "
51+
"firewall)",
52+
"Check that Nightly has permission to access the web (you might be connected but behind a firewall)",
53+
]
6154

6255
expected_texts = [
6356
"Try again later",
6457
"Check your network connection",
65-
permission_message,
6658
]
6759

68-
for i, item in enumerate(error_page.get_error_long_description_items()):
69-
assert item.text == expected_texts[i]
60+
items = error_page.get_error_long_description_items()
61+
assert len(items) >= 3
7062

71-
WebDriverWait(driver, 30).until(
72-
lambda d: error_page.get_try_again_button().is_displayed()
73-
)
63+
# Verify that the first two bullet items exactly match the expected texts
64+
for i in range(2):
65+
assert items[i].text == expected_texts[i]
66+
67+
# Verify that the third bullet item exactly matches one of the valid permission messages
68+
assert items[2].text in possible_permission_messages
7469

7570
# Verify that the suggested link redirects to the correct page
7671
error_page.get_error_suggestion_link().click()

0 commit comments

Comments
 (0)