From ebf70b5b4ab412b4a75af949278b017484a86f44 Mon Sep 17 00:00:00 2001 From: Tomas Zigo Date: Wed, 17 Jul 2024 06:49:33 +0200 Subject: [PATCH] Fix making icons snaphots with custom viewport with size 500x500 --- src/components/__tests__/DrawerMenu.cy.js | 47 ++++++++++++----------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/src/components/__tests__/DrawerMenu.cy.js b/src/components/__tests__/DrawerMenu.cy.js index 7096595ba..62ad467ee 100644 --- a/src/components/__tests__/DrawerMenu.cy.js +++ b/src/components/__tests__/DrawerMenu.cy.js @@ -42,32 +42,35 @@ describe('DrawerMenu', () => { cy.window().then(() => { const drawerMenuIcon = 'drawer-menu-icon'; const drawerBottomMenuIcon = 'drawer-bottom-menu-icon'; + const drawerMenuIconSize = 18; - cy.dataCy(drawerMenuIcon).then(() => { - cy.dataCy(drawerMenuIcon) - .should('be.visible') - .each((element, index) => { - if (index === 0) cy.get(element).click(); - cy.testIcon({ - element: element, - name: `${Cypress.currentTest.titlePath}-drawer-menu-${index}`, - size: 18, - click: false, + cy.viewport(500, 500).then(() => { + cy.dataCy(drawerMenuIcon).then(() => { + cy.dataCy(drawerMenuIcon) + .should('be.visible') + .each((element, index) => { + if (index === 0) cy.get(element).click(); + cy.testIcon({ + element: element, + name: `${Cypress.currentTest.titlePath}-drawer-menu-${index}`, + size: drawerMenuIconSize, + click: false, + }); }); - }); - }); + }); - cy.dataCy(drawerBottomMenuIcon).then(() => { - cy.dataCy(drawerBottomMenuIcon) - .should('be.visible') - .each((element, index) => { - cy.testIcon({ - element: element, - name: `${Cypress.currentTest.titlePath}-drawer-bottom-menu${index}`, - size: 18, - click: false, + cy.dataCy(drawerBottomMenuIcon).then(() => { + cy.dataCy(drawerBottomMenuIcon) + .should('be.visible') + .each((element, index) => { + cy.testIcon({ + element: element, + name: `${Cypress.currentTest.titlePath}-drawer-bottom-menu${index}`, + size: drawerMenuIconSize, + click: false, + }); }); - }); + }); }); }); });