@@ -60,38 +60,33 @@ def test_pala001_layout(dash_duo, clear_pages_state):
60
60
assert dash_duo .driver .title == page ["title" ], "check that page title updates"
61
61
62
62
# test redirects
63
- dash_duo .wait_for_page (url = f"http://localhost: { dash_duo .server . port } /v2" )
63
+ dash_duo .wait_for_page (url = f"{ dash_duo .server_url } /v2" )
64
64
dash_duo .wait_for_text_to_equal ("#text_redirect" , "text for redirect" )
65
- dash_duo .wait_for_page (url = f"http://localhost: { dash_duo .server . port } /old-home-page" )
65
+ dash_duo .wait_for_page (url = f"{ dash_duo .server_url } /old-home-page" )
66
66
dash_duo .wait_for_text_to_equal ("#text_redirect" , "text for redirect" )
67
- assert (
68
- dash_duo .driver .current_url
69
- == f"http://localhost:{ dash_duo .server .port } /redirect"
70
- )
67
+ assert dash_duo .driver .current_url == f"{ dash_duo .server_url } /redirect"
71
68
72
69
# test redirect with button and user defined dcc.Location
73
70
# note: dcc.Location must be defined in app.py
74
- dash_duo .wait_for_page (url = f"http://localhost: { dash_duo .server . port } /page1" )
71
+ dash_duo .wait_for_page (url = f"{ dash_duo .server_url } /page1" )
75
72
dash_duo .find_element ("#btn1" ).click ()
76
73
dash_duo .wait_for_text_to_equal ("#text_page2" , "text for page2" )
77
74
78
75
# test query strings
79
- dash_duo .wait_for_page (
80
- url = f"http://localhost:{ dash_duo .server .port } /query-string?velocity=10"
81
- )
76
+ dash_duo .wait_for_page (url = f"{ dash_duo .server_url } /query-string?velocity=10" )
82
77
assert (
83
78
dash_duo .find_element ("#velocity" ).get_attribute ("value" ) == "10"
84
79
), "query string passed to layout"
85
80
86
81
# test path variables
87
- dash_duo .wait_for_page (url = f"http://localhost: { dash_duo .server . port } /a/none/b/none" )
82
+ dash_duo .wait_for_page (url = f"{ dash_duo .server_url } /a/none/b/none" )
88
83
dash_duo .wait_for_text_to_equal ("#path_vars" , "variables from pathname:none none" )
89
84
90
- dash_duo .wait_for_page (url = f"http://localhost: { dash_duo .server . port } /a/var1/b/var2" )
85
+ dash_duo .wait_for_page (url = f"{ dash_duo .server_url } /a/var1/b/var2" )
91
86
dash_duo .wait_for_text_to_equal ("#path_vars" , "variables from pathname:var1 var2" )
92
87
93
88
# test page not found
94
- dash_duo .wait_for_page (url = f"http://localhost: { dash_duo .server . port } /find_me" )
89
+ dash_duo .wait_for_page (url = f"{ dash_duo .server_url } /find_me" )
95
90
dash_duo .wait_for_text_to_equal ("#text_not_found_404" , "text for not_found_404" )
96
91
97
92
# test `validation_layout` exists when suppress_callback_exceptions=False`
@@ -122,20 +117,20 @@ def test_pala002_meta_tags_default(dash_duo, clear_pages_state):
122
117
{"property" : "twitter:card" , "content" : "summary_large_image" },
123
118
{
124
119
"property" : "twitter:url" ,
125
- "content" : f"http://localhost: { dash_duo .server . port } /" ,
120
+ "content" : f"{ dash_duo .server_url } /" ,
126
121
},
127
122
{"property" : "twitter:title" , "content" : "Multi layout2" },
128
123
{"property" : "twitter:description" , "content" : "" },
129
124
{
130
125
"property" : "twitter:image" ,
131
- "content" : f"http://localhost: { dash_duo .server . port } /assets/app.jpeg" ,
126
+ "content" : f"{ dash_duo .server_url } /assets/app.jpeg" ,
132
127
},
133
128
{"property" : "og:title" , "content" : "Multi layout2" },
134
129
{"property" : "og:type" , "content" : "website" },
135
130
{"property" : "og:description" , "content" : "" },
136
131
{
137
132
"property" : "og:image" ,
138
- "content" : f"http://localhost: { dash_duo .server . port } /assets/app.jpeg" ,
133
+ "content" : f"{ dash_duo .server_url } /assets/app.jpeg" ,
139
134
},
140
135
]
141
136
@@ -150,7 +145,7 @@ def test_pala003_meta_tags_custom(dash_duo, clear_pages_state):
150
145
{"property" : "twitter:card" , "content" : "summary_large_image" },
151
146
{
152
147
"property" : "twitter:url" ,
153
- "content" : f"http://localhost: { dash_duo .server . port } /" ,
148
+ "content" : f"{ dash_duo .server_url } /" ,
154
149
},
155
150
{"property" : "twitter:title" , "content" : "Supplied Title" },
156
151
{
@@ -159,14 +154,14 @@ def test_pala003_meta_tags_custom(dash_duo, clear_pages_state):
159
154
},
160
155
{
161
156
"property" : "twitter:image" ,
162
- "content" : f"http://localhost: { dash_duo .server . port } /assets/birds.jpeg" ,
157
+ "content" : f"{ dash_duo .server_url } /assets/birds.jpeg" ,
163
158
},
164
159
{"property" : "og:title" , "content" : "Supplied Title" },
165
160
{"property" : "og:type" , "content" : "website" },
166
161
{"property" : "og:description" , "content" : "This is the supplied description" },
167
162
{
168
163
"property" : "og:image" ,
169
- "content" : f"http://localhost: { dash_duo .server . port } /assets/birds.jpeg" ,
164
+ "content" : f"{ dash_duo .server_url } /assets/birds.jpeg" ,
170
165
},
171
166
]
172
167
@@ -224,19 +219,15 @@ def layout1(hash: str = None, language: str = "en", **kwargs):
224
219
225
220
def test_pala005_routing_inputs (dash_duo , clear_pages_state ):
226
221
dash_duo .start_server (get_routing_inputs_app ())
227
- dash_duo .wait_for_page (url = f"http://localhost: { dash_duo .server . port } #123" )
222
+ dash_duo .wait_for_page (url = f"{ dash_duo .server_url } #123" )
228
223
dash_duo .wait_for_text_to_equal ("#contents" , "Home" )
229
- dash_duo .wait_for_page (url = f"http://localhost: { dash_duo .server . port } /" )
224
+ dash_duo .wait_for_page (url = f"{ dash_duo .server_url } /" )
230
225
dash_duo .wait_for_text_to_equal ("#contents" , "Home" )
231
- dash_duo .wait_for_page (
232
- url = f"http://localhost:{ dash_duo .server .port } /function-layout"
233
- )
226
+ dash_duo .wait_for_page (url = f"{ dash_duo .server_url } /function-layout" )
234
227
dash_duo .wait_for_text_to_equal ("#contents" , "Hash says:" )
235
228
# hash is a State therefore navigating to the same page with hash will not
236
229
# re-render the layout function
237
- dash_duo .wait_for_page (
238
- url = f"http://localhost:{ dash_duo .server .port } /function-layout#123"
239
- )
230
+ dash_duo .wait_for_page (url = f"{ dash_duo .server_url } /function-layout#123" )
240
231
dash_duo .wait_for_text_to_equal ("#contents" , "Hash says:" )
241
232
# Refreshing the page re-runs the layout function
242
233
dash_duo .driver .refresh ()
0 commit comments