diff --git a/cypress/support/pages/yves/product/product-page.ts b/cypress/support/pages/yves/product/product-page.ts index e63218a1..99b55174 100644 --- a/cypress/support/pages/yves/product/product-page.ts +++ b/cypress/support/pages/yves/product/product-page.ts @@ -24,7 +24,21 @@ export class ProductPage extends YvesPage { }; selectSoldByProductOffer = (params: SelectSoldByProductOfferParams): void => { - this.repository.getSoldByProductOfferRadios().check(params.productOfferReference, { force: true }); + this.repository.getSoldByProductOfferRadios().then(($radios) => { + const targetRadio = $radios.filter(`[value="${params.productOfferReference}"]`); + if (targetRadio.length) { + cy.wrap(targetRadio).check(params.productOfferReference, { force: true }); + } else { + cy.url().then((currentUrl) => { + cy.log('Fallback redirect to the product offer page'); + cy.visit( + currentUrl + + '?attribute[selected_merchant_reference_type]=product_offer_reference&attribute[selected_merchant_reference]=' + + params.productOfferReference + ); + }); + } + }); }; createMerchantRelationRequest = (params: CreateMerchantRelationRequestParams): void => { diff --git a/package-lock.json b/package-lock.json index 00d99b5f..1034cbb5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "@faker-js/faker": "^8.4.1", "@typescript-eslint/eslint-plugin": "^6.21.0", "@typescript-eslint/parser": "^6.21.0", - "cypress": "^13.15.2", + "cypress": "^13.17.0", "dotenv": "^16.4.5", "eslint": "^8.57.0", "eslint-plugin-cypress": "^2.15.2", @@ -1746,10 +1746,11 @@ "license": "MIT" }, "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, + "license": "MIT", "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", @@ -1760,9 +1761,9 @@ } }, "node_modules/cypress": { - "version": "13.15.2", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.15.2.tgz", - "integrity": "sha512-ARbnUorjcCM3XiPwgHKuqsyr5W9Qn+pIIBPaoilnoBkLdSC2oLQjV1BUpnmc7KR+b7Avah3Ly2RMFnfxr96E/A==", + "version": "13.17.0", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.17.0.tgz", + "integrity": "sha512-5xWkaPurwkIljojFidhw8lFScyxhtiFHl/i/3zov+1Z5CmY4t9tjIdvSXfu82Y3w7wt0uR9KkucbhkVvJZLQSA==", "dev": true, "hasInstallScript": true, "license": "MIT", @@ -3268,10 +3269,11 @@ } }, "node_modules/micromatch": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.7.tgz", - "integrity": "sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q==", + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", "dev": true, + "license": "MIT", "dependencies": { "braces": "^3.0.3", "picomatch": "^2.3.1" diff --git a/package.json b/package.json index d71993fd..fcb9b779 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "@faker-js/faker": "^8.4.1", "@typescript-eslint/eslint-plugin": "^6.21.0", "@typescript-eslint/parser": "^6.21.0", - "cypress": "^13.15.2", + "cypress": "^13.17.0", "dotenv": "^16.4.5", "eslint": "^8.57.0", "eslint-plugin-cypress": "^2.15.2",