Skip to content

Fix inconsistent playwright test #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions tests/test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import time

import pytest
from playwright.sync_api import Page, expect

Expand All @@ -14,13 +12,6 @@
]


# Add a delay to each test to help with playwright race conditions
@pytest.fixture(autouse=True)
def slow_down_tests():
yield
time.sleep(1)


@pytest.mark.parametrize("url", routes)
def test_destination(
page: Page,
Expand All @@ -29,7 +20,8 @@ def test_destination(
"""Test that the destinations page loads with seeded data"""
# Create a destination
response = page.goto(f"{live_server_url}/{url}")
page.on("response", lambda response: expect(response.status).to_equal(200))

assert response.status == 200 # Check that the page loaded successfully
assert response.url.endswith(f"/{url}/") # Load the index.html


Expand Down
Loading