diff --git a/apps/web/__tests__/support/pageObjects/CheckoutPageObject.ts b/apps/web/__tests__/support/pageObjects/CheckoutPageObject.ts index b57470a9d..808f996aa 100644 --- a/apps/web/__tests__/support/pageObjects/CheckoutPageObject.ts +++ b/apps/web/__tests__/support/pageObjects/CheckoutPageObject.ts @@ -29,6 +29,10 @@ export class CheckoutPageObject extends PageObject { return cy.getByTestId('save-address-2'); } + get saveBilling() { + return cy.getByTestId('save-address-1'); + } + get contactInformationFormSaveButton() { return cy.getByTestId('contact-information-save-button'); } @@ -49,6 +53,11 @@ export class CheckoutPageObject extends PageObject { return cy.getByTestId('checkout-edit-address-modal'); } + editBillingAddress() { + cy.getByTestId('edit-address-1').click(); + return this; + } + get thankYouBanner() { return cy.getByTestId('success-header'); } @@ -190,7 +199,7 @@ export class CheckoutPageObject extends PageObject { shouldShowShippingAsBillingText() { this.shippingAsBillingText.contains('Same as shipping address'); - return this; + return this; } fillCreditCardForm() { diff --git a/apps/web/__tests__/test/feature/checkout-addresses.cy.ts b/apps/web/__tests__/test/feature/checkout-addresses.cy.ts index f6e5e3db7..7aba00185 100644 --- a/apps/web/__tests__/test/feature/checkout-addresses.cy.ts +++ b/apps/web/__tests__/test/feature/checkout-addresses.cy.ts @@ -29,4 +29,22 @@ describe('Checkout Addresses', () => { .fillShippingAddressForm() .shouldShowShippingAsBillingText(); }); + + it('should be able to edit the billing address as a guest user if selected same as shipping', () => { + homePage.goToCategory(); + productListPage.addToCart() + + cart.openCart(); + checkout + .goToCheckout() + .goToGuestCheckout() + .fillContactInformationForm() + .fillShippingAddressForm() + .shouldShowShippingAsBillingText() + .editBillingAddress(); + checkout.firstNameInput.clear(); + checkout.firstNameInput.type('John Guest Edit'); + checkout.saveBilling.click({ force: true }); + cy.get('#billing-address').should('contain', 'John Guest Edit'); + }); }); diff --git a/apps/web/components/AddressContainer/AddressContainer.vue b/apps/web/components/AddressContainer/AddressContainer.vue index 15a65bcaa..77437d0ec 100644 --- a/apps/web/components/AddressContainer/AddressContainer.vue +++ b/apps/web/components/AddressContainer/AddressContainer.vue @@ -28,7 +28,12 @@ class="ml-2" :label="!editing && !showNewForm && !disabled ? t('editAddress') : ''" > - + diff --git a/apps/web/components/AddressForm/AddressForm.vue b/apps/web/components/AddressForm/AddressForm.vue index 176597598..5f2385393 100644 --- a/apps/web/components/AddressForm/AddressForm.vue +++ b/apps/web/components/AddressForm/AddressForm.vue @@ -112,15 +112,9 @@ const { type, savedAddress: propertySavedAddress, useAsShippingDefault = true } const { loading: loadBilling } = useAddress(AddressType.Billing); const { loading: loadShipping } = useAddress(AddressType.Shipping); -const { - useGeoRegulatedCountries, - default: defaultCountries, - geoRegulated: geoRegulatedCountries, -} = useAggregatedCountries(); +const { billingCountries, default: defaultCountries } = useAggregatedCountries(); -const countries = computed(() => - type === AddressType.Billing && useGeoRegulatedCountries ? geoRegulatedCountries.value : defaultCountries.value, -); +const countries = computed(() => (type === AddressType.Billing ? billingCountries.value : defaultCountries.value)); const isCartUpdateLoading = computed(() => loadBilling.value || loadShipping.value); const useAsShippingAddress = ref(useAsShippingDefault); const savedAddress = propertySavedAddress || ({} as Address); diff --git a/apps/web/components/AddressFormBilling/AddressFormBilling.vue b/apps/web/components/AddressFormBilling/AddressFormBilling.vue index 25fd4c62e..febebf06b 100644 --- a/apps/web/components/AddressFormBilling/AddressFormBilling.vue +++ b/apps/web/components/AddressFormBilling/AddressFormBilling.vue @@ -119,7 +119,7 @@ :invalid="Boolean(errors['country'])" >