playwright.config.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. // @ts-check
  2. const { defineConfig, devices } = require("@playwright/test");
  3. const path = require("path");
  4. /**
  5. * Read environment variables from file.
  6. * https://github.com/motdotla/dotenv
  7. */
  8. // require('dotenv').config();
  9. /**
  10. * @see https://playwright.dev/docs/test-configuration
  11. */
  12. module.exports = defineConfig({
  13. testDir: ".",
  14. /* Run tests in files in parallel */
  15. fullyParallel: true,
  16. /* Fail the build on CI if you accidentally left test.only in the source code. */
  17. forbidOnly: !!process.env.CI,
  18. /* Retry on CI only */
  19. retries: process.env.CI ? 2 : 0,
  20. /* Opt out of parallel tests on CI. */
  21. workers: process.env.CI ? 1 : undefined,
  22. /* Reporter to use. See https://playwright.dev/docs/test-reporters */
  23. reporter: "html",
  24. /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
  25. use: {
  26. /* Base URL to use in actions like `await page.goto('/')`. */
  27. // baseURL: 'http://127.0.0.1:3000',
  28. /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
  29. trace: "on-first-retry",
  30. },
  31. /* Configure projects for major browsers */
  32. projects: [
  33. {
  34. name: "chromium",
  35. use: { ...devices["Desktop Chrome"] },
  36. },
  37. // {
  38. // name: 'firefox',
  39. // use: { ...devices['Desktop Firefox'] },
  40. // },
  41. // {
  42. // name: 'webkit',
  43. // use: { ...devices['Desktop Safari'] },
  44. // },
  45. /* Test against mobile viewports. */
  46. // {
  47. // name: 'Mobile Chrome',
  48. // use: { ...devices['Pixel 5'] },
  49. // },
  50. // {
  51. // name: 'Mobile Safari',
  52. // use: { ...devices['iPhone 12'] },
  53. // },
  54. /* Test against branded browsers. */
  55. // {
  56. // name: 'Microsoft Edge',
  57. // use: { ...devices['Desktop Edge'], channel: 'msedge' },
  58. // },
  59. // {
  60. // name: 'Google Chrome',
  61. // use: { ..devices['Desktop Chrome'], channel: 'chrome' },
  62. // },
  63. ],
  64. /* Run your local dev server before starting the tests */
  65. webServer: [
  66. {
  67. command:
  68. "cargo run --package dioxus-playwright-liveview-test --bin dioxus-playwright-liveview-test",
  69. port: 3030,
  70. timeout: 50 * 60 * 1000,
  71. reuseExistingServer: !process.env.CI,
  72. stdout: "pipe",
  73. },
  74. {
  75. cwd: path.join(process.cwd(), "web"),
  76. command:
  77. 'cargo run --package dioxus-cli --release -- serve --addr "127.0.0.1" --port 9999',
  78. port: 9999,
  79. timeout: 50 * 60 * 1000,
  80. reuseExistingServer: !process.env.CI,
  81. stdout: "pipe",
  82. },
  83. {
  84. cwd: path.join(process.cwd(), "static-generation"),
  85. command:
  86. 'cargo run --package dioxus-cli --release -- serve --force-sequential --platform static-generation --addr "127.0.0.1" --port 2222',
  87. port: 2222,
  88. timeout: 50 * 60 * 1000,
  89. reuseExistingServer: !process.env.CI,
  90. stdout: "pipe",
  91. },
  92. {
  93. cwd: path.join(process.cwd(), "fullstack"),
  94. command:
  95. 'cargo run --package dioxus-cli --release -- serve --force-sequential --platform fullstack --addr "127.0.0.1" --port 3333',
  96. port: 3333,
  97. timeout: 50 * 60 * 1000,
  98. reuseExistingServer: !process.env.CI,
  99. stdout: "pipe",
  100. },
  101. {
  102. cwd: path.join(process.cwd(), "suspense-carousel"),
  103. command:
  104. 'cargo run --package dioxus-cli --release -- serve --force-sequential --platform fullstack --addr "127.0.0.1" --port 4040',
  105. port: 4040,
  106. timeout: 50 * 60 * 1000,
  107. reuseExistingServer: !process.env.CI,
  108. stdout: "pipe",
  109. },
  110. {
  111. cwd: path.join(process.cwd(), "nested-suspense"),
  112. command:
  113. 'cargo run --package dioxus-cli --release -- serve --force-sequential --platform fullstack --addr "127.0.0.1" --port 5050',
  114. port: 5050,
  115. timeout: 50 * 60 * 1000,
  116. reuseExistingServer: !process.env.CI,
  117. stdout: "pipe",
  118. },
  119. ],
  120. });