gitea
Зеркало из https://github.com/go-gitea/gitea
/
playwright.config.ts
98 строк · 2.5 Кб
1import {devices} from '@playwright/test';
2import {env} from 'node:process';
3import type {PlaywrightTestConfig} from '@playwright/test';
4
5const BASE_URL = env.GITEA_URL?.replace?.(/\/$/g, '') || 'http://localhost:3000';
6
7export default {
8testDir: './tests/e2e/',
9testMatch: /.*\.test\.e2e\.ts/, // Match any .test.e2e.ts files
10
11/* Maximum time one test can run for. */
12timeout: 30 * 1000,
13
14expect: {
15
16/**
17* Maximum time expect() should wait for the condition to be met.
18* For example in `await expect(locator).toHaveText();`
19*/
20timeout: 2000,
21},
22
23/* Fail the build on CI if you accidentally left test.only in the source code. */
24forbidOnly: Boolean(env.CI),
25
26/* Retry on CI only */
27retries: env.CI ? 2 : 0,
28
29/* Reporter to use. See https://playwright.dev/docs/test-reporters */
30reporter: env.CI ? 'list' : [['list'], ['html', {outputFolder: 'tests/e2e/reports/', open: 'never'}]],
31
32/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
33use: {
34headless: true, // set to false to debug
35
36locale: 'en-US',
37
38/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
39actionTimeout: 1000,
40
41/* Maximum time allowed for navigation, such as `page.goto()`. */
42navigationTimeout: 5 * 1000,
43
44/* Base URL to use in actions like `await page.goto('/')`. */
45baseURL: BASE_URL,
46
47/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
48trace: 'on-first-retry',
49
50screenshot: 'only-on-failure',
51},
52
53/* Configure projects for major browsers */
54projects: [
55{
56name: 'chromium',
57
58/* Project-specific settings. */
59use: {
60...devices['Desktop Chrome'],
61},
62},
63
64// disabled because of https://github.com/go-gitea/gitea/issues/21355
65// {
66// name: 'firefox',
67// use: {
68// ...devices['Desktop Firefox'],
69// },
70// },
71
72{
73name: 'webkit',
74use: {
75...devices['Desktop Safari'],
76},
77},
78
79/* Test against mobile viewports. */
80{
81name: 'Mobile Chrome',
82use: {
83...devices['Pixel 5'],
84},
85},
86{
87name: 'Mobile Safari',
88use: {
89...devices['iPhone 12'],
90},
91},
92],
93
94/* Folder for test artifacts such as screenshots, videos, traces, etc. */
95outputDir: 'tests/e2e/test-artifacts/',
96/* Folder for test artifacts such as screenshots, videos, traces, etc. */
97snapshotDir: 'tests/e2e/test-snapshots/',
98} satisfies PlaywrightTestConfig;
99