Skip to content

Commit 20a43d2

Browse files
Create playwright-ci.yml
1 parent 3311222 commit 20a43d2

1 file changed

Lines changed: 69 additions & 0 deletions

File tree

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Playwright
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
deploy-test:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v4
12+
13+
- name: Deploy test stack
14+
run: |
15+
chmod +x ./others/cicd/simci
16+
export PORTAINER_API_TOKEN="${{ secrets.PORTAINER_API_TOKEN }}"
17+
export IO_PASSWORD="${{ secrets.IO_PASSWORD }}"
18+
./others/cicd/simci portainer-stack-delete gitlab-simfeatures "${{ secrets.PORTAINER_URL }}"
19+
./others/cicd/simci portainer-stack-deploy -f ./others/cicd/portainer-stack.yml gitlab-simfeatures "${{ secrets.PORTAINER_URL }}"
20+
21+
playwright-tests:
22+
runs-on: ubuntu-latest
23+
needs: deploy-test
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
28+
- name: Set up Node.js
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: '20'
32+
33+
- name: Install Playwright dependencies
34+
working-directory: ./others/playwright
35+
run: npm ci
36+
37+
- name: Install Playwright browsers
38+
working-directory: ./others/playwright
39+
run: npx playwright install
40+
41+
- name: Wait for app to be ready
42+
run: |
43+
APP_URL="https://gitlab-simfeatures.${{ secrets.PORTAINER_URL }}/ui"
44+
for i in $(seq 1 30); do
45+
if curl -sf -o /dev/null "$APP_URL"; then
46+
echo "App is ready"
47+
break
48+
fi
49+
echo "Waiting for app... ($i/30)"
50+
sleep 10
51+
done
52+
curl -sf -o /dev/null "$APP_URL" || (echo "App failed to become ready" && exit 1)
53+
54+
- name: Run Playwright tests
55+
working-directory: ./others/playwright
56+
env:
57+
CI: true
58+
BASE_URL: "https://gitlab-simfeatures.${{ secrets.PORTAINER_URL }}/ui"
59+
USER_NAME: user
60+
PASSWORD: ${{ secrets.PLAYWRIGHT_PASSWORD }}
61+
run: npx playwright test --project=firefox
62+
63+
- name: Upload Playwright report
64+
uses: actions/upload-artifact@v4
65+
if: failure()
66+
with:
67+
name: playwright-report
68+
path: others/playwright/playwright-report/
69+
retention-days: 7

0 commit comments

Comments
 (0)