Skip to content

Commit 093cfd9

Browse files
committed
feat: add Playwright configuration and dependencies for end-to-end testing
1 parent 09150a4 commit 093cfd9

File tree

9 files changed

+747
-20
lines changed

9 files changed

+747
-20
lines changed

.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

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,11 @@
22
/wasm/markdown/target/
33
/.vscode/
44
/.vs/
5-
/x/
5+
/x/
6+
7+
# Playwright
8+
node_modules/
9+
/test-results/
10+
/playwright-report/
11+
/blob-report/
12+
/playwright/.cache/

.vscode/launch.json

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,6 @@
1919
"${file}"
2020
],
2121
"attachSimplePort": 9229
22-
},
23-
24-
{
25-
// This tells VS Code we want to debug an extension
26-
"type": "extensionHost",
27-
"request": "launch",
28-
// Name of the configuration as shown in the Run and Debug panel
29-
"name": "PI Extension",
30-
// Tells VS Code which copy of VS Code to use for the Extension Host
31-
"runtimeExecutable": "${execPath}",
32-
// Points to the folder of your extension
33-
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
34-
// Where the compiled output of your extension is located (if you're compiling TypeScript, for example)
35-
"outFiles": [
36-
"${workspaceFolder}/out/**/*.js"
37-
]
38-
}
22+
}
3923
]
4024
}

deno.lock

Lines changed: 15 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 140 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "process-api",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"directories": {
7+
"test": "tests"
8+
},
9+
"scripts": {},
10+
"repository": {
11+
"type": "git",
12+
"url": "git+https://github.com/processapi/process-api.git"
13+
},
14+
"keywords": [],
15+
"author": "",
16+
"license": "ISC",
17+
"bugs": {
18+
"url": "https://github.com/processapi/process-api/issues"
19+
},
20+
"homepage": "https://github.com/processapi/process-api#readme",
21+
"devDependencies": {
22+
"@playwright/test": "^1.50.1",
23+
"@types/node": "^22.13.1"
24+
}
25+
}

playwright.config.js

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
// @ts-check
2+
import { defineConfig, devices } from '@playwright/test';
3+
4+
/**
5+
* Read environment variables from file.
6+
* https://github.com/motdotla/dotenv
7+
*/
8+
// import dotenv from 'dotenv';
9+
// import path from 'path';
10+
// dotenv.config({ path: path.resolve(__dirname, '.env') });
11+
12+
/**
13+
* @see https://playwright.dev/docs/test-configuration
14+
*/
15+
export default defineConfig({
16+
testDir: './e2e',
17+
/* Run tests in files in parallel */
18+
fullyParallel: true,
19+
/* Fail the build on CI if you accidentally left test.only in the source code. */
20+
forbidOnly: !!process.env.CI,
21+
/* Retry on CI only */
22+
retries: process.env.CI ? 2 : 0,
23+
/* Opt out of parallel tests on CI. */
24+
workers: process.env.CI ? 1 : undefined,
25+
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
26+
reporter: 'html',
27+
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
28+
use: {
29+
/* Base URL to use in actions like `await page.goto('/')`. */
30+
// baseURL: 'http://127.0.0.1:3000',
31+
32+
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
33+
trace: 'on-first-retry',
34+
},
35+
36+
/* Configure projects for major browsers */
37+
projects: [
38+
{
39+
name: 'chromium',
40+
use: { ...devices['Desktop Chrome'] },
41+
},
42+
43+
{
44+
name: 'firefox',
45+
use: { ...devices['Desktop Firefox'] },
46+
},
47+
48+
// {
49+
// name: 'webkit',
50+
// use: { ...devices['Desktop Safari'] },
51+
// },
52+
53+
/* Test against mobile viewports. */
54+
// {
55+
// name: 'Mobile Chrome',
56+
// use: { ...devices['Pixel 5'] },
57+
// },
58+
// {
59+
// name: 'Mobile Safari',
60+
// use: { ...devices['iPhone 12'] },
61+
// },
62+
63+
/* Test against branded browsers. */
64+
// {
65+
// name: 'Microsoft Edge',
66+
// use: { ...devices['Desktop Edge'], channel: 'msedge' },
67+
// },
68+
// {
69+
// name: 'Google Chrome',
70+
// use: { ...devices['Desktop Chrome'], channel: 'chrome' },
71+
// },
72+
],
73+
74+
/* Run your local dev server before starting the tests */
75+
// webServer: {
76+
// command: 'npm run start',
77+
// url: 'http://127.0.0.1:3000',
78+
// reuseExistingServer: !process.env.CI,
79+
// },
80+
});
81+

0 commit comments

Comments
 (0)