playwright.config.ts 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. import { defineConfig, devices } from '@playwright/test';
  2. import { exec } from 'node:child_process';
  3. const utils = require('./global-utils');
  4. utils.loadEnv();
  5. /**
  6. * See https://playwright.dev/docs/test-configuration.
  7. */
  8. export default defineConfig({
  9. testDir: './.',
  10. /* Run tests in files in parallel */
  11. fullyParallel: false,
  12. /* Fail the build on CI if you accidentally left test.only in the source code. */
  13. forbidOnly: !!process.env.CI,
  14. retries: 0,
  15. workers: 1,
  16. /* Reporter to use. See https://playwright.dev/docs/test-reporters */
  17. reporter: 'html',
  18. /* Long global timeout for complex tests
  19. * But short action/nav/expect timeouts to fail on specific step (raise locally if not enough).
  20. */
  21. timeout: 120 * 1000,
  22. actionTimeout: 10 * 1000,
  23. navigationTimeout: 10 * 1000,
  24. expect: { timeout: 10 * 1000 },
  25. /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
  26. use: {
  27. /* Base URL to use in actions like `await page.goto('/')`. */
  28. baseURL: process.env.DOMAIN,
  29. browserName: 'firefox',
  30. locale: 'en-GB',
  31. timezoneId: 'Europe/London',
  32. /* Always collect trace (other values add random test failures) See https://playwright.dev/docs/trace-viewer */
  33. trace: 'on',
  34. viewport: {
  35. width: 1080,
  36. height: 720,
  37. },
  38. video: "on",
  39. },
  40. /* Configure projects for major browsers */
  41. projects: [
  42. {
  43. name: 'mariadb-setup',
  44. testMatch: 'tests/setups/db-setup.ts',
  45. use: { serviceName: "Mariadb" },
  46. teardown: 'mariadb-teardown',
  47. },
  48. {
  49. name: 'mysql-setup',
  50. testMatch: 'tests/setups/db-setup.ts',
  51. use: { serviceName: "Mysql" },
  52. teardown: 'mysql-teardown',
  53. },
  54. {
  55. name: 'postgres-setup',
  56. testMatch: 'tests/setups/db-setup.ts',
  57. use: { serviceName: "Postgres" },
  58. teardown: 'postgres-teardown',
  59. },
  60. {
  61. name: 'sso-setup',
  62. testMatch: 'tests/setups/sso-setup.ts',
  63. teardown: 'sso-teardown',
  64. },
  65. {
  66. name: 'mariadb',
  67. testMatch: 'tests/*.spec.ts',
  68. testIgnore: 'tests/sso_*.spec.ts',
  69. dependencies: ['mariadb-setup'],
  70. },
  71. {
  72. name: 'mysql',
  73. testMatch: 'tests/*.spec.ts',
  74. testIgnore: 'tests/sso_*.spec.ts',
  75. dependencies: ['mysql-setup'],
  76. },
  77. {
  78. name: 'postgres',
  79. testMatch: 'tests/*.spec.ts',
  80. testIgnore: 'tests/sso_*.spec.ts',
  81. dependencies: ['postgres-setup'],
  82. },
  83. {
  84. name: 'sqlite',
  85. testMatch: 'tests/*.spec.ts',
  86. testIgnore: 'tests/sso_*.spec.ts',
  87. },
  88. {
  89. name: 'sso-mariadb',
  90. testMatch: 'tests/sso_*.spec.ts',
  91. dependencies: ['sso-setup', 'mariadb-setup'],
  92. },
  93. {
  94. name: 'sso-mysql',
  95. testMatch: 'tests/sso_*.spec.ts',
  96. dependencies: ['sso-setup', 'mysql-setup'],
  97. },
  98. {
  99. name: 'sso-postgres',
  100. testMatch: 'tests/sso_*.spec.ts',
  101. dependencies: ['sso-setup', 'postgres-setup'],
  102. },
  103. {
  104. name: 'sso-sqlite',
  105. testMatch: 'tests/sso_*.spec.ts',
  106. dependencies: ['sso-setup'],
  107. },
  108. {
  109. name: 'mariadb-teardown',
  110. testMatch: 'tests/setups/db-teardown.ts',
  111. use: { serviceName: "Mariadb" },
  112. },
  113. {
  114. name: 'mysql-teardown',
  115. testMatch: 'tests/setups/db-teardown.ts',
  116. use: { serviceName: "Mysql" },
  117. },
  118. {
  119. name: 'postgres-teardown',
  120. testMatch: 'tests/setups/db-teardown.ts',
  121. use: { serviceName: "Postgres" },
  122. },
  123. {
  124. name: 'sso-teardown',
  125. testMatch: 'tests/setups/sso-teardown.ts',
  126. },
  127. ],
  128. globalSetup: require.resolve('./global-setup'),
  129. });