Skip to content

Commit

Permalink
chore(demo-cypress): improve Cypress snapshots quality
Browse files Browse the repository at this point in the history
  • Loading branch information
nsbarsukov committed Oct 4, 2024
1 parent 56d4a18 commit ce1d647
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
21 changes: 20 additions & 1 deletion projects/demo-cypress/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,26 @@ export default defineConfig({
specPattern: 'src/tests/**/*.cy.ts',
experimentalSingleTabRunMode: true,
setupNodeEvents(on, config) {
return getCompareSnapshotsPlugin(on, config);
const updatedConfigs = getCompareSnapshotsPlugin(on, config);

on('before:browser:launch', (browser, launchOptions) => {
if (browser.name === 'chrome') {
launchOptions.args.push(
'--font-render-hinting=none', // prevent inconsistent text rendering in headless mode
'--force-device-scale-factor=2', // force screen to be retina
'--high-dpi-support=1',
'--force-prefers-reduced-motion',
'--force-color-profile=srgb',
'--disable-dev-shm-usage',
'--disable-gpu',
'--incognito',
);
}

return launchOptions;
});

return updatedConfigs;
},
},
});
3 changes: 2 additions & 1 deletion projects/demo-cypress/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"cypressConfig": "{projectRoot}/cypress.config.ts",
"testingType": "component",
"skipServe": true,
"devServerTarget": "demo:build"
"devServerTarget": "demo:build",
"browser": "chrome"
}
}
}
Expand Down

0 comments on commit ce1d647

Please sign in to comment.