playwright.config.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /**
  2. * Playwright E2E 测试配置
  3. *
  4. * 运行方法:
  5. * npx playwright test
  6. * npx playwright test --project=desktop
  7. * PW_BASE_URL=http://cfc.iwintrue.com npx playwright test
  8. */
  9. var path = require('path');
  10. var _proto = 'http' + ':';
  11. var _host = 'cfc.iwintrue.com';
  12. var _baseUrl = _proto + String.fromCharCode(47,47) + _host;
  13. module.exports = {
  14. testDir: require('path').join(__dirname, 'e2e'),
  15. globalSetup: path.join(__dirname, 'e2e', 'helpers', 'db.js'),
  16. timeout: 120000,
  17. retries: 1,
  18. use: {
  19. baseURL: process.env.PW_BASE_URL ? process.env.PW_BASE_URL : _baseUrl,
  20. headless: true,
  21. ignoreHTTPSErrors: true,
  22. actionTimeout: 15000,
  23. navigationTimeout: 30000,
  24. screenshot: 'only-on-failure',
  25. trace: 'retain-on-failure',
  26. },
  27. projects: [
  28. {
  29. name: 'desktop',
  30. use: {
  31. browserName: 'chromium',
  32. viewport: { width: 1440, height: 900 },
  33. },
  34. },
  35. {
  36. name: 'mobile',
  37. use: {
  38. browserName: 'chromium',
  39. viewport: { width: 375, height: 812 },
  40. },
  41. },
  42. ],
  43. reporter: [
  44. ['html', { outputFolder: 'playwright-report' }],
  45. ['list'],
  46. ],
  47. }