Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

1.1 KB
Raw Blame
const { defineConfig } = require("cypress");

const { defaultConfig } = require("../support/config");

const viewportWidth = 1600;
const viewportHeight = 1200;

module.exports = defineConfig({
  e2e: {
    ...defaultConfig,
    specPattern: "e2e/cross-version/latest/**/*.cy.spec.ts",
    viewportWidth,
    viewportHeight,
    setupNodeEvents(on, config) {
      // Call the default setupNodeEvents first
      defaultConfig.setupNodeEvents(on, config);

      // Set browser window size for headless mode to match viewport
      on("before:browser:launch", (browser, launchOptions) => {
        if (
          (browser.name === "chrome" || browser.name === "chromium") &&
          browser.isHeadless
        ) {
          launchOptions.args.push(
            `--window-size=${viewportWidth},${viewportHeight}`,
          );
        }

        if (browser.name === "electron" && browser.isHeadless) {
          launchOptions.preferences.width = viewportWidth;
          launchOptions.preferences.height = viewportHeight;
        }

        return launchOptions;
      });

      return config;
    },
  },
});