Skip to content

Commit b7b6a7d

Browse files
committed
eap(update-ci): Update CI for playwright
1 parent 4362c3e commit b7b6a7d

File tree

9 files changed

+169
-25
lines changed

9 files changed

+169
-25
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
path: packages/ui/dist
6464

6565
test:
66-
name: Run tests
66+
name: Run tests (Unit + Playwright)
6767
environment: 'test'
6868
runs-on: ubuntu-latest
6969
defaults:
@@ -87,8 +87,14 @@ jobs:
8787
name: ui-build
8888
path: packages/ui/dist
8989

90-
- name: Run test
91-
run: pnpm test
90+
- name: Build app
91+
run: pnpm build
92+
93+
- name: Install Playwright browsers
94+
run: pnpm exec playwright install --with-deps
95+
96+
- name: Run Playwright tests
97+
run: pnpm exec playwright test
9298

9399
translation:
94100
continue-on-error: true

.github/workflows/playwright.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Playwright Tests
2+
on:
3+
push:
4+
branches: [ main, master ]
5+
pull_request:
6+
branches: [ main, master ]
7+
jobs:
8+
test:
9+
timeout-minutes: 60
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-node@v4
14+
with:
15+
node-version: lts/*
16+
- name: Install dependencies
17+
run: npm ci
18+
- name: Install Playwright Browsers
19+
run: npx playwright install --with-deps
20+
- name: Run Playwright tests
21+
run: npx playwright test
22+
- uses: actions/upload-artifact@v4
23+
if: ${{ !cancelled() }}
24+
with:
25+
name: playwright-report
26+
path: playwright-report/
27+
retention-days: 30

package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,5 @@
4545
"@togglecorp/[email protected]": "patches/@[email protected]",
4646
4747
}
48-
},
49-
"dependencies": {
50-
"json5": "^2.2.3"
5148
}
5249
}

packages/e2e-tests/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
"name": "e2e-tests",
33
"version": "1.0.0",
44
"main": "index.js",
5-
"scripts": {},
5+
"scripts": {
6+
"test:e2e": "playwright test"
7+
},
68
"keywords": [],
79
"author": "",
810
"license": "ISC",

packages/e2e-tests/playwright.config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ import { defineConfig, devices } from '@playwright/test';
1313
*/
1414
export default defineConfig({
1515
testDir: './tests',
16+
testMatch: '**/*.spec.ts',
17+
testIgnore: [
18+
'**/*.test.ts',
19+
'**/app/**',
20+
'**/packages/ui/**',
21+
],
1622
/* Run tests in files in parallel */
1723
fullyParallel: true,
1824
/* Fail the build on CI if you accidentally left test.only in the source code. */

packages/e2e-tests/tests/eap_regis.spec.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
import { test, expect } from '@playwright/test';
22
import JSON5 from 'json5';
33
import fs from 'fs';
4+
import path from 'path';
45

5-
// Load JSON5
6-
const data = JSON5.parse(fs.readFileSync('eap_regis_data.json5', 'utf-8'));
6+
const dataPath = path.resolve(__dirname, 'eap_regis_data.json5');
7+
8+
const data = JSON5.parse(
9+
fs.readFileSync(dataPath, 'utf-8'),
10+
);
711

812
// Function to fill contact fields
913
async function fillContact(page,prefix: string,contact: { name: string; title: string; email: string; phone: string })

packages/e2e-tests/tests/eap_regis_data.json5

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
username: "[email protected]",
3-
password: "kvZYZ&Ry72R5uBA*5k",
3+
password: "kvZYZ&Ry72R5uBY*5k",
44

55
eapForm: {
66
national_society: "Afghan Red Crescent Society",

0 commit comments

Comments
 (0)