Skip to content

Commit

Permalink
Merge pull request #670 from Synthetixio/configrefactor
Browse files Browse the repository at this point in the history
♻️  hooks
  • Loading branch information
drptbl authored Mar 9, 2023
2 parents 2255b17 + 318e78a commit fc60224
Showing 1 changed file with 11 additions and 19 deletions.
30 changes: 11 additions & 19 deletions plugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,25 @@ module.exports = (on, config) => {
// `config` is the resolved Cypress config

on('before:browser:launch', async (browser = {}, arguments_) => {
if (browser.name === 'chrome' && browser.isHeadless) {
console.log('TRUE'); // required by cypress ¯\_(ツ)_/¯
arguments_.args.push('--window-size=1920,1080');
return arguments_;
}

if (browser.name === 'electron') {
arguments_['width'] = 1920;
arguments_['height'] = 1080;
arguments_['resizable'] = false;
return arguments_;
}

// metamask welcome screen blocks cypress from loading
if (browser.name === 'chrome') {
// metamask welcome screen blocks cypress from loading
arguments_.args.push(
'--disable-background-timer-throttling',
'--disable-backgrounding-occluded-windows',
'--disable-renderer-backgrounding',
);
if (process.env.CI) {
// Avoid: "dri3 extension not supported" error
arguments_.args.push('--disable-gpu');
}
if (process.env.HEADLESS_MODE) {
arguments_.args.push('--headless=new');
}
if (browser.isHeadless) {
arguments_.args.push('--window-size=1920,1080');
}
}

if (browser.name === 'chrome' && process.env.CI)
arguments_.args.push('--disable-gpu'); // Avoid: "dri3 extension not supported" error

if (!process.env.SKIP_METAMASK_INSTALL) {
// NOTE: extensions cannot be loaded in headless Chrome
const metamaskPath = await helpers.prepareMetamask(
Expand All @@ -45,8 +39,6 @@ module.exports = (on, config) => {
arguments_.extensions.push(metamaskPath);
}

if (process.env.HEADLESS_MODE) arguments_.args.push('--headless=new');

return arguments_;
});

Expand Down

0 comments on commit fc60224

Please sign in to comment.