Skip to content

Commit 14bdf3b

Browse files
🚧 WIP
1 parent 10e524f commit 14bdf3b

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

tests/base/test_api_landing_page.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,38 @@
44
Tests aimed at accessibility and correct functioning of the tabs javascript and block
55
overrides for downstream projects.
66
"""
7+
8+
import os
9+
10+
import pytest
11+
from playwright.sync_api import Page, expect
12+
13+
pytestmark = pytest.mark.e2e
14+
15+
16+
@pytest.fixture(scope="module", autouse=True)
17+
def _patch_environ():
18+
# otherwise pytest-playwright and pytest-django don't play nice :(
19+
# See https://github.com/microsoft/playwright-pytest/issues/46
20+
_original = os.environ.get("DJANGO_ALLOW_ASYNC_UNSAFE")
21+
os.environ["DJANGO_ALLOW_ASYNC_UNSAFE"] = "1"
22+
yield
23+
if _original is None:
24+
del os.environ["DJANGO_ALLOW_ASYNC_UNSAFE"]
25+
else:
26+
os.environ["DJANGO_ALLOW_ASYNC_UNSAFE"] = _original
27+
28+
29+
@pytest.fixture(scope="function", autouse=True)
30+
def before_each_after_each(live_server, page: Page):
31+
test_page_url = f"{live_server.url}/api/index/"
32+
page.goto(test_page_url)
33+
marker = page.get_by_role("heading", name="Testapp API")
34+
expect(marker).to_be_visible()
35+
yield
36+
37+
38+
def test_content_tabs_interaction(page: Page):
39+
# Initially, the Dutch tab should be focused
40+
dutch_content = page.get_by_text("Dutch Content")
41+
expect(dutch_content).to_be_visible()

0 commit comments

Comments
 (0)