Skip to content

Commit

Permalink
Fix making icons snaphots with custom viewport with size 500x500
Browse files Browse the repository at this point in the history
  • Loading branch information
tmszi committed Jul 17, 2024
1 parent ce25720 commit e77a568
Showing 1 changed file with 25 additions and 22 deletions.
47 changes: 25 additions & 22 deletions src/components/__tests__/DrawerMenu.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
});
});
});
});
});
});
Expand Down

0 comments on commit e77a568

Please sign in to comment.