Skip to content

Commit 22d281a

Browse files
committed
feat(playwright): add configuration
Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
1 parent 9a094ec commit 22d281a

2 files changed

Lines changed: 88 additions & 0 deletions

File tree

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@
2121
/drone
2222
/findings.sarif
2323

24+
# Playwright
25+
/test-results/
26+
/playwright-report/
27+
/blob-report/
28+
/playwright/.cache/
29+
2430
# PHP Dev server output (integration tests)
2531
/tests/integration/phpserver*.log
2632

playwright.config.ts

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
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: './src/__tests__/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: 'https://nextcloud.local/index.php/',
30+
31+
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
32+
trace: 'on-first-retry',
33+
34+
/* Ignore HTTPS errors | SSL certificate */
35+
ignoreHTTPSErrors: true,
36+
},
37+
38+
/* Configure projects for major browsers */
39+
projects: [
40+
{
41+
name: 'chromium',
42+
use: { ...devices['Desktop Chrome'] },
43+
},
44+
45+
{
46+
name: 'firefox',
47+
use: { ...devices['Desktop Firefox'] },
48+
},
49+
50+
{
51+
name: 'webkit',
52+
use: { ...devices['Desktop Safari'] },
53+
},
54+
55+
/* Test against mobile viewports. */
56+
// {
57+
// name: 'Mobile Chrome',
58+
// use: { ...devices['Pixel 5'] },
59+
// },
60+
// {
61+
// name: 'Mobile Safari',
62+
// use: { ...devices['iPhone 12'] },
63+
// },
64+
65+
/* Test against branded browsers. */
66+
// {
67+
// name: 'Microsoft Edge',
68+
// use: { ...devices['Desktop Edge'], channel: 'msedge' },
69+
// },
70+
// {
71+
// name: 'Google Chrome',
72+
// use: { ...devices['Desktop Chrome'], channel: 'chrome' },
73+
// },
74+
],
75+
76+
/* Run your local dev server before starting the tests */
77+
// webServer: {
78+
// command: 'npm run start',
79+
// url: 'http://localhost:3000',
80+
// reuseExistingServer: !process.env.CI,
81+
// },
82+
})

0 commit comments

Comments
 (0)