diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b15893..8986a02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +- Regression test for task CHK-1866. + ## [0.19.1] - 2023-07-11 ### Fixed diff --git a/tests/regression/chk-1866.test.ts b/tests/regression/chk-1866.test.ts new file mode 100644 index 0000000..384d1a4 --- /dev/null +++ b/tests/regression/chk-1866.test.ts @@ -0,0 +1,41 @@ +import { visitAndClearCookies, setup } from '../../utils' +import { Accounts, SKUs } from '../../utils/constants' +import { calculateShippingPreview } from '../../utils/shipping-actions' + +describe('CHK-1866', () => { + describe(`${Accounts.DEFAULT}`, () => { + beforeEach(() => { + visitAndClearCookies(Accounts.DEFAULT) + }) + + it('should the price shown in the shipping preview will be the same as shown in the cart summary', () => { + setup({ + skus: [SKUs.ONLY_PICKUP_2_SLA_RJ, SKUs.SCHEDULED_DELIVERY_SLA_RJ], + salesChannel: '1', + account: Accounts.DEFAULT, + }) + + calculateShippingPreview() + + cy.get('#ship-postalCode').type('22250-040') + cy.wait(3000) + + cy.get('.srp-shipping-current-single__price').then( + ($shippingPreviewPrice) => { + const shippingPreviewPrice = $shippingPreviewPrice.text() + + cy.wait(3000) + + cy.get( + '.summary-template-holder .summary-totalizers .srp-summary-result .monetary' + ).then(($field) => { + const price = $field.first().text() + const priceFormated = price.replace('A partir de ', '') + + expect(shippingPreviewPrice).equal(priceFormated) + }) + } + ) + }) + }) +}) diff --git a/utils/constants.ts b/utils/constants.ts index 1291834..f90403b 100644 --- a/utils/constants.ts +++ b/utils/constants.ts @@ -51,6 +51,7 @@ export const SKUs = { GIFT_CARD: '324', DELIVERY_NORTHEAST: '98729706', ONLY_PICKUP_2_SLA_RJ: '341', + SCHEDULED_DELIVERY_SLA_RJ: '75530389', } export { SKUs as SKUS }