playwright.config.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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: 10 * 60 * 1000,
  71. reuseExistingServer: !process.env.CI,
  72. stdout: "pipe",
  73. },
  74. {
  75. cwd: path.join(process.cwd(), "web"),
  76. command: "cargo run --package dioxus-cli -- serve",
  77. port: 8080,
  78. timeout: 10 * 60 * 1000,
  79. reuseExistingServer: !process.env.CI,
  80. stdout: "pipe",
  81. },
  82. {
  83. cwd: path.join(process.cwd(), 'fullstack'),
  84. command: 'cargo run --package dioxus-cli -- build --features web --release && cargo run --release --features ssr',
  85. port: 3333,
  86. timeout: 10 * 60 * 1000,
  87. reuseExistingServer: !process.env.CI,
  88. stdout: "pipe",
  89. },
  90. ],
  91. });