File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change 4
4
Tests aimed at accessibility and correct functioning of the tabs javascript and block
5
5
overrides for downstream projects.
6
6
"""
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 ()
You can’t perform that action at this time.
0 commit comments