cypress.config.ts 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing,
  13. * software distributed under the License is distributed on an
  14. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  15. * KIND, either express or implied. See the License for the
  16. * specific language governing permissions and limitations
  17. * under the License.
  18. */
  19. // eslint-disable-next-line import/no-extraneous-dependencies
  20. import { defineConfig } from 'cypress';
  21. import eyesPlugin from '@applitools/eyes-cypress';
  22. const { verifyDownloadTasks } = require('cy-verify-downloads');
  23. export default eyesPlugin(
  24. defineConfig({
  25. chromeWebSecurity: false,
  26. defaultCommandTimeout: 8000,
  27. numTestsKeptInMemory: 3,
  28. // Disabled after realizing this MESSES UP rison encoding in intricate ways
  29. experimentalFetchPolyfill: false,
  30. experimentalMemoryManagement: true,
  31. requestTimeout: 10000,
  32. video: false,
  33. viewportWidth: 1280,
  34. viewportHeight: 1024,
  35. projectId: 'ud5x2f',
  36. retries: {
  37. runMode: 2,
  38. openMode: 0,
  39. },
  40. e2e: {
  41. // We've imported your old cypress plugins here.
  42. // You may want to clean this up later by importing these.
  43. setupNodeEvents(on, config) {
  44. // ECONNRESET on Chrome/Chromium 117.0.5851.0 when using Cypress <12.15.0
  45. // Check https://github.com/cypress-io/cypress/issues/27804 for context
  46. // TODO: This workaround should be removed when upgrading Cypress
  47. on('before:browser:launch', (browser, launchOptions) => {
  48. if (browser.name === 'chrome' && browser.isHeadless) {
  49. // eslint-disable-next-line no-param-reassign
  50. launchOptions.args = launchOptions.args.map(arg => {
  51. if (arg === '--headless') {
  52. return '--headless=new';
  53. }
  54. return arg;
  55. });
  56. launchOptions.args.push(
  57. '--disable-dev-shm-usage',
  58. '--disable-gpu',
  59. '--no-sandbox',
  60. '--disable-software-rasterizer',
  61. '--memory-pressure-off',
  62. '--js-flags=--max-old-space-size=4096',
  63. '--disable-background-timer-throttling',
  64. '--disable-backgrounding-occluded-windows',
  65. '--disable-renderer-backgrounding',
  66. );
  67. }
  68. return launchOptions;
  69. });
  70. // eslint-disable-next-line global-require
  71. require('@cypress/code-coverage/task')(on, config);
  72. on('task', verifyDownloadTasks);
  73. // eslint-disable-next-line global-require,import/extensions
  74. return config;
  75. },
  76. baseUrl: 'http://localhost:8088',
  77. excludeSpecPattern: [],
  78. experimentalRunAllSpecs: true,
  79. specPattern: [
  80. 'cypress/e2e/**/*.{js,jsx,ts,tsx}',
  81. 'cypress/applitools/**/*.{js,jsx,ts,tsx}',
  82. ],
  83. },
  84. }),
  85. );