Skip to content

Commit 507ff38

Browse files
authored
Merge pull request #27 from Progi1984/test971
Support for TEST-971
2 parents 3eca284 + bee7fb7 commit 507ff38

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

src/interfaces/FO/checkout/index.ts

+5
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,13 @@ import type {Page} from '@playwright/test';
33

44
export interface FoCheckoutPageInterface extends FOBasePagePageInterface {
55
personalInformationStepForm: string;
6+
readonly noCarriersMessage: string;
67

78
choosePaymentAndOrder(page: Page, paymentModuleName: string): Promise<void>;
9+
clickOnSignIn(page: Page): Promise<void>;
10+
customerLogin(page: Page, customer: any): Promise<boolean>;
11+
getAllCarriersNames(page: Page): Promise<(string | null)[]>;
12+
getCarrierErrorMessage(page: Page): Promise<string|null>;
813
goToDeliveryStep(page: Page): Promise<boolean>;
914
goToPaymentStep(page: Page): Promise<boolean>;
1015
isCheckoutPage(page: Page): Promise<boolean>;

src/interfaces/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type {BrowserContext, Page} from '@playwright/test';
22

33
export interface CommonPageInterface {
4+
changePage(browserContext: BrowserContext, tabId?: number): Promise<Page>;
45
closePage(browserContext: BrowserContext, page: Page, tabId?: number): Promise<Page>;
56
getPageTitle(page: Page): Promise<string>;
67
goTo(page: Page, url: string): Promise<void>;

src/versions/develop/pages/FO/classic/checkout/index.ts

+17-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import type {Page} from 'playwright';
1919
class CheckoutPage extends FOBasePage implements FoCheckoutPageInterface {
2020
public readonly deleteAddressSuccessMessage: string;
2121

22+
public readonly noCarriersMessage: string;
23+
2224
private readonly successAlert: string;
2325

2426
private readonly checkoutPageBody: string;
@@ -187,6 +189,8 @@ class CheckoutPage extends FOBasePage implements FoCheckoutPageInterface {
187189

188190
private readonly deliveryStepCarriersList: string;
189191

192+
private readonly deliveryStepCarriersListError: string;
193+
190194
protected deliveryOptions: string;
191195

192196
private readonly deliveryOptionsRadioButton: string;
@@ -251,6 +255,7 @@ class CheckoutPage extends FOBasePage implements FoCheckoutPageInterface {
251255
super(theme);
252256
this.cartRuleAlertMessageText = 'You cannot use this voucher with this carrier';
253257
this.deleteAddressSuccessMessage = 'Address successfully deleted.';
258+
this.noCarriersMessage = 'Unfortunately, there are no carriers available for your delivery address.';
254259
this.noPaymentNeededText = 'No payment needed for this order';
255260
this.messageIfYouSignOut = 'If you sign out now, your cart will be emptied.';
256261
this.authenticationErrorMessage = 'Authentication failed.';
@@ -328,6 +333,7 @@ class CheckoutPage extends FOBasePage implements FoCheckoutPageInterface {
328333
this.deliveryStepSection = '#checkout-delivery-step';
329334
this.deliveryStepEditButton = `${this.deliveryStepSection} span.step-edit`;
330335
this.deliveryStepCarriersList = `${this.deliveryStepSection} .delivery-options-list`;
336+
this.deliveryStepCarriersListError = `${this.deliveryStepCarriersList} .alert-danger`;
331337
this.deliveryOptions = '#js-delivery div.delivery-options';
332338
this.deliveryOptionsRadioButton = 'input[id*=\'delivery_option_\']';
333339
this.deliveryOptionLabel = (id: number) => `${this.deliveryStepSection} label[for='delivery_option_${id}']`;
@@ -564,7 +570,7 @@ class CheckoutPage extends FOBasePage implements FoCheckoutPageInterface {
564570
* @param page {Page} Browser tab
565571
* @returns {Promise<string>}
566572
*/
567-
getActiveLinkFromPersonalInformationBlock(page: Page): Promise<string> {
573+
async getActiveLinkFromPersonalInformationBlock(page: Page): Promise<string> {
568574
return this.getTextContent(page, this.activeLink);
569575
}
570576

@@ -573,7 +579,7 @@ class CheckoutPage extends FOBasePage implements FoCheckoutPageInterface {
573579
* @param page {Page} Browser tab
574580
* @returns {Promise<boolean>}
575581
*/
576-
isPasswordRequired(page: Page): Promise<boolean> {
582+
async isPasswordRequired(page: Page): Promise<boolean> {
577583
return this.elementVisible(page, `${this.checkoutGuestPasswordInput}:required`, 1000);
578584
}
579585

@@ -974,6 +980,15 @@ class CheckoutPage extends FOBasePage implements FoCheckoutPageInterface {
974980
return this.getTextContent(page, this.shippingValueSpan);
975981
}
976982

983+
/**
984+
* Get errror carrier
985+
* @param page {Page} Browser tab
986+
* @returns {Promise<string|null>}
987+
*/
988+
async getCarrierErrorMessage(page: Page): Promise<string|null> {
989+
return page.locator(this.deliveryStepCarriersListError).textContent();
990+
}
991+
977992
/**
978993
* Get all carriers names
979994
* @param page {Page} Browser tab

0 commit comments

Comments
 (0)