From 0d333fdc43181dd27dd54afc537cf047ea8f6b0d Mon Sep 17 00:00:00 2001 From: Nikita Barsukov Date: Fri, 4 Oct 2024 16:00:28 +0300 Subject: [PATCH] chore(demo-cypress): improve Cypress snapshots quality --- projects/demo-cypress/cypress.config.ts | 19 ++++++++++++++++++- projects/demo-cypress/project.json | 3 ++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/projects/demo-cypress/cypress.config.ts b/projects/demo-cypress/cypress.config.ts index 30cf708387f49..c5d25df1b7f12 100644 --- a/projects/demo-cypress/cypress.config.ts +++ b/projects/demo-cypress/cypress.config.ts @@ -46,7 +46,24 @@ export default defineConfig({ specPattern: 'src/tests/**/*.cy.ts', experimentalSingleTabRunMode: true, setupNodeEvents(on, config) { - return getCompareSnapshotsPlugin(on, config); + 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; + }); }, }, }); diff --git a/projects/demo-cypress/project.json b/projects/demo-cypress/project.json index 1a73c648cb03e..60448cd21075e 100644 --- a/projects/demo-cypress/project.json +++ b/projects/demo-cypress/project.json @@ -12,7 +12,8 @@ "cypressConfig": "{projectRoot}/cypress.config.ts", "testingType": "component", "skipServe": true, - "devServerTarget": "demo:build" + "devServerTarget": "demo:build", + "browser": "chrome" } } }