index.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. /// <reference types="cypress" />
  2. // ***********************************************************
  3. // This example plugins/index.js can be used to load plugins
  4. //
  5. // You can change the location of this file or turn off loading
  6. // the plugins file with the 'pluginsFile' configuration option.
  7. //
  8. // You can read more here:
  9. // https://on.cypress.io/plugins-guide
  10. // ***********************************************************
  11. // This function is called when a project is opened or re-opened (e.g. due to
  12. // the project's config changing)
  13. /**
  14. * @type {Cypress.PluginConfig}
  15. */
  16. // eslint-disable-next-line no-unused-vars
  17. module.exports = (on, config) => {
  18. // `on` is used to hook into various events Cypress emits
  19. // `config` is the resolved Cypress config
  20. // change screen size
  21. // see: https://docs.cypress.io/api/plugins/browser-launch-api#Set-screen-size-when-running-headless
  22. on('before:browser:launch', (browser, launchOptions) => {
  23. if (browser.name === 'chrome' && browser.isHeadless) {
  24. launchOptions.args.push('--window-size=1400,1024')
  25. launchOptions.args.push('--force-device-scale-factor=1')
  26. }
  27. return launchOptions
  28. })
  29. }