Skip to content

Commit 7f8c01f

Browse files
authored
Bump timeouts for new WebView tests from #3973 (#4033)
1 parent 761ff85 commit 7f8c01f

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

changes/4033.misc.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Some WebView intermittent failures in testbed from the WebView navigation handler PR has been fixed.

testbed/tests/widgets/test_webview.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -389,18 +389,20 @@ async def test_retrieve_cookies(widget, probe, on_load):
389389
assert cookie.expires is None
390390

391391

392+
@pytest.mark.flaky(retries=5, delay=1)
392393
async def test_on_navigation_starting_sync_no_handler(widget, probe, on_load):
393394
# This test is required for full coverage because on android, setting
394395
# the URL does not trigger shouldOverrideUrlLoading()
395396
await widget.evaluate_javascript('window.location.assign("https://beeware.org/")')
396-
await asyncio.sleep(2)
397+
await asyncio.sleep(5)
397398
await widget.evaluate_javascript(
398399
'window.location.assign("https://beeware.org/docs/")'
399400
)
400-
await asyncio.sleep(2)
401+
await asyncio.sleep(5)
401402
assert widget.url == "https://beeware.org/docs/"
402403

403404

405+
@pytest.mark.flaky(retries=5, delay=1)
404406
async def test_on_navigation_starting_sync(widget, probe, on_load):
405407
if not getattr(widget._impl, "SUPPORTS_ON_NAVIGATION_STARTING", True):
406408
pytest.skip("Platform doesn't support on_navigation_starting")
@@ -441,17 +443,18 @@ def handler(widget, url, **kwargs):
441443
await widget.evaluate_javascript(
442444
'window.location.assign("https://github.com/beeware/toga/")'
443445
)
444-
await probe.redraw("Attempt to navigate to forbidden URL", delay=1)
446+
await probe.redraw("Attempt to navigate to forbidden URL", delay=5)
445447

446448
assert widget.url == "https://github.com/beeware/"
447449
# simulate browser navigation to allowed url
448450
await widget.evaluate_javascript(
449451
'window.location.assign("https://beeware.org/docs/")'
450452
)
451-
await probe.redraw("Attempt to navigate to allowed URL", delay=1)
453+
await probe.redraw("Attempt to navigate to allowed URL", delay=5)
452454
assert widget.url == "https://beeware.org/docs/"
453455

454456

457+
@pytest.mark.flaky(retries=5, delay=1)
455458
async def test_on_navigation_starting_async(widget, probe, on_load):
456459
if not getattr(widget._impl, "SUPPORTS_ON_NAVIGATION_STARTING", True):
457460
pytest.skip("Platform doesn't support on_navigation_starting")
@@ -492,12 +495,12 @@ async def handler(widget, url, **kwargs):
492495
await widget.evaluate_javascript(
493496
'window.location.assign("https://github.com/beeware/toga/")'
494497
)
495-
await probe.redraw("Attempt to navigate to denied URL", delay=1)
498+
await probe.redraw("Attempt to navigate to denied URL", delay=5)
496499
assert widget.url == "https://github.com/beeware/"
497500

498501
# simulate browser navigation to allowed url
499502
await widget.evaluate_javascript(
500503
'window.location.assign("https://beeware.org/docs/")'
501504
)
502-
await probe.redraw("Attempt to navigate to allowed URL", delay=1)
505+
await probe.redraw("Attempt to navigate to allowed URL", delay=5)
503506
assert widget.url == "https://beeware.org/docs/"

0 commit comments

Comments
 (0)