|
5 | 5 | from selenium.webdriver.common.keys import Keys
|
6 | 6 |
|
7 | 7 | from dash import Dash, html, dcc, Input, Output, State, ALL, Patch
|
| 8 | +from dash.testing.wait import until |
8 | 9 |
|
9 | 10 |
|
10 | 11 | @flaky.flaky(max_runs=3)
|
@@ -219,93 +220,93 @@ def get_output():
|
219 | 220 | _input.send_keys("Set Value")
|
220 | 221 | dash_duo.find_element("#set-btn").click()
|
221 | 222 |
|
222 |
| - assert get_output()["value"] == "Set Value" |
| 223 | + until(lambda: get_output()["value"] == "Set Value", 2) |
223 | 224 |
|
224 | 225 | _input = dash_duo.find_element("#append-value")
|
225 | 226 | _input.send_keys("Append")
|
226 | 227 | dash_duo.find_element("#append-btn").click()
|
227 | 228 |
|
228 |
| - assert get_output()["array"] == ["initial", "Append"] |
| 229 | + until(lambda: get_output()["array"] == ["initial", "Append"], 2) |
229 | 230 |
|
230 | 231 | _input = dash_duo.find_element("#prepend-value")
|
231 | 232 | _input.send_keys("Prepend")
|
232 | 233 | dash_duo.find_element("#prepend-btn").click()
|
233 | 234 |
|
234 |
| - assert get_output()["array"] == ["Prepend", "initial", "Append"] |
| 235 | + until(lambda: get_output()["array"] == ["Prepend", "initial", "Append"], 2) |
235 | 236 |
|
236 | 237 | _input = dash_duo.find_element("#extend-value")
|
237 | 238 | _input.send_keys("Extend")
|
238 | 239 | dash_duo.find_element("#extend-btn").click()
|
239 | 240 |
|
240 |
| - assert get_output()["array"] == ["Prepend", "initial", "Append", "Extend"] |
| 241 | + until(lambda: get_output()["array"] == ["Prepend", "initial", "Append", "Extend"], 2) |
241 | 242 |
|
242 | 243 | undef = object()
|
243 |
| - assert get_output().get("merge", undef) is undef |
| 244 | + until(lambda: get_output().get("merge", undef) is undef, 2) |
244 | 245 |
|
245 | 246 | _input = dash_duo.find_element("#merge-value")
|
246 | 247 | _input.send_keys("Merged")
|
247 | 248 | dash_duo.find_element("#merge-btn").click()
|
248 | 249 |
|
249 |
| - assert get_output()["merged"] == "Merged" |
| 250 | + until(lambda: get_output()["merged"] == "Merged", 2) |
250 | 251 |
|
251 |
| - assert get_output()["delete"] == "Delete me" |
| 252 | + until(lambda: get_output()["delete"] == "Delete me", 2) |
252 | 253 |
|
253 | 254 | dash_duo.find_element("#delete-btn").click()
|
254 | 255 |
|
255 |
| - assert get_output().get("delete", undef) is undef |
| 256 | + until(lambda: get_output().get("delete", undef) is undef, 2) |
256 | 257 |
|
257 | 258 | _input = dash_duo.find_element("#insert-value")
|
258 | 259 | _input.send_keys("Inserted")
|
259 | 260 | dash_duo.find_element("#insert-btn").click()
|
260 | 261 |
|
261 |
| - assert get_output().get("array") == [ |
| 262 | + until(lambda: get_output().get("array") == [ |
262 | 263 | "Prepend",
|
263 | 264 | "Inserted",
|
264 | 265 | "initial",
|
265 | 266 | "Append",
|
266 | 267 | "Extend",
|
267 |
| - ] |
| 268 | + ], 2) |
268 | 269 |
|
269 | 270 | _input.send_keys(" with negative index")
|
270 | 271 | _input = dash_duo.find_element("#insert-index")
|
271 | 272 | _input.send_keys(Keys.BACKSPACE)
|
272 | 273 | _input.send_keys("-1")
|
273 | 274 | dash_duo.find_element("#insert-btn").click()
|
274 | 275 |
|
275 |
| - assert get_output().get("array") == [ |
| 276 | + until(lambda: get_output().get("array") == [ |
276 | 277 | "Prepend",
|
277 | 278 | "Inserted",
|
278 | 279 | "initial",
|
279 | 280 | "Append",
|
280 | 281 | "Inserted with negative index",
|
281 | 282 | "Extend",
|
282 |
| - ] |
| 283 | + ], 2) |
283 | 284 |
|
284 | 285 | dash_duo.find_element("#delete-index").click()
|
285 |
| - assert get_output().get("array") == [ |
| 286 | + until(lambda: get_output().get("array") == [ |
286 | 287 | "Prepend",
|
287 | 288 | "initial",
|
288 | 289 | "Append",
|
289 | 290 | "Extend",
|
290 |
| - ] |
| 291 | + ], 2) |
291 | 292 |
|
292 | 293 | dash_duo.find_element("#reverse-btn").click()
|
293 |
| - assert get_output().get("array") == [ |
| 294 | + until(lambda: get_output().get("array") == [ |
294 | 295 | "Extend",
|
295 | 296 | "Append",
|
296 | 297 | "initial",
|
297 | 298 | "Prepend",
|
298 |
| - ] |
| 299 | + ], 2) |
299 | 300 |
|
300 | 301 | dash_duo.find_element("#remove-btn").click()
|
301 |
| - assert get_output().get("array") == [ |
| 302 | + until(lambda: get_output().get("array") == [ |
302 | 303 | "Extend",
|
303 | 304 | "Append",
|
304 | 305 | "Prepend",
|
305 |
| - ] |
| 306 | + ], 2) |
306 | 307 |
|
307 | 308 | dash_duo.find_element("#clear-btn").click()
|
308 |
| - assert get_output()["array"] == [] |
| 309 | + until(lambda: get_output()["array"] == [], 2) |
309 | 310 |
|
310 | 311 |
|
311 | 312 | def test_pch002_patch_app_pmc_callbacks(dash_duo):
|
|
0 commit comments