(project) install e2e playwright

Install playwright, adapt the config file and add a scripts to
run the tests.
e2e testing will monitor all our frontend applications,
so we install it in the frontend folder.
It configures the base of our monorepo.
This commit is contained in:
Anthony LC
2024-01-11 12:31:08 +01:00
committed by Anthony LC
parent fc7747dddf
commit 2ef31a424a
8 changed files with 260 additions and 69 deletions

View File

@@ -27,7 +27,7 @@
"@testing-library/jest-dom": "6.2.0",
"@testing-library/react": "14.1.2",
"@types/jest": "29.5.11",
"@types/node": "20.10.8",
"@types/node": "*",
"@types/react": "18.2.47",
"@types/react-dom": "18.2.18",
"@typescript-eslint/eslint-plugin": "6.18.1",
@@ -46,6 +46,6 @@
"stylelint": "16.1.0",
"stylelint-config-standard": "36.0.0",
"stylelint-prettier": "5.0.0",
"typescript": "5.3.3"
"typescript": "*"
}
}

File diff suppressed because it is too large Load Diff

5
src/frontend/apps/e2e/.gitignore vendored Normal file
View File

@@ -0,0 +1,5 @@
# e2e
test-results/
report/
blob-report/
playwright/.cache/

View File

@@ -0,0 +1,15 @@
{
"name": "app-e2e",
"version": "0.1.0",
"private": true,
"scripts": {
"install": "playwright install --with-deps",
"test": "playwright test",
"test:ui": "yarn test --ui"
},
"devDependencies": {
"@playwright/test": "1.40.1",
"@types/node": "*",
"typescript": "*"
}
}

View File

@@ -0,0 +1,58 @@
import { defineConfig, devices } from '@playwright/test';
const PORT = process.env.PORT || 3200;
const baseURL = `http://localhost:${PORT}`;
/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
// Timeout per test
timeout: 30 * 1000,
testDir: './__tests__',
outputDir: './test-results',
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: [['html', { outputFolder: './report' }]],
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
baseURL: baseURL,
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
},
webServer: {
command: 'cd ../.. && yarn dev:desk --port ' + PORT,
url: baseURL,
timeout: 120 * 1000,
reuseExistingServer: !process.env.CI,
},
/* Configure projects for major browsers */
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
},
{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
},
],
});

View File

@@ -0,0 +1,19 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
},
"include": ["**/*.ts", ],
"exclude": ["node_modules"]
}