You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

playwright.config.js 2.6KB

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