github.com/kubeshop/testkube@v1.17.23/contrib/executor/playwright/examples/playwright.config.js (about) 1 // @ts-check 2 const { devices } = require('@playwright/test'); 3 4 /** 5 * Read environment variables from file. 6 * https://github.com/motdotla/dotenv 7 */ 8 // require('dotenv').config(); 9 10 11 /** 12 * @see https://playwright.dev/docs/test-configuration 13 * @type {import('@playwright/test').PlaywrightTestConfig} 14 */ 15 const config = { 16 testDir: './tests', 17 /* Maximum time one test can run for. */ 18 timeout: 30 * 1000, 19 expect: { 20 /** 21 * Maximum time expect() should wait for the condition to be met. 22 * For example in `await expect(locator).toHaveText();` 23 */ 24 timeout: 5000 25 }, 26 /* Run tests in files in parallel */ 27 fullyParallel: true, 28 /* Fail the build on CI if you accidentally left test.only in the source code. */ 29 forbidOnly: !!process.env.CI, 30 /* Retry on CI only */ 31 retries: process.env.CI ? 2 : 0, 32 /* Opt out of parallel tests on CI. */ 33 workers: process.env.CI ? 1 : undefined, 34 /* Reporter to use. See https://playwright.dev/docs/test-reporters */ 35 reporter: [ 36 ['html', { open: 'never' }] 37 ], 38 /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ 39 use: { 40 /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ 41 actionTimeout: 0, 42 /* Base URL to use in actions like `await page.goto('/')`. */ 43 // baseURL: 'http://localhost:3000', 44 45 /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ 46 trace: 'on', 47 video: 'on', 48 }, 49 50 /* Configure projects for major browsers */ 51 projects: [ 52 { 53 name: 'chromium', 54 use: { 55 ...devices['Desktop Chrome'], 56 }, 57 }, 58 59 { 60 name: 'firefox', 61 use: { 62 ...devices['Desktop Firefox'], 63 }, 64 }, 65 66 { 67 name: 'webkit', 68 use: { 69 ...devices['Desktop Safari'], 70 }, 71 }, 72 73 /* Test against mobile viewports. */ 74 // { 75 // name: 'Mobile Chrome', 76 // use: { 77 // ...devices['Pixel 5'], 78 // }, 79 // }, 80 // { 81 // name: 'Mobile Safari', 82 // use: { 83 // ...devices['iPhone 12'], 84 // }, 85 // }, 86 87 /* Test against branded browsers. */ 88 // { 89 // name: 'Microsoft Edge', 90 // use: { 91 // channel: 'msedge', 92 // }, 93 // }, 94 // { 95 // name: 'Google Chrome', 96 // use: { 97 // channel: 'chrome', 98 // }, 99 // }, 100 ], 101 102 /* Folder for test artifacts such as screenshots, videos, traces, etc. */ 103 // outputDir: 'test-results/', 104 105 /* Run your local dev server before starting the tests */ 106 // webServer: { 107 // command: 'npm run start', 108 // port: 3000, 109 // }, 110 }; 111 112 module.exports = config;