Skip to content

Commit

Permalink
💚 Try to make flaky test(s) more resilient
Browse files Browse the repository at this point in the history
  • Loading branch information
sergei-maertens committed May 9, 2024
1 parent 94b25aa commit b716b46
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions testapp/templates/show-cookie-bar-script.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
},
onDecline: () => document.querySelector('body').classList.remove('with-cookie-bar'),
});

document.getElementById('loading-marker').style.display = 'inline';
</script>

<template id="show-share-button">
Expand Down
2 changes: 2 additions & 0 deletions testapp/templates/test_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
<body>
<h1>Test page</h1>

<span id="loading-marker" style="display:none">page-done-loading</span>

<h2>Social cookies</h2>
<p>
sharing button is displayed below only if "Social" cookies are accepted.
Expand Down
4 changes: 4 additions & 0 deletions tests/test_javascript_cookiebar.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
def before_each_after_each(live_server, page: Page, load_testapp_fixture):
test_page_url = f"{live_server.url}{reverse('test_page')}"
page.goto(test_page_url)
marker = page.get_by_text("page-done-loading")
expect(marker).to_be_visible()
yield


Expand Down Expand Up @@ -72,6 +74,8 @@ def test_on_accept_handler_runs_on_load(page: Page, live_server):

test_page_url = f"{live_server.url}{reverse('test_page')}"
page.goto(test_page_url)
marker = page.get_by_text("page-done-loading")
expect(marker).to_be_visible()

share_button = page.get_by_role("button", name="SHARE")
expect(share_button).to_be_visible()

0 comments on commit b716b46

Please sign in to comment.