@@ -60,38 +60,33 @@ def test_pala001_layout(dash_duo, clear_pages_state):
6060 assert dash_duo .driver .title == page ["title" ], "check that page title updates"
6161
6262 # 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" )
6464 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" )
6666 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"
7168
7269 # test redirect with button and user defined dcc.Location
7370 # 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" )
7572 dash_duo .find_element ("#btn1" ).click ()
7673 dash_duo .wait_for_text_to_equal ("#text_page2" , "text for page2" )
7774
7875 # 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" )
8277 assert (
8378 dash_duo .find_element ("#velocity" ).get_attribute ("value" ) == "10"
8479 ), "query string passed to layout"
8580
8681 # 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" )
8883 dash_duo .wait_for_text_to_equal ("#path_vars" , "variables from pathname:none none" )
8984
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" )
9186 dash_duo .wait_for_text_to_equal ("#path_vars" , "variables from pathname:var1 var2" )
9287
9388 # 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" )
9590 dash_duo .wait_for_text_to_equal ("#text_not_found_404" , "text for not_found_404" )
9691
9792 # test `validation_layout` exists when suppress_callback_exceptions=False`
@@ -122,20 +117,20 @@ def test_pala002_meta_tags_default(dash_duo, clear_pages_state):
122117 {"property" : "twitter:card" , "content" : "summary_large_image" },
123118 {
124119 "property" : "twitter:url" ,
125- "content" : f"http://localhost: { dash_duo .server . port } /" ,
120+ "content" : f"{ dash_duo .server_url } /" ,
126121 },
127122 {"property" : "twitter:title" , "content" : "Multi layout2" },
128123 {"property" : "twitter:description" , "content" : "" },
129124 {
130125 "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" ,
132127 },
133128 {"property" : "og:title" , "content" : "Multi layout2" },
134129 {"property" : "og:type" , "content" : "website" },
135130 {"property" : "og:description" , "content" : "" },
136131 {
137132 "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" ,
139134 },
140135 ]
141136
@@ -150,7 +145,7 @@ def test_pala003_meta_tags_custom(dash_duo, clear_pages_state):
150145 {"property" : "twitter:card" , "content" : "summary_large_image" },
151146 {
152147 "property" : "twitter:url" ,
153- "content" : f"http://localhost: { dash_duo .server . port } /" ,
148+ "content" : f"{ dash_duo .server_url } /" ,
154149 },
155150 {"property" : "twitter:title" , "content" : "Supplied Title" },
156151 {
@@ -159,14 +154,14 @@ def test_pala003_meta_tags_custom(dash_duo, clear_pages_state):
159154 },
160155 {
161156 "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" ,
163158 },
164159 {"property" : "og:title" , "content" : "Supplied Title" },
165160 {"property" : "og:type" , "content" : "website" },
166161 {"property" : "og:description" , "content" : "This is the supplied description" },
167162 {
168163 "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" ,
170165 },
171166 ]
172167
@@ -224,19 +219,15 @@ def layout1(hash: str = None, language: str = "en", **kwargs):
224219
225220def test_pala005_routing_inputs (dash_duo , clear_pages_state ):
226221 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" )
228223 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 } /" )
230225 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" )
234227 dash_duo .wait_for_text_to_equal ("#contents" , "Hash says:" )
235228 # hash is a State therefore navigating to the same page with hash will not
236229 # 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" )
240231 dash_duo .wait_for_text_to_equal ("#contents" , "Hash says:" )
241232 # Refreshing the page re-runs the layout function
242233 dash_duo .driver .refresh ()
0 commit comments