Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CHK-1866 - Add regression test #175

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
41 changes: 41 additions & 0 deletions tests/regression/chk-1866.test.ts
Original file line number Diff line number Diff line change
@@ -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)
})
}
)
})
})
})
1 change: 1 addition & 0 deletions utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down