From e0fef7eada3d25475901e8132b3c92436848d75e Mon Sep 17 00:00:00 2001 From: Pippo Raimondi Date: Fri, 19 Nov 2021 08:28:01 +0000 Subject: [PATCH 1/2] fix: ensure viewport is read as a number rather than a string --- src/command.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/command.js b/src/command.js index b65fd8a..da56e12 100644 --- a/src/command.js +++ b/src/command.js @@ -3,8 +3,8 @@ const compareSnapshotCommand = defaultScreenshotOptions => { const width = process.env.WIDTH || '1980' // Force screenshot resolution to keep consistency of test runs across machines - Cypress.config('viewportHeight', height) - Cypress.config('viewportWidth', width) + Cypress.config('viewportHeight', parseInt(height)) + Cypress.config('viewportWidth', parseInt(width)) Cypress.Commands.add( 'compareSnapshot', From 7e9dc8a8cc55ddf94d9c28d32afaf0aa33af7865 Mon Sep 17 00:00:00 2001 From: Pippo Raimondi Date: Fri, 19 Nov 2021 08:36:38 +0000 Subject: [PATCH 2/2] fix lint --- src/command.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/command.js b/src/command.js index da56e12..d51e756 100644 --- a/src/command.js +++ b/src/command.js @@ -3,8 +3,8 @@ const compareSnapshotCommand = defaultScreenshotOptions => { const width = process.env.WIDTH || '1980' // Force screenshot resolution to keep consistency of test runs across machines - Cypress.config('viewportHeight', parseInt(height)) - Cypress.config('viewportWidth', parseInt(width)) + Cypress.config('viewportHeight', parseInt(height, 10)) + Cypress.config('viewportWidth', parseInt(width, 10)) Cypress.Commands.add( 'compareSnapshot',