Skip to content

Commit 9bb2544

Browse files
authored
chore: init Playwright framework (#354)
1 parent 6b34363 commit 9bb2544

File tree

7 files changed

+215
-90
lines changed

7 files changed

+215
-90
lines changed

.github/workflows/playwright.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Playwright Tests
2+
on:
3+
push:
4+
branches: [main]
5+
pull_request:
6+
branches: [main]
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 install -g pnpm && pnpm install
18+
- name: Install Playwright Browsers
19+
run: pnpm exec playwright install --with-deps
20+
- name: Start the development server
21+
run: pnpm run dev &
22+
env:
23+
PORT: 3001
24+
VITE_PARSEABLE_URL: 'https://demo.parseable.com'
25+
- name: Run Playwright tests
26+
run: pnpm exec playwright test
27+
- uses: actions/upload-artifact@v4
28+
if: ${{ !cancelled() }}
29+
with:
30+
name: playwright-report
31+
path: playwright-report/
32+
retention-days: 1

.github/workflows/prettier.yaml

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
name: Continuous Integration
22

3-
on:
4-
pull_request
3+
on: pull_request
54

65
jobs:
76
prettier:
@@ -10,9 +9,5 @@ jobs:
109
steps:
1110
- name: Checkout
1211
uses: actions/checkout@v4
13-
with:
14-
ref: ${{ github.head_ref }}
1512
- name: Prettify code
1613
uses: creyD/prettier_action@v4.3
17-
with:
18-
prettier_options: --write **/*.{ts,tsx,js,json}

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,7 @@ build.zip
5252

5353

5454
.vercel
55+
/test-results/
56+
/playwright-report/
57+
/blob-report/
58+
/playwright/.cache/

package.json

+85-84
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,87 @@
11
{
2-
"name": "parseable-console",
3-
"version": "0.1.0",
4-
"private": true,
5-
"type": "module",
6-
"scripts": {
7-
"dev": "vite --host --port 3001",
8-
"build": "tsc && vite build",
9-
"build:test": "tsc && vite build --mode test",
10-
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
11-
"start": "vite preview --host --port 3002",
12-
"tsCheck": "tsc --noEmit",
13-
"pq": "pretty-quick"
14-
},
15-
"dependencies": {
16-
"@apache-arrow/ts": "^14.0.2",
17-
"@emotion/react": "^11.11.1",
18-
"@mantine/carousel": "^7.8.1",
19-
"@mantine/charts": "^7.8.1",
20-
"@mantine/code-highlight": "^7.8.1",
21-
"@mantine/core": "^7.8.1",
22-
"@mantine/dates": "^7.8.1",
23-
"@mantine/form": "^7.8.1",
24-
"@mantine/hooks": "^7.8.1",
25-
"@mantine/notifications": "^7.8.1",
26-
"@monaco-editor/react": "^4.5.1",
27-
"@tabler/icons-react": "^3.3.0",
28-
"@types/js-cookie": "^3.0.3",
29-
"axios": "^1.4.0",
30-
"dayjs": "^1.11.10",
31-
"embla-carousel-react": "7.1.0",
32-
"html2canvas": "^1.4.1",
33-
"http-status-codes": "^2.2.0",
34-
"immer": "^10.0.2",
35-
"jq-web": "^0.5.1",
36-
"js-cookie": "^3.0.5",
37-
"just-compare": "^2.3.0",
38-
"lodash": "^4.17.21",
39-
"long": "^5.2.3",
40-
"mantine-react-table": "2.0.0-beta.6",
41-
"moment-timezone": "^0.5.45",
42-
"ms": "^2.1.3",
43-
"nice-grpc-common": "^2.0.2",
44-
"nice-grpc-web": "^3.3.2",
45-
"protobufjs": "^7.2.5",
46-
"react": "^18.2.0",
47-
"react-beautiful-dnd": "^13.1.1",
48-
"react-dom": "^18.2.0",
49-
"react-error-boundary": "^4.0.10",
50-
"react-grid-layout": "^1.4.4",
51-
"react-query": "^3.39.3",
52-
"react-querybuilder": "^6.5.5",
53-
"react-resizable": "^3.0.5",
54-
"react-resizable-panels": "^0.0.53",
55-
"react-router-dom": "^6.14.0",
56-
"react-window": "^1.8.9"
57-
},
58-
"devDependencies": {
59-
"@types/lodash": "^4.17.0",
60-
"@types/ms": "^0.7.31",
61-
"@types/node": "^20.3.2",
62-
"@types/react": "^18.2.14",
63-
"@types/react-beautiful-dnd": "^13.1.4",
64-
"@types/react-dom": "^18.2.6",
65-
"@types/react-grid-layout": "^1.3.5",
66-
"@types/react-resizable": "^3.0.8",
67-
"@types/react-window": "^1.8.5",
68-
"@typescript-eslint/eslint-plugin": "^5.60.1",
69-
"@typescript-eslint/parser": "^5.60.1",
70-
"@vitejs/plugin-react-swc": "^3.3.2",
71-
"eslint": "^8.43.0",
72-
"eslint-config-prettier": "^8.8.0",
73-
"eslint-plugin-import": "^2.27.5",
74-
"eslint-plugin-prettier": "^4.2.1",
75-
"eslint-plugin-react": "^7.32.2",
76-
"eslint-plugin-react-hooks": "^4.6.0",
77-
"eslint-plugin-react-refresh": "^0.4.1",
78-
"postcss": "^8.4.33",
79-
"postcss-preset-mantine": "^1.13.0",
80-
"postcss-simple-vars": "^7.0.1",
81-
"prettier": "^2.8.8",
82-
"pretty-quick": "^3.1.3",
83-
"typescript": "^5.1.6",
84-
"vite": "^4.3.9"
85-
}
2+
"name": "parseable-console",
3+
"version": "0.1.0",
4+
"private": true,
5+
"type": "module",
6+
"scripts": {
7+
"dev": "vite --host --port 3001",
8+
"build": "tsc && vite build",
9+
"build:test": "tsc && vite build --mode test",
10+
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
11+
"start": "vite preview --host --port 3002",
12+
"tsCheck": "tsc --noEmit",
13+
"pq": "pretty-quick"
14+
},
15+
"dependencies": {
16+
"@apache-arrow/ts": "^14.0.2",
17+
"@emotion/react": "^11.11.1",
18+
"@mantine/carousel": "^7.8.1",
19+
"@mantine/charts": "^7.8.1",
20+
"@mantine/code-highlight": "^7.8.1",
21+
"@mantine/core": "^7.8.1",
22+
"@mantine/dates": "^7.8.1",
23+
"@mantine/form": "^7.8.1",
24+
"@mantine/hooks": "^7.8.1",
25+
"@mantine/notifications": "^7.8.1",
26+
"@monaco-editor/react": "^4.5.1",
27+
"@tabler/icons-react": "^3.3.0",
28+
"@types/js-cookie": "^3.0.3",
29+
"axios": "^1.4.0",
30+
"dayjs": "^1.11.10",
31+
"embla-carousel-react": "7.1.0",
32+
"html2canvas": "^1.4.1",
33+
"http-status-codes": "^2.2.0",
34+
"immer": "^10.0.2",
35+
"jq-web": "^0.5.1",
36+
"js-cookie": "^3.0.5",
37+
"just-compare": "^2.3.0",
38+
"lodash": "^4.17.21",
39+
"long": "^5.2.3",
40+
"mantine-react-table": "2.0.0-beta.6",
41+
"moment-timezone": "^0.5.45",
42+
"ms": "^2.1.3",
43+
"nice-grpc-common": "^2.0.2",
44+
"nice-grpc-web": "^3.3.2",
45+
"protobufjs": "^7.2.5",
46+
"react": "^18.2.0",
47+
"react-beautiful-dnd": "^13.1.1",
48+
"react-dom": "^18.2.0",
49+
"react-error-boundary": "^4.0.10",
50+
"react-grid-layout": "^1.4.4",
51+
"react-query": "^3.39.3",
52+
"react-querybuilder": "^6.5.5",
53+
"react-resizable": "^3.0.5",
54+
"react-resizable-panels": "^0.0.53",
55+
"react-router-dom": "^6.14.0",
56+
"react-window": "^1.8.9"
57+
},
58+
"devDependencies": {
59+
"@playwright/test": "^1.48.2",
60+
"@types/lodash": "^4.17.0",
61+
"@types/ms": "^0.7.31",
62+
"@types/node": "^20.3.2",
63+
"@types/react": "^18.2.14",
64+
"@types/react-beautiful-dnd": "^13.1.4",
65+
"@types/react-dom": "^18.2.6",
66+
"@types/react-grid-layout": "^1.3.5",
67+
"@types/react-resizable": "^3.0.8",
68+
"@types/react-window": "^1.8.5",
69+
"@typescript-eslint/eslint-plugin": "^5.60.1",
70+
"@typescript-eslint/parser": "^5.60.1",
71+
"@vitejs/plugin-react-swc": "^3.3.2",
72+
"eslint": "^8.43.0",
73+
"eslint-config-prettier": "^8.8.0",
74+
"eslint-plugin-import": "^2.27.5",
75+
"eslint-plugin-prettier": "^4.2.1",
76+
"eslint-plugin-react": "^7.32.2",
77+
"eslint-plugin-react-hooks": "^4.6.0",
78+
"eslint-plugin-react-refresh": "^0.4.1",
79+
"postcss": "^8.4.33",
80+
"postcss-preset-mantine": "^1.13.0",
81+
"postcss-simple-vars": "^7.0.1",
82+
"prettier": "^2.8.8",
83+
"pretty-quick": "^3.1.3",
84+
"typescript": "^5.1.6",
85+
"vite": "^4.3.9"
86+
}
8687
}

playwright.config.ts

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import { defineConfig, devices } from '@playwright/test';
2+
3+
export default defineConfig({
4+
testDir: './tests',
5+
/* Run tests in files in parallel */
6+
fullyParallel: true,
7+
/* Fail the build on CI if you accidentally left test.only in the source code. */
8+
forbidOnly: !!process.env.CI,
9+
/* Retry on CI only */
10+
retries: process.env.CI ? 2 : 0,
11+
/* Opt out of parallel tests on CI. */
12+
workers: process.env.CI ? 1 : undefined,
13+
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
14+
reporter: 'html',
15+
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
16+
use: {
17+
/* Base URL to use in actions like `await page.goto('/')`. */
18+
// baseURL: 'http://127.0.0.1:3000',
19+
20+
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
21+
trace: 'on-first-retry',
22+
},
23+
24+
/* Configure projects for major browsers */
25+
projects: [
26+
{
27+
name: 'chromium',
28+
use: { ...devices['Desktop Chrome'] },
29+
},
30+
31+
{
32+
name: 'firefox',
33+
use: { ...devices['Desktop Firefox'] },
34+
},
35+
36+
{
37+
name: 'webkit',
38+
use: { ...devices['Desktop Safari'] },
39+
},
40+
],
41+
42+
/* Run your local dev server before starting the tests */
43+
// webServer: {
44+
// command: 'npm run start',
45+
// url: 'http://127.0.0.1:3000',
46+
// reuseExistingServer: !process.env.CI,
47+
// },
48+
});

pnpm-lock.yaml

+38
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/login.spec.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { test, expect } from '@playwright/test';
2+
3+
test('has title', async ({ page }) => {
4+
await page.goto('http://localhost:3001');
5+
6+
await expect(page).toHaveTitle(/Parseable | Login/);
7+
});

0 commit comments

Comments
 (0)