File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change
1
+ import importlib .util
1
2
import os
2
3
3
4
import pytest
4
- from playwright .sync_api import expect
5
5
6
6
from testapp .models import ProseEditorModel
7
7
8
8
9
+ # Check if playwright is installed
10
+ playwright_available = importlib .util .find_spec ("playwright" ) is not None
11
+
12
+ # Only import playwright modules if available
13
+ if playwright_available :
14
+ from playwright .sync_api import expect
15
+
16
+
9
17
# Set Django async unsafe to allow database operations in tests
10
18
os .environ .setdefault ("DJANGO_ALLOW_ASYNC_UNSAFE" , "true" )
11
19
20
+ # Skip reason for when playwright is not available
21
+ requires_playwright = pytest .mark .skipif (
22
+ not playwright_available , reason = "Playwright not installed, skipping browser tests"
23
+ )
24
+
12
25
13
26
@pytest .mark .django_db
14
27
@pytest .mark .e2e
28
+ @requires_playwright
15
29
def test_prose_editor_admin_form (page , live_server ):
16
30
"""Test that the prose editor loads and works in the admin."""
17
31
# Login first
@@ -62,6 +76,7 @@ def test_prose_editor_admin_form(page, live_server):
62
76
63
77
@pytest .mark .django_db
64
78
@pytest .mark .e2e
79
+ @requires_playwright
65
80
def test_prose_editor_formatting (page , live_server ):
66
81
"""Test formatting functionality in the prose editor."""
67
82
# Login first
You can’t perform that action at this time.
0 commit comments