Skip to content

Commit

Permalink
Added Playwright
Browse files Browse the repository at this point in the history
  • Loading branch information
felixgirault committed Oct 11, 2024
1 parent 6afe295 commit 0ee5eb3
Show file tree
Hide file tree
Showing 5 changed files with 128 additions and 47 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@
/dist/*.mts
/dist/stats.json
/dist/example-assets/migrations.js
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
9 changes: 9 additions & 0 deletions e2e/demo.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import {test, expect} from '@playwright/test';

test.describe('Demo page', () => {
// A very basic test to assess the availability of the dev server.
test('should have a title', async ({page}) => {
await page.goto('/');
await expect(page).toHaveTitle(/Orejime/);
});
});
126 changes: 80 additions & 46 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@
"scripts": {
"start": "rspack --watch",
"serve": "rspack serve",
"test": "NODE_OPTIONS=--experimental-vm-modules jest src",
"test-unit": "NODE_OPTIONS=--experimental-vm-modules jest src",
"test-e2e": "playwright test",
"test-e2e-ui": "npm run test-e2e -- --ui",
"test": "npm run test-unit && npm run test-e2e",
"clean-build": "shx rm -Rf ./lib ./es ./dist/*.js ./dist/*.css ./dist/*.scss ./dist/stats.json",
"build-commonjs": "tsc -p ./build/tsconfig.commonjs.json",
"build-module": "tsc -p ./build/tsconfig.module.json",
Expand All @@ -53,6 +56,7 @@
"js-cookie": "^3.0.1"
},
"devDependencies": {
"@playwright/test": "^1.48.0",
"@rspack/cli": "^1.0.3",
"@rspack/core": "^1.0.3",
"@swc/core": "^1.7.23",
Expand All @@ -61,6 +65,7 @@
"@types/jest": "^27.5.0",
"@types/js-cookie": "^3.0.2",
"@types/micromodal": "^0.3.5",
"@types/node": "^22.7.5",
"cross-env": "^5.2.0",
"css-loader": "^0.28.11",
"jest": "^28.1.3",
Expand Down
29 changes: 29 additions & 0 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import {defineConfig, devices} from '@playwright/test';

export default defineConfig({
testDir: './e2e',
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 1 : undefined,
reporter: 'html',
use: {
baseURL: 'http://127.0.0.1:3000',
trace: 'on-first-retry'
},
projects: [
{
name: 'chromium',
use: {...devices['Desktop Chrome']}
},
{
name: 'firefox',
use: {...devices['Desktop Firefox']}
}
],
webServer: {
command: 'npm run serve',
url: 'http://127.0.0.1:3000',
reuseExistingServer: !process.env.CI
}
});

0 comments on commit 0ee5eb3

Please sign in to comment.