Skip to content

Commit 90fd344

Browse files
wip
1 parent 2c0413c commit 90fd344

File tree

7 files changed

+137
-1
lines changed

7 files changed

+137
-1
lines changed
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 install -g yarn && yarn
18+
- name: Install Playwright Browsers
19+
run: yarn playwright install --with-deps
20+
- name: Run Playwright tests
21+
run: yarn 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

pro/.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,11 @@ tyrion_report.html
5757
result.html
5858

5959
public/icons/*.svg
60+
61+
# Playwright
62+
node_modules/
63+
/test-results/
64+
/playwright-report/
65+
/blob-report/
66+
/playwright/.cache/
67+
/playwright/.auth/

pro/config/playwright.config.ts

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

pro/e2e/example.spec.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { expect, test } from '@playwright/test'
2+
3+
test('has title', async ({ page }) => {
4+
await page.goto('https://playwright.dev/')
5+
6+
// Expect a title "to contain" a substring.
7+
await expect(page).toHaveTitle(/Playwright/)
8+
})
9+
10+
test('get started link', async ({ page }) => {
11+
await page.goto('https://playwright.dev/')
12+
13+
// Click the get started link.
14+
await page.getByRole('link', { name: 'Get started' }).click()
15+
16+
// Expects page to have a heading with the name of Installation.
17+
await expect(
18+
page.getByRole('heading', { name: 'Installation' })
19+
).toBeVisible()
20+
})

pro/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"start": "vite",
2626
"test:bdd": "cypress run --e2e --browser chrome --env tags=@P0 --config-file cypress/cypress.config.ts",
2727
"test:e2e": "cypress open --e2e --browser chrome --config-file cypress/cypress.config.ts",
28+
"test:e2e:playwright": "playwright test",
2829
"test:unit": "vitest",
2930
"test:unit:hook": "vitest related --run",
3031
"test:unit:hookcoverage": "vitest related --run --coverage.enabled=true --coverage.100=true",
@@ -72,6 +73,7 @@
7273
"@biomejs/biome": "2.3.8",
7374
"@cypress/grep": "5.0.0",
7475
"@hookform/devtools": "4.4.0",
76+
"@playwright/test": "^1.57.0",
7577
"@storybook/addon-a11y": "9.1.16",
7678
"@storybook/addon-docs": "9.1.16",
7779
"@storybook/react-vite": "9.1.16",

pro/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"target": "es6",
3434
"types": ["node", "vite/client", "vitest/globals"]
3535
},
36-
"include": ["./src/**/*.ts", "./src/**/*.tsx"],
36+
"include": ["./e2e/**/*.tsx", "./src/**/*.ts", "./src/**/*.tsx"],
3737
"exclude": [
3838
"node_modules",
3939
"__mocks__/**",

pro/yarn.lock

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,6 +1353,13 @@
13531353
resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33"
13541354
integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==
13551355

1356+
"@playwright/test@^1.57.0":
1357+
version "1.57.0"
1358+
resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.57.0.tgz#a14720ffa9ed7ef7edbc1f60784fc6134acbb003"
1359+
integrity sha512-6TyEnHgd6SArQO8UO2OMTxshln3QMWBtPGrOCgs3wVEmQmwyuNtB10IZMfmYDE0riwNR1cu4q+pPcxMVtaG3TA==
1360+
dependencies:
1361+
playwright "1.57.0"
1362+
13561363
"@radix-ui/[email protected]":
13571364
version "1.1.3"
13581365
resolved "https://registry.yarnpkg.com/@radix-ui/primitive/-/primitive-1.1.3.tgz#e2dbc13bdc5e4168f4334f75832d7bdd3e2de5ba"
@@ -3704,6 +3711,11 @@ fs-extra@^9.1.0:
37043711
jsonfile "^6.0.1"
37053712
universalify "^2.0.0"
37063713

3714+
3715+
version "2.3.2"
3716+
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a"
3717+
integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==
3718+
37073719
fsevents@~2.3.2, fsevents@~2.3.3:
37083720
version "2.3.3"
37093721
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6"
@@ -4915,6 +4927,20 @@ pify@^2.2.0:
49154927
resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c"
49164928
integrity sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==
49174929

4930+
4931+
version "1.57.0"
4932+
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.57.0.tgz#3dcc9a865af256fa9f0af0d67fc8dd54eecaebf5"
4933+
integrity sha512-agTcKlMw/mjBWOnD6kFZttAAGHgi/Nw0CZ2o6JqWSbMlI219lAFLZZCyqByTsvVAJq5XA5H8cA6PrvBRpBWEuQ==
4934+
4935+
4936+
version "1.57.0"
4937+
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.57.0.tgz#74d1dacff5048dc40bf4676940b1901e18ad0f46"
4938+
integrity sha512-ilYQj1s8sr2ppEJ2YVadYBN0Mb3mdo9J0wQ+UuDhzYqURwSoW4n1Xs5vs7ORwgDGmyEh33tRMeS8KhdkMoLXQw==
4939+
dependencies:
4940+
playwright-core "1.57.0"
4941+
optionalDependencies:
4942+
fsevents "2.3.2"
4943+
49184944
postcss-media-query-parser@^0.2.3:
49194945
version "0.2.3"
49204946
resolved "https://registry.yarnpkg.com/postcss-media-query-parser/-/postcss-media-query-parser-0.2.3.tgz#27b39c6f4d94f81b1a73b8f76351c609e5cef244"

0 commit comments

Comments
 (0)