Skip to content

Commit fc8e7be

Browse files
committed
Add CI
1 parent f63e832 commit fc8e7be

File tree

5 files changed

+83
-20
lines changed

5 files changed

+83
-20
lines changed

.eslintrc.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
{
2-
"extends": "next/core-web-vitals"
2+
"extends": "next/core-web-vitals",
3+
"parserOptions": {
4+
"project": "./tsconfig.dev.json"
5+
}
36
}

.github/workflows/playwright.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Playwright Tests
2+
3+
on:
4+
push:
5+
branches: [main, e2e-tests]
6+
pull_request:
7+
branches: [main, e2e-tests]
8+
9+
jobs:
10+
test:
11+
timeout-minutes: 60
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Setup Node.js
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: 20
21+
cache: "npm"
22+
23+
- name: Install dependencies
24+
run: npm ci
25+
26+
- name: Install Playwright Browsers
27+
run: npx playwright install --only-shell chromium --with-deps
28+
29+
- name: Build Next.js application
30+
run: npm run build
31+
env:
32+
NEXT_PUBLIC_WORKOS_REDIRECT_URI: ${{ vars.NEXT_PUBLIC_WORKOS_REDIRECT_URI }}
33+
34+
- name: Run Playwright tests
35+
run: npx playwright test
36+
env:
37+
# Test environment variables
38+
WORKOS_API_KEY: ${{ secrets.WORKOS_API_KEY }}
39+
WORKOS_CLIENT_ID: ${{ secrets.WORKOS_CLIENT_ID }}
40+
WORKOS_COOKIE_PASSWORD: ${{ secrets.WORKOS_COOKIE_PASSWORD }}
41+
TEST_BASE_URL: http://localhost:3000
42+
TEST_EMAIL: ${{ secrets.TEST_EMAIL }}
43+
TEST_PASSWORD: ${{ secrets.TEST_PASSWORD }}
44+
45+
- name: Upload Playwright Report
46+
uses: actions/upload-artifact@v4
47+
if: ${{ !cancelled() }}
48+
with:
49+
name: playwright-report
50+
path: playwright-report/
51+
retention-days: 1
52+
53+
- name: Upload Test Results
54+
uses: actions/upload-artifact@v4
55+
if: ${{ !cancelled() }}
56+
with:
57+
name: test-results
58+
path: test-results/
59+
retention-days: 1

playwright.config.ts

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,29 +35,13 @@ export default defineConfig({
3535
projects: [
3636
{
3737
name: "chromium",
38-
use: {
39-
...devices["Desktop Chrome"],
40-
},
41-
},
42-
43-
{
44-
name: "firefox",
45-
use: {
46-
...devices["Desktop Firefox"],
47-
},
48-
},
49-
50-
{
51-
name: "webkit",
52-
use: {
53-
...devices["Desktop Safari"],
54-
},
38+
use: { ...devices["Desktop Chrome"] },
5539
},
5640
],
5741

5842
/* Run your local dev server before starting the tests */
5943
webServer: {
60-
command: "npm run dev",
44+
command: process.env.CI ? "npm start" : "npm run dev",
6145
url: process.env.TEST_BASE_URL || "http://127.0.0.1:3000",
6246
reuseExistingServer: !process.env.CI,
6347
},

tsconfig.dev.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"include": [
4+
"next-env.d.ts",
5+
"**/*.ts",
6+
"**/*.tsx",
7+
".next/types/**/*.ts",
8+
"tests/**/*",
9+
"cypress/**/*"
10+
],
11+
"exclude": ["node_modules"]
12+
}

tsconfig.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
"@/*": ["./src/*"]
2323
}
2424
},
25-
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
25+
"include": [
26+
"next-env.d.ts",
27+
"src/**/*.ts",
28+
"src/**/*.tsx",
29+
".next/types/**/*.ts"
30+
],
2631
"exclude": ["node_modules"]
2732
}

0 commit comments

Comments
 (0)