Skip to content

Commit aa2001c

Browse files
test ci
1 parent 0f26e99 commit aa2001c

4 files changed

Lines changed: 96 additions & 1 deletion

File tree

.github/workflows/ci.yml

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

.gitlab-ci.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,35 @@ deploy-test:
1414
- ./others/cicd/simci portainer-stack-delete gitlab-simfeatures $PORTAINER_URL
1515
- ./others/cicd/simci portainer-stack-deploy -f ./others/cicd/portainer-stack.yml gitlab-simfeatures $PORTAINER_URL
1616

17+
playwright-tests:
18+
stage: test
19+
needs: [deploy-test]
20+
image: mcr.microsoft.com/playwright:v1.56.1-jammy
21+
variables:
22+
BASE_URL: "https://gitlab-simfeatures.${PORTAINER_URL}/ui"
23+
USER_NAME: playwright
24+
PASSWORD: "${PLAYWRIGHT_PASSWORD}"
25+
before_script:
26+
- cd others/playwright
27+
- npm ci
28+
script:
29+
- |
30+
for i in $(seq 1 30); do
31+
if curl -sf -o /dev/null "$BASE_URL"; then
32+
echo "App is ready"
33+
break
34+
fi
35+
echo "Waiting for app... ($i/30)"
36+
sleep 10
37+
done
38+
curl -sf -o /dev/null "$BASE_URL" || (echo "App failed to become ready" && exit 1)
39+
- npx playwright test --project=chromium
40+
artifacts:
41+
when: on_failure
42+
paths:
43+
- others/playwright/playwright-report/
44+
expire_in: 7 days
45+
1746
unit-tests:
1847
stage: test
1948
script:
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"row_module_id__mdl_name": "SimFeatures",
3+
"dt_name": "PlaywrightUser",
4+
"dt_file": {
5+
"path": "others/playwright/playwright_user.xml",
6+
"mime": "text/xml",
7+
"name": "playwright_user.xml"
8+
},
9+
"dt_desc": "Creates the playwright user with FT_ADMIN responsibility for Playwright E2E tests.",
10+
"dt_exportdate_from": null,
11+
"dt_exportdate_to": null,
12+
"dt_export_format": "xml",
13+
"dt_export_zip": false
14+
}

others/playwright/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
"version": "1.0.0",
44
"description": "",
55
"main": "index.js",
6-
"scripts": {},
6+
"scripts": {
7+
"test": "playwright test"
8+
},
79
"keywords": [],
810
"author": "",
911
"license": "ISC",

0 commit comments

Comments
 (0)