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