mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-14 22:09:29 +02:00

We have added a check in e2e, to ensure events in forks will not trigger the visual tests. This will not protect against malicious users, but there is no other way to support PRs from forks. A proposal has been sent to Argos team to add a secure approach for public repos, fingers crossed.
42 lines
1.4 KiB
TypeScript
42 lines
1.4 KiB
TypeScript
import eyesPlugin from '@applitools/eyes-cypress';
|
|
import { registerArgosTask } from '@argos-ci/cypress/task';
|
|
import coverage from '@cypress/code-coverage/task';
|
|
import { defineConfig } from 'cypress';
|
|
import { addMatchImageSnapshotPlugin } from 'cypress-image-snapshot/plugin';
|
|
import cypressSplit from 'cypress-split';
|
|
|
|
export default eyesPlugin(
|
|
defineConfig({
|
|
projectId: 'n2sma2',
|
|
viewportWidth: 1440,
|
|
viewportHeight: 1024,
|
|
e2e: {
|
|
specPattern: 'cypress/integration/**/*.{js,ts}',
|
|
setupNodeEvents(on, config) {
|
|
coverage(on, config);
|
|
cypressSplit(on, config);
|
|
on('before:browser:launch', (browser, launchOptions) => {
|
|
if (browser.name === 'chrome' && browser.isHeadless) {
|
|
launchOptions.args.push('--window-size=1440,1024', '--force-device-scale-factor=1');
|
|
}
|
|
return launchOptions;
|
|
});
|
|
// copy any needed variables from process.env to config.env
|
|
config.env.useAppli = process.env.USE_APPLI ? true : false;
|
|
config.env.useArgos = !!process.env.CI && !!process.env.ARGOS_TOKEN;
|
|
|
|
if (config.env.useArgos) {
|
|
registerArgosTask(on, config, {
|
|
token: 'argos_cde7ec66b3c53730a7bbe4059a517f4a76',
|
|
});
|
|
} else {
|
|
addMatchImageSnapshotPlugin(on, config);
|
|
}
|
|
// do not forget to return the changed config object!
|
|
return config;
|
|
},
|
|
},
|
|
video: false,
|
|
})
|
|
);
|