Skip to content
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

Separate django and playwright test #506

Merged
merged 4 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
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
75 changes: 75 additions & 0 deletions .github/workflows/playwright-e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: 🧪 Playwright End To End (e2e) Tests Workflow

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
e2e-tests:
runs-on: ubuntu-latest
defaults:
run:
working-directory: dockerize
steps:
- name: 🛒 Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 20

- name: Generate the .env file
run: cp .env.template .env

- name: Run the containers
run: docker compose up -d db devweb


- name: Wait for the containers to start
run: sleep 15

- name: Start Django server
run: |
docker compose exec -T devweb bash -c '
set -e # Exit immediately if any command fails
python manage.py makemigrations --merge --noinput &&
python manage.py makemigrations feedjack &&
python manage.py makemigrations &&
python manage.py migrate &&
python manage.py loaddata fixtures/*.json
nohup python manage.py runserver 0.0.0.0:8081 &
'
# Wait for the server to start
until curl -s http://localhost:62202; do
echo "Waiting for Django server to be up..."
sleep 5
done

- name: Test django endpoint
run: |
curl -v http://0.0.0.0:62202
if [ $? -ne 0 ]; then
echo "Curl command failed"
exit 1
fi

- name: Install playwright dependencies
working-directory: playwright/ci-test
run: |
npm install
npm ci
npx playwright install --with-deps
- name: Run Playwright tests
working-directory: playwright/ci-test
run: npx playwright test
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright/ci-test/playwright-report/
retention-days: 30

38 changes: 0 additions & 38 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ jobs:
working-directory: dockerize
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 20

- name: Generate the .env file
run: cp .env.template .env
Expand All @@ -65,42 +62,7 @@ jobs:
run: |
docker compose exec -T devweb bash -c '
set -e # Exit immediately if any command fails
python manage.py makemigrations --merge --noinput &&
python manage.py makemigrations feedjack &&
python manage.py makemigrations &&
python manage.py migrate &&
python manage.py test
'
- name: Start Django server
run: |
docker compose exec -T devweb bash -c "python manage.py loaddata fixtures/*.json"
docker compose exec -T devweb bash -c "nohup python manage.py runserver 0.0.0.0:8081 &"
# Wait for the server to start
until curl -s http://localhost:62202; do
echo "Waiting for Django server to be up..."
sleep 5
done

- name: Test django endpoint
run: |
curl -v http://0.0.0.0:62202
if [ $? -ne 0 ]; then
echo "Curl command failed"
exit 1
fi

- name: Install playwright dependencies
working-directory: playwright/ci-test
run: |
npm install
npm ci
npx playwright install --with-deps
- name: Run Playwright tests
working-directory: playwright/ci-test
run: npx playwright test
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright/ci-test/playwright-report/
retention-days: 30
Loading