From 24bbeba2b0ec7325f65df3bdd29be99e8c5e8afc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20R=C3=B6ll?= <30629157+maxiroellplenty@users.noreply.github.com> Date: Thu, 30 Nov 2023 13:46:43 +0100 Subject: [PATCH] refactor: rename voucher to coupon --- .../support/pageObjects/CartPageObject.ts | 18 ++++++------ .../smoke/{voucher.cy.ts => coupon.cy.ts} | 14 +++++----- .../CartPageContent/CartPageContent.vue | 4 +-- .../Voucher.vue => Coupon/Coupon.vue} | 26 ++++++++--------- apps/web/composables/index.ts | 2 +- apps/web/composables/useCoupon/index.ts | 3 ++ apps/web/composables/useCoupon/types.ts | 17 +++++++++++ .../useVoucher.ts => useCoupon/useCoupon.ts} | 28 +++++++++---------- apps/web/composables/useVoucher/index.ts | 3 -- apps/web/composables/useVoucher/types.ts | 17 ----------- apps/web/lang/de.json | 6 ++-- apps/web/lang/en.json | 6 ++-- apps/web/pages/checkout.vue | 2 +- 13 files changed, 73 insertions(+), 73 deletions(-) rename apps/web/__tests__/test/smoke/{voucher.cy.ts => coupon.cy.ts} (69%) rename apps/web/components/{Voucher/Voucher.vue => Coupon/Coupon.vue} (74%) create mode 100644 apps/web/composables/useCoupon/index.ts create mode 100644 apps/web/composables/useCoupon/types.ts rename apps/web/composables/{useVoucher/useVoucher.ts => useCoupon/useCoupon.ts} (68%) delete mode 100644 apps/web/composables/useVoucher/index.ts delete mode 100644 apps/web/composables/useVoucher/types.ts diff --git a/apps/web/__tests__/support/pageObjects/CartPageObject.ts b/apps/web/__tests__/support/pageObjects/CartPageObject.ts index 1d0195bd5..6cc16315b 100644 --- a/apps/web/__tests__/support/pageObjects/CartPageObject.ts +++ b/apps/web/__tests__/support/pageObjects/CartPageObject.ts @@ -62,29 +62,29 @@ export class CartPageObject { return this; } - openVoucherAccordion() { - cy.getByTestId('voucherZone').click(); + openCouponAccordion() { + cy.getByTestId('couponZone').click(); return this; } - addVoucher(voucherCode: string) { - cy.getByTestId('voucherCode').find('[data-testid="input-field"]').type(voucherCode); - cy.getByTestId('voucherAdd').click(); + addCoupon(couponCode: string) { + cy.getByTestId('couponCode').find('[data-testid="input-field"]').type(couponCode); + cy.getByTestId('couponAdd').click(); return this; } - orderSummayAfterVoucherApplyed(discount: string, total: string) { + orderSummayAfterCouponApplyed(discount: string, total: string) { cy.getByTestId('coupon-label').should('be.visible'); cy.getByTestId('coupon-value').contains(discount); cy.getByTestId('total').contains(total); } - removeVoucher() { - cy.getByTestId('voucherRemove').click(); + removeCoupon() { + cy.getByTestId('couponRemove').click(); return this; } - orderSummayAfterVoucherRemoved(total: string) { + orderSummayAfterCouponRemoved(total: string) { cy.getByTestId('coupon-label').should('not.exist'); cy.getByTestId('total').contains(total); } diff --git a/apps/web/__tests__/test/smoke/voucher.cy.ts b/apps/web/__tests__/test/smoke/coupon.cy.ts similarity index 69% rename from apps/web/__tests__/test/smoke/voucher.cy.ts rename to apps/web/__tests__/test/smoke/coupon.cy.ts index 86b38c425..96bdb5101 100644 --- a/apps/web/__tests__/test/smoke/voucher.cy.ts +++ b/apps/web/__tests__/test/smoke/coupon.cy.ts @@ -3,23 +3,23 @@ import { paths } from '../../../utils/paths'; const cart = new CartPageObject(); -describe('Smoke: Voucher test', () => { +describe('Smoke: Coupon test', () => { beforeEach(() => { cy.setCookie('vsf-locale', 'en'); cy.setCookie('consent-cookie', '{"Essentials":{"Session":true,"Consent":true,"Session2":true},"External Media":{"Session":false,"Consent":false,"Session2":false},"Functional":{"Session":false,"Consent":false,"Session2":false},"Marketing":{"Session":false,"Consent":false,"Session2":false}}') }); - it('[smoke] Add voucher to cart and check order summary then remove voucher and check order summary', () => { + it('[smoke] Add coupon to cart and check order summary then remove coupon and check order summary', () => { cy.visitAndHydrate('/study-room-office/office-chair/design-chair-brookhaven-leather-black_105_1003'); cy.intercept('/plentysystems/doAddCartItem').as('doAddCartItem'); cy.wait(1000); cy.getByTestId('add-to-cart').click(); cy.wait('@doAddCartItem'); cy.visitAndHydrate(paths.cart); - cart.openVoucherAccordion(); - cart.addVoucher('KB82AZ'); - cart.orderSummayAfterVoucherApplyed('-£12.95','£119.99'); - cart.removeVoucher(); - cart.orderSummayAfterVoucherRemoved('£132.94'); + cart.openCouponAccordion(); + cart.addCoupon('KB82AZ'); + cart.orderSummayAfterCouponApplyed('-£12.95','£119.99'); + cart.removeCoupon(); + cart.orderSummayAfterCouponRemoved('£132.94'); }); }); diff --git a/apps/web/components/CartPageContent/CartPageContent.vue b/apps/web/components/CartPageContent/CartPageContent.vue index fb679810d..1f43954f0 100644 --- a/apps/web/components/CartPageContent/CartPageContent.vue +++ b/apps/web/components/CartPageContent/CartPageContent.vue @@ -4,12 +4,12 @@
{{ $t('coupon.title') }}