From 4969dcee94a3a0a5908b8456888b8e459bf1333d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=CC=8Cimon=20Macek?= Date: Thu, 27 Jun 2024 09:21:29 +0200 Subject: [PATCH] cleanup unnecessary command --- src/components/homepage/BannerRoutes.vue | 3 +- test/cypress/support/commands.js | 45 +++++++++--------------- 2 files changed, 19 insertions(+), 29 deletions(-) diff --git a/src/components/homepage/BannerRoutes.vue b/src/components/homepage/BannerRoutes.vue index 0b57b1993..fff0d8564 100644 --- a/src/components/homepage/BannerRoutes.vue +++ b/src/components/homepage/BannerRoutes.vue @@ -88,10 +88,11 @@ export default defineComponent({ > diff --git a/test/cypress/support/commands.js b/test/cypress/support/commands.js index fe110859c..880247a17 100644 --- a/test/cypress/support/commands.js +++ b/test/cypress/support/commands.js @@ -126,18 +126,6 @@ Cypress.Commands.add('setDPR', (dpr) => { }); }); -/** - * Custom waitForFonts command that waits for all fonts to be loaded. - * Used in combination with `waitForStylesheets` in `testIcon` command. - */ -Cypress.Commands.add('waitForFonts', () => { - cy.document().then((document) => { - document.fonts.ready.then(() => { - cy.log('All fonts loaded'); - }); - }); -}); - /** * Custom waitForStylesheets command that waits for all stylesheets to be loaded * Used in combination with `waitForFonts` in `testIcon` command. @@ -175,22 +163,23 @@ Cypress.Commands.add('testIcon', ({ element, name, size }) => { cy.clock(now); // set DPR and wait for resources (to avoid empty snapshot) cy.setDPR(1); - cy.waitForFonts(); - cy.waitForStylesheets(); - // remove scrollbar - cy.wrap(element[0]).invoke('attr', 'style', 'overflow: hidden'); - // size - cy.wrap(element[0]).invoke('width').should('eq', size); - cy.wrap(element[0]).invoke('height').should('eq', size); - // snapshot - cy.wrap(element[0]).matchImageSnapshot(name, { - failureThreshold: 0.1, - failureThresholdType: 'percent', - timeout: 1000, - customDiffConfig: { threshold: 0.4 }, - screenshotsFolder: 'test/cypress/snapshots', - retries: 2, - }); + + cy.document() + .then(() => cy.waitForStylesheets()) + .then(() => { + // size + cy.wrap(element[0]).invoke('width').should('eq', size); + cy.wrap(element[0]).invoke('height').should('eq', size); + // snapshot + cy.wrap(element[0]).matchImageSnapshot(name, { + failureThreshold: 0.1, + failureThresholdType: 'percent', + timeout: 1000, + customDiffConfig: { threshold: 0.4 }, + screenshotsFolder: 'test/cypress/snapshots', + retries: 2, + }); + }); }); Cypress.Commands.add('testMessageLanguageSelect', (i18n) => {