Skip to content

Commit 6d0ed66

Browse files
Merge pull request #244 from nesrineabdmouleh/addMethodsInCartPage
Add methods in cart page and Adapt sanity tests with 1.7.2
2 parents 242dded + 58153ca commit 6d0ed66

File tree

23 files changed

+370
-19
lines changed

23 files changed

+370
-19
lines changed

src/data/demo/categories.ts

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const women: FakerCategory = new FakerCategory({
1313
id: 5,
1414
name: 'Women',
1515
description: 'T-shirts, sweaters, hoodies and women\'s accessories. From basics to original creations, '
16-
+ 'for every style.',
16+
+ 'for every style.',
1717
position: 2,
1818
displayed: true,
1919
products: ['demo_3'],
@@ -39,7 +39,7 @@ const clothes: FakerCategory = new FakerCategory({
3939
id: 3,
4040
name: 'Clothes',
4141
description: 'Discover our favorites fashionable discoveries, a selection of cool items to integrate in your '
42-
+ 'wardrobe. Compose a unique style with personality which matches your own.',
42+
+ 'wardrobe. Compose a unique style with personality which matches your own.',
4343
position: 1,
4444
displayed: true,
4545
children: [
@@ -68,6 +68,24 @@ const art: FakerCategory = new FakerCategory({
6868
displayed: true,
6969
products: ['demo_5', 'demo_6', 'demo_7', 'demo_18', 'demo_19', 'demo_20'],
7070
});
71+
// Categories demo for PS version <= 1.7.2
72+
//@todo : to find for a solution in case of upgrade 1.7.2 to 1.7.8
73+
const oldWomen: FakerCategory = new FakerCategory({
74+
id: 3,
75+
name: 'Women',
76+
description: 'You will find here all woman fashion collections. This category includes all the basics of your '
77+
+ 'wardrobe and much more: shoes, accessories, printed t-shirts, feminine dresses, women\'s jeans!\'',
78+
position: 1,
79+
displayed: true,
80+
});
81+
//@todo : to find for a solution in case of upgrade 1.7.2 to 1.7.8
82+
const eveningDresses: FakerCategory = new FakerCategory({
83+
id: 10,
84+
name: 'Evening Dresses',
85+
description: 'Browse our different dresses to choose the perfect dress for an unforgettable evening!',
86+
position: 2,
87+
displayed: true,
88+
});
7189

7290
export default {
7391
home: new FakerCategory({
@@ -90,4 +108,6 @@ export default {
90108
stationery,
91109
homeAccessories,
92110
art,
111+
oldWomen,
112+
eveningDresses,
93113
};

src/data/demo/products.ts

Lines changed: 57 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ export default {
99
category: 'Men',
1010
summary: 'Regular fit, round neckline, short sleeves. Made of extra long staple pima cotton.',
1111
description: 'Symbol of lightness and delicacy, the hummingbird evokes curiosity and joy. Studio Design\' '
12-
+ 'PolyFaune collection features classic products with colorful patterns, inspired by the traditional japanese '
13-
+ 'origamis. To wear with a chino or jeans. The sublimation textile printing process provides an exceptional '
14-
+ 'color rendering and a color, guaranteed overtime.',
12+
+ 'PolyFaune collection features classic products with colorful patterns, inspired by the traditional japanese '
13+
+ 'origamis. To wear with a chino or jeans. The sublimation textile printing process provides an exceptional '
14+
+ 'color rendering and a color, guaranteed overtime.',
1515
retailPrice: 28.68,
1616
tax: 20,
1717
price: 23.90,
@@ -245,4 +245,58 @@ export default {
245245
category: 'Home Accessories',
246246
status: true,
247247
}),
248+
// Products demo for PS version <= 1.7.2
249+
//@todo : to find for a solution in case of upgrade 1.7.2 to 1.7.8
250+
old_demo_1: new FakerProduct({
251+
id: 1,
252+
name: 'Faded Short Sleeves T-shirt',
253+
description: 'Fashion has been creating well-designed collections since 2010.',
254+
finalPrice: 19.81,
255+
reference: 'demo_1',
256+
category: 'T-shirts',
257+
status: true,
258+
}),
259+
old_demo_2: new FakerProduct({
260+
id: 2,
261+
name: 'Blouse',
262+
finalPrice: 32.39,
263+
reference: 'demo_2',
264+
category: 'Blouses',
265+
status: true,
266+
}),
267+
old_demo_3: new FakerProduct({
268+
id: 3,
269+
name: 'Printed Dress',
270+
reference: 'demo_3',
271+
category: 'Casual Dresses',
272+
status: true,
273+
}),
274+
old_demo_4: new FakerProduct({
275+
id: 4,
276+
name: 'Printed Dress',
277+
reference: 'demo_4',
278+
category: 'Evening Dresses',
279+
status: true,
280+
}),
281+
old_demo_5: new FakerProduct({
282+
id: 5,
283+
name: 'Printed Summer Dress',
284+
reference: 'demo_5',
285+
category: 'Summer Dresses',
286+
status: true,
287+
}),
288+
old_demo_6: new FakerProduct({
289+
id: 6,
290+
name: 'Printed Summer Dress',
291+
reference: 'demo_6',
292+
category: 'Summer Dresses',
293+
status: true,
294+
}),
295+
old_demo_7: new FakerProduct({
296+
id: 7,
297+
name: 'Printed Chiffon Dress',
298+
reference: 'demo_7',
299+
category: 'Summer Dresses',
300+
status: true,
301+
}),
248302
};

src/interfaces/FO/cart/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ export interface FoCartPageInterface extends FOBasePagePageInterface {
3636
getProductAttributes(page: Page, row: number): Promise<ProductAttribute[]>;
3737
getProductCustomizationModal(page: Page, row?: number): Promise<string>;
3838
getProductDetail(page: Page, row: number): Promise<ProductDetailsWithDiscount>;
39+
getProductName(page: Page, row: number): Promise<string>;
40+
getProductPrice(page: Page, row: number): Promise<number>;
41+
getProductQuantity(page: Page, row: number): Promise<number>;
3942
getProductsNumber(page: Page): Promise<number>;
4043
getSubtotalDiscountValue(page: Page): Promise<number>;
4144
isAlertWarningForMinimumPurchaseVisible(page: Page): Promise<boolean>;

src/pages/BO/catalog/products/create/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ const psVersion = testContext.getPSVersion();
66

77
/* eslint-disable global-require, @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires */
88
function requirePage(): BOProductsCreatePageInterface {
9+
if (semver.lt(psVersion, '7.3.0')) {
10+
return require('@versions/1.7.2/pages/BO/catalog/products/create').createProduct;
11+
}
912
if (semver.lt(psVersion, '7.4.0')) {
1013
return require('@versions/1.7.3/pages/BO/catalog/products/create').createProduct;
1114
}

src/pages/BO/catalog/products/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ const psVersion = testContext.getPSVersion();
66

77
/* eslint-disable global-require, @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires */
88
function requirePage(): BOProductsPageInterface {
9+
if (semver.lt(psVersion, '7.3.0')) {
10+
return require('@versions/1.7.2/pages/BO/catalog/products').productsPage;
11+
}
912
if (semver.lt(psVersion, '7.4.0')) {
1013
return require('@versions/1.7.3/pages/BO/catalog/products').productsPage;
1114
}

src/pages/BO/login/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@ const psVersion = testContext.getPSVersion();
66

77
/* eslint-disable global-require, @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires */
88
function requirePage(): LoginPageInterface {
9+
if (semver.lt(psVersion, '7.3.0')) {
10+
return require('@versions/1.7.2/pages/BO/login').loginPage;
11+
}
912
if (semver.lt(psVersion, '8.0.0')) {
10-
return require('@versions/1.7.8/pages/BO/login');
13+
return require('@versions/1.7.8/pages/BO/login').loginPage;
1114
}
1215
if (semver.lt(psVersion, '9.0.0')) {
1316
return require('@versions/8.1/pages/BO/login').loginPage;

src/pages/BO/orders/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ const psVersion = testContext.getPSVersion();
66

77
/* eslint-disable global-require, @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires */
88
function requirePage(): BOOrdersPageInterface {
9+
if (semver.lt(psVersion, '7.3.0')) {
10+
return require('@versions/1.7.2/pages/BO/orders').ordersPage;
11+
}
912
if (semver.lt(psVersion, '7.7.0')) {
1013
return require('@versions/1.7.6/pages/BO/orders').ordersPage;
1114
}

src/pages/BO/orders/view/viewOrderBasePage.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ import semver from 'semver';
55
const psVersion = testContext.getPSVersion();
66
/* eslint-disable global-require, @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires */
77
function requirePage(): BOViewOrderBasePageInterface {
8+
if (semver.lt(psVersion, '7.3.0')) {
9+
return require('@versions/1.7.2/pages/BO/orders/view/viewOrderBasePage').viewOrderBasePage;
10+
}
811
if (semver.lt(psVersion, '7.7.0')) {
912
return require('@versions/1.7.6/pages/BO/orders/view/viewOrderBasePage').viewOrderBasePage;
1013
}

src/pages/FO/FOBasePage.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,8 @@ export default class FOBasePage extends CommonPage implements FOBasePagePageInte
529529
*/
530530
async goToSubCategory(page: Page, categoryID: number, subCategoryID: number): Promise<void> {
531531
await page.locator(this.categoryMenu(categoryID)).first().hover();
532-
await this.clickAndWaitForURL(page, this.categoryMenu(subCategoryID));
532+
await page.locator(this.categoryMenu(subCategoryID)).click();
533+
await page.waitForLoadState();
533534
}
534535

535536
/**

src/pages/FO/classic/login/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ const psVersion = testContext.getPSVersion();
66

77
/* eslint-disable global-require, @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires */
88
function requirePage(): FoLoginPageInterface {
9-
if (semver.gte(psVersion, '0.0.0')) {
10-
return require('@versions/develop/pages/FO/classic/login').loginPage;
9+
if (semver.lte(psVersion, '7.3.0')) {
10+
return require('@versions/1.7.2/pages/FO/classic/login').loginPage;
1111
}
1212
return require('@versions/develop/pages/FO/classic/login').loginPage;
1313
}
14+
1415
/* eslint-enable global-require, @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires */
1516

1617
export default requirePage();

0 commit comments

Comments
 (0)