ohif-viewer/platform/viewer/cypress/plugins/index.js
Mirna Silva dea0ceab57 test: Adding Percy Snapshot on VTK, PDF and Microscopy tests (#1059)
* Adding Percy Snapshot on VTK, PDF and Microscopy tests

* Small improvement to always click on first search result

* Wait for search result

* Added timouts all over the code to avoid intermitted failures in CI

* Increasing Default Timeout and other configs

* Cleaning up the code

* try force enabling gpu

* Try custom executor with newer version of chrome

* Fix based on review comments

* Increased minimum thumbnails expected on VTK test

* Fix config validation

* Make sure we're using the chrome browser
2019-10-21 14:30:50 -04:00

36 lines
1.2 KiB
JavaScript

// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************
let percyHealthCheck = require('@percy/cypress/task');
// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
on('before:browser:launch', (browser = {}, args) => {
if (browser.name === 'chrome') {
// `args` is an araay of all the arguments
// that will be passed to Chrome when it launchers
args.push('--start-fullscreen');
// whatever you return here becomes the new args
return args;
}
if (browser.name === 'chromium') {
const newArgs = args.filter(arg => arg !== '--disable-gpu');
newArgs.push('--ignore-gpu-blacklist');
return newArgs;
}
});
on('task', percyHealthCheck);
};