github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/cypress/plugins/index.ts (about)

     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  
    12  // This function is called when a project is opened or re-opened (e.g. due to
    13  // the project's config changing)
    14  import { addMatchImageSnapshotPlugin } from 'cypress-image-snapshot/plugin';
    15  
    16  /**
    17   * @type {Cypress.PluginConfig}
    18   */
    19  // eslint-disable-next-line no-unused-vars
    20  module.exports = (on, config) => {
    21    // `on` is used to hook into various events Cypress emits
    22    // `config` is the resolved Cypress config
    23    addMatchImageSnapshotPlugin(on, config);
    24  
    25    // force color profile
    26    on('before:browser:launch', (browser = {}, launchOptions) => {
    27      if (browser.family === 'chromium' && browser.name !== 'electron') {
    28        launchOptions.args.push('--force-color-profile=srgb');
    29      }
    30    });
    31  
    32    return config;
    33  };