From ce1d647ebf29faeb7b235fe33fb1e14774c424ed 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 | 21 ++++++++++++++++++++- projects/demo-cypress/project.json | 3 ++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/projects/demo-cypress/cypress.config.ts b/projects/demo-cypress/cypress.config.ts index 30cf708387f49..bb01454f0442d 100644 --- a/projects/demo-cypress/cypress.config.ts +++ b/projects/demo-cypress/cypress.config.ts @@ -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; }, }, }); 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" } } }