Skip to content

Commit

Permalink
Added Playwright
Browse files Browse the repository at this point in the history
  • Loading branch information
felixgirault committed Oct 10, 2024
1 parent 5f2a08a commit 9e6e012
Show file tree
Hide file tree
Showing 5 changed files with 170 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ node_modules
/dist/orejime.scss
/es
/lib
/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/);
});
});
125 changes: 125 additions & 0 deletions package-lock.json

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

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"scripts": {
"start": "cross-env NODE_ENV=development npm run umd -- --watch & npm run serve",
"serve": "browser-sync start -s --serveStatic dist -w -f dist/orejime.{css,js} --no-open",
"test": "playwright test",
"cjs": "cross-env BABEL_ENV=cjs babel --out-dir lib src",
"es": "cross-env BABEL_ENV=es babel --out-dir es src",
"umd": "cross-env BABEL_ENV=umd webpack",
Expand All @@ -41,6 +42,8 @@
"@babel/plugin-transform-runtime": "^7.1.0",
"@babel/preset-env": "^7.1.0",
"@babel/preset-react": "^7.0.0",
"@playwright/test": "^1.48.0",
"@types/node": "^22.7.5",
"babel-loader": "^8.0.4",
"babel-plugin-convert-to-json": "^0.1.0",
"browser-sync": "^2.26.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 start',
url: 'http://127.0.0.1:3000',
reuseExistingServer: !process.env.CI
}
});

0 comments on commit 9e6e012

Please sign in to comment.