Skip to content

Commit

Permalink
tests: fix timing problems in simple daemon test
Browse files Browse the repository at this point in the history
This test crashed frequently in the past, but went back to green when rerun,
most of the time. The final check, if the view was stopped correctly, was
always the failing check.

This seems to be a timing issue, because the browser seems not to wait long
enough, before checking if the string `view stopped` appeared.

This patch adds an `lona.pytest.eventually` call, to "fix" all timing issues by
simply retrying the checks.
This is no permanent solution, but will work for now.

Signed-off-by: Florian Scherf <[email protected]>
  • Loading branch information
fscherf committed Feb 10, 2023
1 parent 94587cc commit fd55a76
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/test_daemon_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ async def test_simple_daemon_view(lona_app_context):

from playwright.async_api import async_playwright

from lona.pytest import eventually

def setup_app(app):
from datetime import datetime

Expand Down Expand Up @@ -77,9 +79,12 @@ def handle_request(self, request):

# stop view
await page.click('#stop')
message3 = await page.inner_text('#message')

assert message3 == 'view stopped'
for attempt in eventually():
async with attempt:
message3 = await page.inner_text('#message')

assert message3 == 'view stopped'


async def test_multi_tab_daemon_view(lona_app_context):
Expand Down

0 comments on commit fd55a76

Please sign in to comment.