@@ -15,7 +15,6 @@ def test_case():
15
15
16
16
CHECK_SITE = "http://example"
17
17
SHORT_SITE = CHECK_SITE .split ("/" )[- 1 ]
18
-
19
18
ERROR_TITLES = ["Hmm. We’re having trouble finding that site." ]
20
19
21
20
@@ -30,12 +29,10 @@ def test_server_not_found_error(driver: Firefox, version: str):
30
29
tabs = TabBar (driver )
31
30
error_page = ErrorPage (driver )
32
31
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
36
33
nav .search (CHECK_SITE )
37
34
38
- # Verify the tab title
35
+ # Wait until the tab title updates to "Server Not Found"
39
36
WebDriverWait (driver , 30 ).until (
40
37
lambda d : tabs .get_tab_title (tabs .get_tab (1 )) == "Server Not Found"
41
38
)
@@ -47,30 +44,28 @@ def test_server_not_found_error(driver: Firefox, version: str):
47
44
in error_page .get_error_short_description ()
48
45
)
49
46
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
+ ]
61
54
62
55
expected_texts = [
63
56
"Try again later" ,
64
57
"Check your network connection" ,
65
- permission_message ,
66
58
]
67
59
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
70
62
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
74
69
75
70
# Verify that the suggested link redirects to the correct page
76
71
error_page .get_error_suggestion_link ().click ()
0 commit comments