@@ -15,35 +15,25 @@ def add_prefs():
15
15
]
16
16
17
17
18
- @pytest .mark .parametrize (
19
- "url, site_name, suggestion_url" ,
20
- [
21
- ("http://cnn" , "cnn" , "https://www.cnn.com/" ),
22
- ("http://example" , "example" , "https://www.example.com/" ),
23
- ],
24
- )
25
- def test_server_not_found_error (driver : Firefox , url , site_name , suggestion_url ):
18
+ def test_server_not_found_error (driver : Firefox ):
26
19
"""
27
20
C1901393: - This tests that when a user navigates to a non-existent site, a "Server Not Found" error is
28
21
displayed. The error page contains the correct elements, and the suggested link redirects to the appropriate page.
29
-
30
22
"""
31
23
32
24
# Create objects
33
25
nav = Navigation (driver ).open ()
34
26
tabs = TabBar (driver )
35
27
error_page = ErrorPage (driver )
36
28
37
- nav .search (url )
29
+ nav .search ("http://cnn" )
38
30
39
31
# Verify the tab title
40
-
41
32
WebDriverWait (driver , 30 ).until (
42
33
lambda d : tabs .get_tab_title (tabs .get_tab (1 )) == "Server Not Found"
43
34
)
44
35
45
36
# Verify elements on the error page
46
-
47
37
error_title = error_page .get_error_title ()
48
38
assert (
49
39
error_title == "Hmm. We’re having trouble finding that site."
@@ -52,7 +42,7 @@ def test_server_not_found_error(driver: Firefox, url, site_name, suggestion_url)
52
42
error_short_description = error_page .get_error_short_description ()
53
43
assert (
54
44
error_short_description
55
- == f "We can’t connect to the server at { site_name } . Did you mean to go to www.{ site_name } .com?"
45
+ == "We can’t connect to the server at cnn . Did you mean to go to www.cnn .com?"
56
46
), (
57
47
f"Expected error short description text not found."
58
48
f"Actual: { error_short_description } "
@@ -74,6 +64,5 @@ def test_server_not_found_error(driver: Firefox, url, site_name, suggestion_url)
74
64
assert try_again_button .is_displayed (), "The 'Try Again' button is not displayed"
75
65
76
66
# Verify that the suggested link redirects to the correct page
77
-
78
67
error_page .get_error_suggestion_link ().click ()
79
- nav .expect_in_content (EC .url_contains (suggestion_url ))
68
+ nav .expect_in_content (EC .url_contains ("https://www.cnn.com/" ))
0 commit comments