playwright.config.js 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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. // Increase the timeout for navigations to give dx time to build the project
  31. navigationTimeout: 50 * 60 * 1000,
  32. },
  33. timeout: 50 * 60 * 1000,
  34. /* Configure projects for major browsers */
  35. projects: [
  36. {
  37. name: "chromium",
  38. use: { ...devices["Desktop Chrome"] },
  39. },
  40. // {
  41. // name: 'firefox',
  42. // use: { ...devices['Desktop Firefox'] },
  43. // },
  44. // {
  45. // name: 'webkit',
  46. // use: { ...devices['Desktop Safari'] },
  47. // },
  48. /* Test against mobile viewports. */
  49. // {
  50. // name: 'Mobile Chrome',
  51. // use: { ...devices['Pixel 5'] },
  52. // },
  53. // {
  54. // name: 'Mobile Safari',
  55. // use: { ...devices['iPhone 12'] },
  56. // },
  57. /* Test against branded browsers. */
  58. // {
  59. // name: 'Microsoft Edge',
  60. // use: { ...devices['Desktop Edge'], channel: 'msedge' },
  61. // },
  62. // {
  63. // name: 'Google Chrome',
  64. // use: { ..devices['Desktop Chrome'], channel: 'chrome' },
  65. // },
  66. ],
  67. /* Run your local dev server before starting the tests */
  68. webServer: [
  69. {
  70. command:
  71. "cargo run --package dioxus-playwright-liveview-test --bin dioxus-playwright-liveview-test",
  72. port: 3030,
  73. timeout: 50 * 60 * 1000,
  74. reuseExistingServer: !process.env.CI,
  75. stdout: "pipe",
  76. },
  77. {
  78. cwd: path.join(process.cwd(), "web"),
  79. command:
  80. 'cargo run --package dioxus-cli --release -- run --verbose --force-sequential --platform web --addr "127.0.0.1" --port 9990',
  81. port: 9990,
  82. timeout: 50 * 60 * 1000,
  83. reuseExistingServer: !process.env.CI,
  84. stdout: "pipe",
  85. },
  86. {
  87. cwd: path.join(process.cwd(), "web-routing"),
  88. command:
  89. 'cargo run --package dioxus-cli --release -- run --verbose --force-sequential --platform web --addr "127.0.0.1" --port 2020',
  90. port: 2020,
  91. timeout: 50 * 60 * 1000,
  92. reuseExistingServer: !process.env.CI,
  93. stdout: "pipe",
  94. },
  95. {
  96. cwd: path.join(process.cwd(), "fullstack"),
  97. command:
  98. 'cargo run --package dioxus-cli --release -- run --verbose --force-sequential --platform web --addr "127.0.0.1" --port 3333',
  99. port: 3333,
  100. timeout: 50 * 60 * 1000,
  101. reuseExistingServer: !process.env.CI,
  102. stdout: "pipe",
  103. },
  104. {
  105. cwd: path.join(process.cwd(), "fullstack-mounted"),
  106. command:
  107. 'cargo run --package dioxus-cli --release -- run --verbose --force-sequential --platform web --addr "127.0.0.1" --port 7777',
  108. port: 7777,
  109. timeout: 50 * 60 * 1000,
  110. reuseExistingServer: !process.env.CI,
  111. stdout: "pipe",
  112. },
  113. {
  114. cwd: path.join(process.cwd(), "fullstack-routing"),
  115. command:
  116. 'cargo run --package dioxus-cli --release -- run --verbose --force-sequential --platform web --addr "127.0.0.1" --port 8888',
  117. port: 8888,
  118. timeout: 50 * 60 * 1000,
  119. reuseExistingServer: !process.env.CI,
  120. stdout: "pipe",
  121. },
  122. {
  123. cwd: path.join(process.cwd(), "suspense-carousel"),
  124. command:
  125. 'cargo run --package dioxus-cli --release -- run --verbose --force-sequential --platform web --addr "127.0.0.1" --port 4040',
  126. port: 4040,
  127. timeout: 50 * 60 * 1000,
  128. reuseExistingServer: !process.env.CI,
  129. stdout: "pipe",
  130. },
  131. {
  132. cwd: path.join(process.cwd(), "nested-suspense"),
  133. command:
  134. 'cargo run --package dioxus-cli --release -- run --verbose --force-sequential --platform web --addr "127.0.0.1" --port 5050',
  135. port: 5050,
  136. timeout: 50 * 60 * 1000,
  137. reuseExistingServer: !process.env.CI,
  138. stdout: "pipe",
  139. },
  140. {
  141. cwd: path.join(process.cwd(), "nested-suspense"),
  142. command:
  143. 'cargo run --package dioxus-cli --release -- run --verbose --bin nested-suspense-ssg --force-sequential --platform web --ssg --addr "127.0.0.1" --port 6060',
  144. port: 6060,
  145. timeout: 50 * 60 * 1000,
  146. reuseExistingServer: !process.env.CI,
  147. stdout: "pipe",
  148. },
  149. {
  150. cwd: path.join(process.cwd(), "cli-optimization"),
  151. // Remove the cache folder for the cli-optimization build to force a full cache reset
  152. command:
  153. 'cargo run --package dioxus-cli --release -- run --verbose --addr "127.0.0.1" --port 8989',
  154. port: 8989,
  155. timeout: 50 * 60 * 1000,
  156. reuseExistingServer: !process.env.CI,
  157. stdout: "pipe",
  158. },
  159. {
  160. cwd: path.join(process.cwd(), "wasm-split-harness"),
  161. command:
  162. 'cargo run --package dioxus-cli --release -- run --verbose --bin wasm-split-harness --platform web --addr "127.0.0.1" --port 8001 --wasm-split --profile wasm-split-release',
  163. port: 8001,
  164. timeout: 50 * 60 * 1000,
  165. reuseExistingServer: !process.env.CI,
  166. stdout: "pipe",
  167. },
  168. {
  169. cwd: path.join(process.cwd(), "default-features-disabled"),
  170. command:
  171. 'cargo run --package dioxus-cli --release -- run --verbose --force-sequential --addr "127.0.0.1" --port 8002',
  172. port: 8002,
  173. timeout: 50 * 60 * 1000,
  174. reuseExistingServer: !process.env.CI,
  175. stdout: "pipe",
  176. },
  177. {
  178. cwd: path.join(process.cwd(), "barebones-template"),
  179. command:
  180. 'cargo run --package dioxus-cli --release -- run --verbose --force-sequential --addr "127.0.0.1" --port 8123',
  181. port: 8123,
  182. timeout: 50 * 60 * 1000,
  183. reuseExistingServer: !process.env.CI,
  184. stdout: "pipe",
  185. },
  186. ],
  187. });