Skip to content

Commit

Permalink
Merge pull request #1141 from searchspring/bundletestingfix
Browse files Browse the repository at this point in the history
test(preact-components/bundlerecs): adjusting e2e tests
  • Loading branch information
korgon authored Aug 21, 2024
2 parents d7fcff2 + 03aa015 commit 299c7c8
Showing 1 changed file with 16 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,45 +78,37 @@ describe('BundledRecommendations', () => {
.should('exist')
.should('have.text', 'Subtotal for 4 items');
//price
cy.get(`${config?.selectors?.recommendation.cta} .ss__price--strike`).should('exist').should('have.text', '$175.00');
cy.get(`${config?.selectors?.recommendation.cta} .ss__price--strike`).should('exist').contains(`$${store.cart.msrp}`);
//strike
cy.get(`${config?.selectors?.recommendation.cta} .ss__recommendation-bundle__wrapper__cta__subtotal__price .ss__price`)
.should('exist')
.should('have.text', '$157.00');
.contains(`$${store.cart.price}`);
//button
cy.get(`${config?.selectors?.recommendation.cta} .ss__recommendation-bundle__wrapper__cta__button`)
.should('exist')
.should('have.text', 'Add All To Cart');

expect(store.cart.count).to.equal(4);
expect(store.cart.price).to.equal(157);
expect(store.cart.msrp).to.equal(175);
});

//check it is responsive to cartstore changes.
cy.get(`${config?.selectors?.recommendation.seed} .ss__recommendation-bundle__wrapper__selector__result-wrapper__checkbox`)
.should('exist')
.click()
.then(() => {
//title
cy.get(`${config?.selectors?.recommendation.cta} .ss__recommendation-bundle__wrapper__cta__subtotal__title`)
.should('exist')
.should('have.text', 'Subtotal for 3 items');
//price
cy.get(`${config?.selectors?.recommendation.cta} .ss__price--strike`).should('exist').should('have.text', '$125.00');
//strike
cy.get(`${config?.selectors?.recommendation.cta} .ss__recommendation-bundle__wrapper__cta__subtotal__price .ss__price`)
.should('exist')
.should('have.text', '$109.00');
//button
cy.get(`${config?.selectors?.recommendation.cta} .ss__recommendation-bundle__wrapper__cta__button`)
.should('exist')
.should('have.text', 'Add All To Cart');

cy.snapController(config?.selectors?.recommendation.controller).then(({ store }) => {
expect(store.cart.count).to.equal(3);
expect(store.cart.price).to.equal(109);
expect(store.cart.msrp).to.equal(125);
//title
cy.get(`${config?.selectors?.recommendation.cta} .ss__recommendation-bundle__wrapper__cta__subtotal__title`)
.should('exist')
.should('have.text', 'Subtotal for 3 items');
//price
cy.get(`${config?.selectors?.recommendation.cta} .ss__price--strike`).should('exist').contains(`$${store.cart.msrp}`);
//strike
cy.get(`${config?.selectors?.recommendation.cta} .ss__recommendation-bundle__wrapper__cta__subtotal__price .ss__price`)
.should('exist')
.contains(`$${store.cart.price}`);
//button
cy.get(`${config?.selectors?.recommendation.cta} .ss__recommendation-bundle__wrapper__cta__button`)
.should('exist')
.should('have.text', 'Add All To Cart');
});
});
});
Expand Down

0 comments on commit 299c7c8

Please sign in to comment.