diff --git a/src/interfaces/FO/checkout/index.ts b/src/interfaces/FO/checkout/index.ts index e65cd5c2..c37ca3a9 100644 --- a/src/interfaces/FO/checkout/index.ts +++ b/src/interfaces/FO/checkout/index.ts @@ -3,8 +3,13 @@ import type {Page} from '@playwright/test'; export interface FoCheckoutPageInterface extends FOBasePagePageInterface { personalInformationStepForm: string; + readonly noCarriersMessage: string; choosePaymentAndOrder(page: Page, paymentModuleName: string): Promise; + clickOnSignIn(page: Page): Promise; + customerLogin(page: Page, customer: any): Promise; + getAllCarriersNames(page: Page): Promise<(string | null)[]>; + getCarrierErrorMessage(page: Page): Promise; goToDeliveryStep(page: Page): Promise; goToPaymentStep(page: Page): Promise; isCheckoutPage(page: Page): Promise; diff --git a/src/interfaces/index.ts b/src/interfaces/index.ts index 3be97be5..b0c6803d 100644 --- a/src/interfaces/index.ts +++ b/src/interfaces/index.ts @@ -1,6 +1,7 @@ import type {BrowserContext, Page} from '@playwright/test'; export interface CommonPageInterface { + changePage(browserContext: BrowserContext, tabId?: number): Promise; closePage(browserContext: BrowserContext, page: Page, tabId?: number): Promise; getPageTitle(page: Page): Promise; goTo(page: Page, url: string): Promise; diff --git a/src/versions/develop/pages/FO/classic/checkout/index.ts b/src/versions/develop/pages/FO/classic/checkout/index.ts index cfa03b3a..71584111 100644 --- a/src/versions/develop/pages/FO/classic/checkout/index.ts +++ b/src/versions/develop/pages/FO/classic/checkout/index.ts @@ -19,6 +19,8 @@ import type {Page} from 'playwright'; class CheckoutPage extends FOBasePage implements FoCheckoutPageInterface { public readonly deleteAddressSuccessMessage: string; + public readonly noCarriersMessage: string; + private readonly successAlert: string; private readonly checkoutPageBody: string; @@ -187,6 +189,8 @@ class CheckoutPage extends FOBasePage implements FoCheckoutPageInterface { private readonly deliveryStepCarriersList: string; + private readonly deliveryStepCarriersListError: string; + protected deliveryOptions: string; private readonly deliveryOptionsRadioButton: string; @@ -251,6 +255,7 @@ class CheckoutPage extends FOBasePage implements FoCheckoutPageInterface { super(theme); this.cartRuleAlertMessageText = 'You cannot use this voucher with this carrier'; this.deleteAddressSuccessMessage = 'Address successfully deleted.'; + this.noCarriersMessage = 'Unfortunately, there are no carriers available for your delivery address.'; this.noPaymentNeededText = 'No payment needed for this order'; this.messageIfYouSignOut = 'If you sign out now, your cart will be emptied.'; this.authenticationErrorMessage = 'Authentication failed.'; @@ -328,6 +333,7 @@ class CheckoutPage extends FOBasePage implements FoCheckoutPageInterface { this.deliveryStepSection = '#checkout-delivery-step'; this.deliveryStepEditButton = `${this.deliveryStepSection} span.step-edit`; this.deliveryStepCarriersList = `${this.deliveryStepSection} .delivery-options-list`; + this.deliveryStepCarriersListError = `${this.deliveryStepCarriersList} .alert-danger`; this.deliveryOptions = '#js-delivery div.delivery-options'; this.deliveryOptionsRadioButton = 'input[id*=\'delivery_option_\']'; this.deliveryOptionLabel = (id: number) => `${this.deliveryStepSection} label[for='delivery_option_${id}']`; @@ -564,7 +570,7 @@ class CheckoutPage extends FOBasePage implements FoCheckoutPageInterface { * @param page {Page} Browser tab * @returns {Promise} */ - getActiveLinkFromPersonalInformationBlock(page: Page): Promise { + async getActiveLinkFromPersonalInformationBlock(page: Page): Promise { return this.getTextContent(page, this.activeLink); } @@ -573,7 +579,7 @@ class CheckoutPage extends FOBasePage implements FoCheckoutPageInterface { * @param page {Page} Browser tab * @returns {Promise} */ - isPasswordRequired(page: Page): Promise { + async isPasswordRequired(page: Page): Promise { return this.elementVisible(page, `${this.checkoutGuestPasswordInput}:required`, 1000); } @@ -974,6 +980,15 @@ class CheckoutPage extends FOBasePage implements FoCheckoutPageInterface { return this.getTextContent(page, this.shippingValueSpan); } + /** + * Get errror carrier + * @param page {Page} Browser tab + * @returns {Promise} + */ + async getCarrierErrorMessage(page: Page): Promise { + return page.locator(this.deliveryStepCarriersListError).textContent(); + } + /** * Get all carriers names * @param page {Page} Browser tab