From 5fc146d8ea12442b401115813732b27db5d28f85 Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 20 Dec 2023 11:37:28 -0800 Subject: [PATCH] test(recommendation.cy): reliability hardening to cypress recommendation test --- .../e2e/recommendation/recommendation.cy.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/packages/snap-preact-demo/tests/cypress/e2e/recommendation/recommendation.cy.js b/packages/snap-preact-demo/tests/cypress/e2e/recommendation/recommendation.cy.js index 9ae7b45ad..348296818 100644 --- a/packages/snap-preact-demo/tests/cypress/e2e/recommendation/recommendation.cy.js +++ b/packages/snap-preact-demo/tests/cypress/e2e/recommendation/recommendation.cy.js @@ -123,14 +123,16 @@ describe('Recommendations', () => { it('can click on a result and go to that page', function () { cy.document().then((doc) => { - cy.get(config?.selectors?.recommendation.activeSlide).should('exist'); - let url = doc.querySelector(`${config?.selectors?.recommendation.activeSlide} ${config?.selectors?.recommendation.result} a`).attributes?.href - ?.value; - cy.get(config?.selectors?.recommendation.activeSlide) - .click({ multiple: true }) - .then(() => { - cy.location('pathname').should('include', url); - }); + cy.snapController(config?.selectors?.recommendation.controller).then(({ store }) => { + cy.get(config?.selectors?.recommendation.activeSlide).should('exist'); + let url = doc.querySelector(`${config?.selectors?.recommendation.activeSlide} ${config?.selectors?.recommendation.result} a`).attributes + ?.href?.value; + cy.get(config?.selectors?.recommendation.activeSlide) + .click({ multiple: true }) + .then(() => { + cy.location('pathname').should('include', url); + }); + }); }); }); });