Skip to content

Commit

Permalink
SBVT-2201: fixing the top.box issue (#200)
Browse files Browse the repository at this point in the history
* SBVT-2201: fixing the top.box issue

* SBVT-2201: fixing the top.box issue

* SBVT-2201: fixing an element capture
  • Loading branch information
tnelms1 authored Dec 5, 2023
1 parent 20ad3f8 commit d1c7d61
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 37 deletions.
15 changes: 8 additions & 7 deletions commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}')`});
});
}
});
Expand All @@ -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);

Expand All @@ -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}')`});
});
}
Expand Down
4 changes: 3 additions & 1 deletion test/cypress/e2e/test-spec/quick-test_debug.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down
54 changes: 28 additions & 26 deletions test/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down

0 comments on commit d1c7d61

Please sign in to comment.