From c66db9ae09b79a4624696095b3f935461ac2a87b Mon Sep 17 00:00:00 2001 From: Frederik Rommel Date: Sat, 20 Apr 2024 03:30:34 +0200 Subject: [PATCH] fix cypress test --- .../app/storefront/cypress/commands/sales-channel.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/Resources/app/storefront/cypress/commands/sales-channel.js b/src/Resources/app/storefront/cypress/commands/sales-channel.js index 355fa0e5..1fb3abc8 100644 --- a/src/Resources/app/storefront/cypress/commands/sales-channel.js +++ b/src/Resources/app/storefront/cypress/commands/sales-channel.js @@ -77,14 +77,12 @@ Cypress.Commands.add('allowCurrencyForSalesChannel', (isoCode) => { }) }).then(() => { cy.visit('/'); // navigate to home, to make sure dropdown is visible - cy.get('.top-bar .currencies-menu').should($el => { - if ($el.length === 0) { - // if not exist, the currency is already selected, because it is the default - return; + cy.get('body').then($body => { + if ($body.find('.top-bar .currencies-menu').length) { + cy.get('.top-bar .currencies-menu > .dropdown-toggle').click(); + cy.get('.top-bar .currencies-menu [title="' + isoCode + '"]').click(); } - cy.get('.top-bar .currencies-menu > .dropdown-toggle').click(); - cy.get('.top-bar .currencies-menu [title="' + isoCode + '"]').click(); - }) + }); }) });