gitea源码

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