1
0

playwright.config.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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: './playwrite-tests',
  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: 'cargo run --package dioxus-playwrite-liveview-test --bin dioxus-playwrite-liveview-test',
  68. port: 3030,
  69. timeout: 10 * 60 * 1000,
  70. reuseExistingServer: !process.env.CI,
  71. stdout: "pipe",
  72. },
  73. {
  74. cwd: path.join(process.cwd(), 'playwrite-tests', 'web'),
  75. command: 'dioxus serve',
  76. port: 8080,
  77. timeout: 10 * 60 * 1000,
  78. reuseExistingServer: !process.env.CI,
  79. stdout: "pipe",
  80. },
  81. {
  82. cwd: path.join(process.cwd(), 'playwrite-tests', 'fullstack'),
  83. command: 'dioxus build --features web\ncargo run --release --features ssr --no-default-features',
  84. port: 3333,
  85. timeout: 10 * 60 * 1000,
  86. reuseExistingServer: !process.env.CI,
  87. stdout: "pipe",
  88. }
  89. ],
  90. });