1
0

playwright.config.js 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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 -- serve --force-sequential --platform web --addr "127.0.0.1" --port 9999',
  81. port: 9999,
  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 -- serve --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 -- serve --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 -- serve --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 -- serve --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 -- serve --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 -- serve --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. // currently disabled - we want ssg to be a "bundle" feature, not a serve feature.
  141. // {
  142. // cwd: path.join(process.cwd(), "nested-suspense"),
  143. // command:
  144. // 'cargo run --package dioxus-cli --release -- serve --bin nested-suspense-ssg --force-sequential --platform web --ssg --addr "127.0.0.1" --port 6060',
  145. // port: 6060,
  146. // timeout: 50 * 60 * 1000,
  147. // reuseExistingServer: !process.env.CI,
  148. // stdout: "pipe",
  149. // },
  150. {
  151. cwd: path.join(process.cwd(), "cli-optimization"),
  152. // Remove the cache folder for the cli-optimization build to force a full cache reset
  153. command:
  154. 'cargo run --package dioxus-cli --release --features optimizations -- serve --addr "127.0.0.1" --port 8989',
  155. port: 8989,
  156. timeout: 50 * 60 * 1000,
  157. reuseExistingServer: !process.env.CI,
  158. stdout: "pipe",
  159. },
  160. {
  161. cwd: path.join(process.cwd(), "wasm-split-harness"),
  162. command:
  163. 'cargo run --package dioxus-cli --release --features optimizations -- serve --bin wasm-split-harness --platform web --addr "127.0.0.1" --port 8001 --wasm-split --profile wasm-split-release',
  164. port: 8001,
  165. timeout: 50 * 60 * 1000,
  166. reuseExistingServer: !process.env.CI,
  167. stdout: "pipe",
  168. },
  169. {
  170. cwd: path.join(process.cwd(), "default-features-disabled"),
  171. command:
  172. 'cargo run --package dioxus-cli --release -- serve --force-sequential --addr "127.0.0.1" --port 8002',
  173. port: 8002,
  174. timeout: 50 * 60 * 1000,
  175. reuseExistingServer: !process.env.CI,
  176. stdout: "pipe",
  177. },
  178. {
  179. cwd: path.join(process.cwd(), "barebones-template"),
  180. command:
  181. 'cargo run --package dioxus-cli --release -- serve --force-sequential --addr "127.0.0.1" --port 8123',
  182. port: 8123,
  183. timeout: 50 * 60 * 1000,
  184. reuseExistingServer: !process.env.CI,
  185. stdout: "pipe",
  186. },
  187. ],
  188. });