Skip to content

Commit

Permalink
add playwright setup
Browse files Browse the repository at this point in the history
  • Loading branch information
rkuo-danswer committed Nov 15, 2024
1 parent d725067 commit ad4600f
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 3 deletions.
27 changes: 24 additions & 3 deletions .github/workflows/pr-chromatic-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,21 @@ jobs:
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
cache-dependency-path: |
backend/requirements/default.txt
backend/requirements/dev.txt
backend/requirements/model_server.txt
- run: |
python -m pip install --upgrade pip
pip install --retries 5 --timeout 30 -r backend/requirements/default.txt
pip install --retries 5 --timeout 30 -r backend/requirements/dev.txt
pip install --retries 5 --timeout 30 -r backend/requirements/model_server.txt
- name: Setup node
uses: actions/setup-node@v4
with:
Expand Down Expand Up @@ -138,9 +153,11 @@ jobs:
done
echo "Finished waiting for service."
- name: Run Playwright tests
working-directory: ./web
run: npx playwright test
- name: Run pytest playwright test init
working-directory: ./backend
env:
PYTEST_IGNORE_SKIP: true
run: pytest -s tests/integration/tests/playwright/test_playwright.py

- uses: actions/upload-artifact@v4
if: always()
Expand Down Expand Up @@ -180,18 +197,22 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 22

- name: Install node dependencies
working-directory: ./web
run: npm ci

- name: Download Playwright test results
uses: actions/download-artifact@v4
with:
name: test-results
path: ./web/test-results

- name: Run Chromatic
uses: chromaui/action@latest
with:
Expand Down
18 changes: 18 additions & 0 deletions backend/tests/integration/tests/playwright/test_playwright.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import os

import pytest

from tests.integration.common_utils.managers.user import UserManager
from tests.integration.common_utils.test_models import DATestUser


@pytest.mark.skipif(
os.getenv("PYTEST_IGNORE_SKIP") is None,
reason="Skipped by default unless env var exists",
)
def test_playwright_setup(reset: None) -> None:
"""Not really a test, just using this to automate setup for playwright tests."""

# Creating an admin user (first user created is automatically an admin)
admin_user: DATestUser = UserManager.create(name="admin_user")
assert admin_user

0 comments on commit ad4600f

Please sign in to comment.