Skip to content

Commit 15df226

Browse files
Merge pull request #793 from nesrineabdmouleh/addMultiCarrierSelectorsInFo
Add selectors to check multicarrier in FO
2 parents e0c93bb + 5b58981 commit 15df226

File tree

6 files changed

+81
-1
lines changed

6 files changed

+81
-1
lines changed

src/interfaces/FO/checkout/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ export interface FoCheckoutPageInterface extends FOBasePagePageInterface {
5353
getNoPaymentNeededBlockContent(page: Page): Promise<string>;
5454
getNumberOfAddresses(page: Page): Promise<number>;
5555
getNumberOfInvoiceAddresses(page: Page): Promise<number>;
56+
getOrderConfirmationCarrierInfo(page:Page, carrierRow: number):Promise<string>;
57+
getOrderConfirmationProduct(page:Page, productRow:number):Promise<string>;
58+
getOrderConfirmationVirtualInfo(page:Page, productRow:number):Promise<string>;
5659
getOrderMessage(page: Page): Promise<string>;
5760
getProductAttributes(page: Page, productRow: number): Promise<string>;
5861
getProductDetails(page: Page, productRow: number): Promise<ProductDetailsBasic>;

src/interfaces/FO/myAccount/orderDetails.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export interface FoMyOrderDetailsPageInterface extends FOBasePagePageInterface {
1111
clickOnReorderLink(page: Page): Promise<void>;
1212
downloadInvoice(page: Page): Promise<string | null>;
1313
getBoxMessages(page: Page): Promise<string>;
14+
getCarrierDataFromTable(page: Page, row?: number, column?: string): Promise<string>;
1415
getDeliveryAddress(page: Page): Promise<string>;
1516
getInvoiceAddress(page: Page): Promise<string>;
1617
getProductName(page: Page, row?: number, column?: number): Promise<string>;

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

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,12 @@ class CheckoutPage extends FOBasePage implements FoCheckoutPageInterface {
233233

234234
private readonly invoiceAddressRadioButton: (addressID: number) => string;
235235

236+
protected carrierInfo: (carrierRow: number) => string;
237+
238+
protected productRow: (productRow: number) => string;
239+
240+
protected virtualProductRow: (productRow: number) => string;
241+
236242
protected cartTotalATI: string;
237243

238244
private readonly cartRuleAlertMessage: string;
@@ -398,6 +404,14 @@ class CheckoutPage extends FOBasePage implements FoCheckoutPageInterface {
398404
this.recyclableGiftCheckbox = '#input_recyclable';
399405
this.cartSubtotalGiftWrappingDiv = '#cart-subtotal-gift_wrapping';
400406
this.cartSubtotalGiftWrappingValueSpan = `${this.cartSubtotalGiftWrappingDiv} span.value`;
407+
408+
// Carrier info selectors
409+
this.carrierInfo = (carrierRow: number) => `div.order-confirmation-table div:nth-child(${carrierRow})`
410+
+ ' div.details .carrier-name';
411+
this.productRow = (productRow: number) => `div.order-confirmation-table div:nth-child(${productRow}) div.details a`
412+
+ `,div.order-confirmation-table div:nth-child(${productRow}) div.details span`;
413+
this.virtualProductRow = (productRow: number) => `div.order-confirmation-table div:nth-child(${productRow})`
414+
+ ' div.details .virtual-info';
401415
}
402416

403417
/*
@@ -1048,7 +1062,7 @@ class CheckoutPage extends FOBasePage implements FoCheckoutPageInterface {
10481062
* @param page {Page} Browser tab
10491063
* @returns {Promise<string|null>}
10501064
*/
1051-
async getCarrierErrorMessage(page: Page): Promise<string|null> {
1065+
async getCarrierErrorMessage(page: Page): Promise<string | null> {
10521066
return page.locator(this.deliveryStepCarriersListError).textContent();
10531067
}
10541068

@@ -1344,6 +1358,36 @@ class CheckoutPage extends FOBasePage implements FoCheckoutPageInterface {
13441358

13451359
return this.getTextContent(page, this.cartSubtotalGiftWrappingValueSpan);
13461360
}
1361+
1362+
/**
1363+
* Get order confirmation carrier info
1364+
* @param page {Page} Browser tab
1365+
* @param carrierRow {number}
1366+
* @returns {Promise<string>}
1367+
*/
1368+
async getOrderConfirmationCarrierInfo(page: Page, carrierRow: number): Promise<string> {
1369+
return this.getTextContent(page, this.carrierInfo(carrierRow));
1370+
}
1371+
1372+
/**
1373+
* Get order confirmation product
1374+
* @param page {Page} Browser tab
1375+
* @param productRow {number}
1376+
* @returns {Promise<string>}
1377+
*/
1378+
async getOrderConfirmationProduct(page: Page, productRow: number): Promise<string> {
1379+
return this.getTextContent(page, this.productRow(productRow));
1380+
}
1381+
1382+
/**
1383+
* Get order confirmation virtual info
1384+
* @param page {Page} Browser tab
1385+
* @param productRow {number}
1386+
* @returns {Promise<string>}
1387+
*/
1388+
async getOrderConfirmationVirtualInfo(page: Page, productRow: number): Promise<string> {
1389+
return this.getTextContent(page, this.virtualProductRow(productRow));
1390+
}
13471391
}
13481392

13491393
const checkoutPage = new CheckoutPage();

src/versions/develop/pages/FO/classic/myAccount/orderDetails.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ class MyOrderDetailsPage extends FOBasePage implements FoMyOrderDetailsPageInter
5555

5656
private readonly invoiceAddressBox: string;
5757

58+
protected carrierGridTable: string;
59+
60+
protected carrierTableRow: (row: number) => string;
61+
62+
protected carrierTableBodyColumn: (row: number, columnName: string) => string;
63+
5864
/**
5965
* @constructs
6066
* Setting up texts and selectors to use on order details page
@@ -76,6 +82,11 @@ class MyOrderDetailsPage extends FOBasePage implements FoMyOrderDetailsPageInter
7682
this.returnTextarea = `${this.orderReturnForm} textarea[name='returnText']`;
7783
this.requestReturnButton = `${this.orderReturnForm} button[name='submitReturnMerchandise']`;
7884

85+
// Shipment tracking details selectors
86+
this.carrierGridTable = '';
87+
this.carrierTableRow = (row: number) => `table.hidden-sm-down tbody tr:nth-child(${row})`;
88+
this.carrierTableBodyColumn = (row: number, column: string) => `${this.carrierTableRow(row)} td:nth-child(${column})`;
89+
7990
// Order products table body selectors
8091
this.tableBody = `${this.gridTable} tbody`;
8192
this.tableBodyRows = `${this.tableBody} tr`;
@@ -188,6 +199,17 @@ class MyOrderDetailsPage extends FOBasePage implements FoMyOrderDetailsPageInter
188199
return this.getTextContent(page, this.productName(row, column));
189200
}
190201

202+
/**
203+
* Get carrier data from table
204+
* @param page {Page} Browser tab
205+
* @param row {number}
206+
* @param column {string}
207+
* @returns {Promise<string>}
208+
*/
209+
async getCarrierDataFromTable(page: Page, row: number = 1, column: string = 'Carrier'): Promise<string> {
210+
return this.getTextContent(page, this.carrierTableBodyColumn(row, column));
211+
}
212+
191213
/**
192214
* Click on download link
193215
* @param page {Page} Browser tab

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ class FoCheckoutPage extends FoCheckoutPageClassic implements FoCheckoutPageInte
9292
this.productDetailsAttributes = (productRow: number) => `${this.productRowLink(productRow)} div`
9393
+ '.cart-summary-product__attribute';
9494

95+
this.carrierInfo = (carrierRow: number) => `div.order-confirmation__carrier-info:nth-child(${carrierRow})`;
96+
this.productRow = (productRow: number) => `div.order-confirmation__product:nth-child(${productRow})`;
97+
this.virtualProductRow = (productRow: number) => `div.order-confirmation__virtual-info:nth-child(${productRow})`;
98+
9599
// Gift selectors
96100
this.cartSubtotalGiftWrappingValueSpan = `${this.cartSubtotalGiftWrappingDiv} span.cart-summary__value`;
97101
}

src/versions/develop/pages/FO/hummingbird/myAccount/orderDetails.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ class FoMyOrderDetailsPage extends FoMyOrderDetailsPageClassic implements FoMyOr
3333
this.boxMessagesBlock = 'div.order-message__content';
3434
this.reorderLink = '.order-infos__summary .order-infos__actions a[href*=\'order?submitReorder\']';
3535
this.invoiceLink = '.order-infos__summary .order-infos__actions a[href*=\'pdf-invoice\']';
36+
37+
// Shipment tracking details selectors
38+
this.carrierGridTable = 'section.order-carriers';
39+
this.carrierTableRow = (row: number) => `${this.carrierGridTable} div.grid-table__row:nth-child(${row + 1})`;
40+
this.carrierTableBodyColumn = (row: number, columnName: string) => `${this.carrierTableRow(row)} `
41+
+ `span[data-ps-label='${columnName}']`;
3642
}
3743
}
3844

0 commit comments

Comments
 (0)