From d1c7d61aba850ebc0ed12c92dbedfe8b5b4c1dc3 Mon Sep 17 00:00:00 2001 From: tnelms1 Date: Tue, 5 Dec 2023 13:34:55 -0700 Subject: [PATCH] SBVT-2201: fixing the top.box issue (#200) * SBVT-2201: fixing the top.box issue * SBVT-2201: fixing the top.box issue * SBVT-2201: fixing an element capture --- commands.js | 15 +++--- .../e2e/test-spec/quick-test_debug.cy.js | 4 +- .../quick-test_element-screenshot.cy.js | 3 +- test/package-lock.json | 54 ++++++++++--------- test/package.json | 2 +- 5 files changed, 41 insertions(+), 37 deletions(-) diff --git a/commands.js b/commands.js index 1d8c71b..19b7f81 100644 --- a/commands.js +++ b/commands.js @@ -234,17 +234,17 @@ let takeScreenshot = (element, name, modifiedOptions, win) => { width: imageData.width } }; - + + // Reset browser to initial state + cy.task('logger', {type: 'trace', message: `After fullpage cy.screenshot('${name}')`}); + win.eval(`window.scrollTo(${initialPageState.scrollX}, ${initialPageState.scrollY})`); + win.eval(`document.body.style.transform='${initialPageState.transform}'`); ensureScrolledToTop(win) captureDom(win); + win.eval(`document.documentElement.style.overflow='${initialPageState.documentOverflow}'`); // Read the new image base64 to blob to be sent to AWS readImageAndBase64ToBlob(); - - // Reset browser to initial state - win.eval(`window.scrollTo(${initialPageState.scrollX}, ${initialPageState.scrollY})`); - win.eval(`document.body.style.transform='${initialPageState.transform}'`); - cy.task('logger', {type: 'trace', message: `After lazyloaded fullpage cy.screenshot('${name}')`}); }); } }); @@ -264,7 +264,7 @@ let takeScreenshot = (element, name, modifiedOptions, win) => { modifiedOptions, ).then(() => { if (vtConfFile.debug) cy.task('copy', {path: picProps.path, imageName, imageType}); - + // ensureScrolledToTop(win) //this creates issues, but this is the JS_SCROLL method captureDom(win); @@ -274,6 +274,7 @@ let takeScreenshot = (element, name, modifiedOptions, win) => { // Reset browser to initial state win.eval(`window.scrollTo(${initialPageState.scrollX}, ${initialPageState.scrollY})`); win.eval(`document.body.style.transform='${initialPageState.transform}'`); + win.eval(`document.documentElement.style.overflow='${initialPageState.documentOverflow}'`); cy.task('logger', {type: 'trace', message: `After lazyloaded fullpage cy.screenshot('${name}')`}); }); } diff --git a/test/cypress/e2e/test-spec/quick-test_debug.cy.js b/test/cypress/e2e/test-spec/quick-test_debug.cy.js index 6a7229c..122d87a 100644 --- a/test/cypress/e2e/test-spec/quick-test_debug.cy.js +++ b/test/cypress/e2e/test-spec/quick-test_debug.cy.js @@ -18,7 +18,9 @@ describe('debug folder test', () => { { scrollMethod: "JS_SCROLL" }); - cy.get(".ud-login-wrapper").sbvtCapture('debug-element'); + cy.get(".ud-login-wrapper").sbvtCapture('debug-element', { + comparisonMode: 'detailed' + }); cy.sbvtCapture("debug-fullpage"); }); }); diff --git a/test/cypress/e2e/test-spec/quick-test_element-screenshot.cy.js b/test/cypress/e2e/test-spec/quick-test_element-screenshot.cy.js index 45ac982..7bdda38 100644 --- a/test/cypress/e2e/test-spec/quick-test_element-screenshot.cy.js +++ b/test/cypress/e2e/test-spec/quick-test_element-screenshot.cy.js @@ -51,8 +51,7 @@ testCases.forEach(currentTestCase => { cy.visit(currentTestCase.url).then(() => { currentTestCase.options ? '' : currentTestCase.options = {} - currentTestCase.options.comparisonMode = 'layout' - currentTestCase.options.sensitivity = 'low' + currentTestCase.options.comparisonMode = 'detailed' cy.wait(1500); if (currentTestCase.actions && currentTestCase.actions.length > 0) { if (currentTestCase.actions[0].action === 'click') { diff --git a/test/package-lock.json b/test/package-lock.json index d391ab3..c9ad8da 100644 --- a/test/package-lock.json +++ b/test/package-lock.json @@ -10,7 +10,7 @@ "license": "ISC", "dependencies": { "@smartbear/visualtest-cypress": "file:..", - "cypress": "^12.0.0", + "cypress": "^13.6.0", "mochawesome": "^7.1.3", "mochawesome-merge": "^4.3.0" } @@ -4890,9 +4890,9 @@ } }, "node_modules/@cypress/request": { - "version": "2.88.12", - "resolved": "https://registry.npmjs.org/@cypress/request/-/request-2.88.12.tgz", - "integrity": "sha512-tOn+0mDZxASFM+cuAP9szGUGPI1HwWVSvdzm7V4cCsPdFTx6qMj29CwaQmRAMIEhORIUBFBsYROYJcveK4uOjA==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@cypress/request/-/request-3.0.1.tgz", + "integrity": "sha512-TWivJlJi8ZDx2wGOw1dbLuHJKUYX7bWySw377nlnGOW3hP9/MUKIsEdXT/YngWxVdgNCHRBmFlBipE+5/2ZZlQ==", "dependencies": { "aws-sign2": "~0.7.0", "aws4": "^1.8.0", @@ -4907,7 +4907,7 @@ "json-stringify-safe": "~5.0.1", "mime-types": "~2.1.19", "performance-now": "^2.1.0", - "qs": "~6.10.3", + "qs": "6.10.4", "safe-buffer": "^5.1.2", "tough-cookie": "^4.1.3", "tunnel-agent": "^0.6.0", @@ -4939,7 +4939,6 @@ "node_modules/@types/node": { "version": "18.18.8", "license": "MIT", - "optional": true, "dependencies": { "undici-types": "~5.26.4" } @@ -5387,9 +5386,9 @@ } }, "node_modules/commander": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz", - "integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz", + "integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==", "engines": { "node": ">= 6" } @@ -5423,14 +5422,14 @@ } }, "node_modules/cypress": { - "version": "12.0.0", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-12.0.0.tgz", - "integrity": "sha512-hX/UeaKrL4uiRxJh+eX9t5YFXJconJyqG0hkFkK6CG+4xj2mMmzvJERF3e2h/9TzvLxPAkQ6cGz8eaHfJZeyGg==", + "version": "13.6.0", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.6.0.tgz", + "integrity": "sha512-quIsnFmtj4dBUEJYU4OH0H12bABJpSujvWexC24Ju1gTlKMJbeT6tTO0vh7WNfiBPPjoIXLN+OUqVtiKFs6SGw==", "hasInstallScript": true, "dependencies": { - "@cypress/request": "^2.88.10", + "@cypress/request": "^3.0.0", "@cypress/xvfb": "^1.2.4", - "@types/node": "^14.14.31", + "@types/node": "^18.17.5", "@types/sinonjs__fake-timers": "8.1.1", "@types/sizzle": "^2.3.2", "arch": "^2.2.0", @@ -5442,10 +5441,10 @@ "check-more-types": "^2.24.0", "cli-cursor": "^3.1.0", "cli-table3": "~0.6.1", - "commander": "^5.1.0", + "commander": "^6.2.1", "common-tags": "^1.8.0", "dayjs": "^1.10.4", - "debug": "^4.3.2", + "debug": "^4.3.4", "enquirer": "^2.3.6", "eventemitter2": "6.4.7", "execa": "4.1.0", @@ -5460,12 +5459,13 @@ "listr2": "^3.8.3", "lodash": "^4.17.21", "log-symbols": "^4.0.0", - "minimist": "^1.2.6", + "minimist": "^1.2.8", "ospath": "^1.2.2", "pretty-bytes": "^5.6.0", + "process": "^0.11.10", "proxy-from-env": "1.0.0", "request-progress": "^3.0.0", - "semver": "^7.3.2", + "semver": "^7.5.3", "supports-color": "^8.1.1", "tmp": "~0.2.1", "untildify": "^4.0.0", @@ -5475,14 +5475,9 @@ "cypress": "bin/cypress" }, "engines": { - "node": "^14.0.0 || ^16.0.0 || >=18.0.0" + "node": "^16.0.0 || ^18.0.0 || >=20.0.0" } }, - "node_modules/cypress/node_modules/@types/node": { - "version": "14.18.63", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.63.tgz", - "integrity": "sha512-fAtCfv4jJg+ExtXhvCkCqUKZ+4ok/JQk01qDKhL5BDDoS3AxKXhV5/MAVUZyQnSEd2GT92fkgZl0pz0Q0AzcIQ==" - }, "node_modules/dashdash": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", @@ -6893,6 +6888,14 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", + "engines": { + "node": ">= 0.6.0" + } + }, "node_modules/prop-types": { "version": "15.8.1", "license": "MIT", @@ -7306,8 +7309,7 @@ }, "node_modules/undici-types": { "version": "5.26.5", - "license": "MIT", - "optional": true + "license": "MIT" }, "node_modules/universalify": { "version": "2.0.0", diff --git a/test/package.json b/test/package.json index 8e03da1..a1b4ebe 100644 --- a/test/package.json +++ b/test/package.json @@ -12,7 +12,7 @@ "license": "ISC", "dependencies": { "@smartbear/visualtest-cypress": "file:..", - "cypress": "^12.0.0", + "cypress": "^13.6.0", "mochawesome": "^7.1.3", "mochawesome-merge": "^4.3.0" }