Skip to content

Commit

Permalink
Merge pull request #328 from Progi1984/boProductsCreatePage
Browse files Browse the repository at this point in the history
Migrate `@pages/BO/catalog/products/add` from Core
  • Loading branch information
Progi1984 authored Jan 16, 2025
2 parents 41f3acb + 200bc77 commit e0fc31b
Show file tree
Hide file tree
Showing 10 changed files with 195 additions and 194 deletions.
2 changes: 1 addition & 1 deletion src/interfaces/BO/catalog/products/create/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ export interface BOProductsCreatePageInterface extends BOBasePagePageInterface {
saveProduct(page: Page): Promise<string|null>;
selectStores(page: Page, storeID: number): Promise<void>;
setProduct(page: Page, productData: FakerProduct): Promise<string|null>;
setProductName(page: Page, name: string, locale: string): Promise<void>;
setProductName(page: Page, name: string, locale?: string): Promise<void>;
setProductStatus(page: Page, status: boolean): Promise<boolean>;
}
1 change: 1 addition & 0 deletions src/interfaces/BO/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export interface BOBasePagePageInterface extends CommonPageInterface {
getAlertSuccessBlockParagraphContent(page: Frame | Page): Promise<string>;
getAllNotificationsNumber(page: Page): Promise<number>;
getCurrentEmployeeAvatar(page: Page): Promise<string | null>;
getGrowlMessageContent(page: Page, timeout?: number): Promise<string | null>;
getHelpDocumentURL(page: Page): Promise<string>;
getNotificationsNumberInTab(page: Page, tabName: string): Promise<number>;
getPageSubTitle(page: Page): Promise<string>;
Expand Down
12 changes: 6 additions & 6 deletions src/pages/BO/catalog/products/create/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ const psVersion = testContext.getPSVersion();
/* eslint-disable global-require, @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires */
function requirePage(): BOProductsCreatePageInterface {
if (semver.lt(psVersion, '7.3.0')) {
return require('@versions/1.7.2/pages/BO/catalog/products/create').createProduct;
return require('@versions/1.7.2/pages/BO/catalog/products/create').boProductsCreatePage;
}
if (semver.lt(psVersion, '7.4.0')) {
return require('@versions/1.7.3/pages/BO/catalog/products/create').createProduct;
return require('@versions/1.7.3/pages/BO/catalog/products/create').boProductsCreatePage;
}
if (semver.lt(psVersion, '7.6.0')) {
return require('@versions/1.7.5/pages/BO/catalog/products/create').createProduct;
return require('@versions/1.7.5/pages/BO/catalog/products/create').boProductsCreatePage;
}
if (semver.lt(psVersion, '8.1.0')) {
return require('@versions/8.0/pages/BO/catalog/products/create').createProduct;
return require('@versions/8.0/pages/BO/catalog/products/create').boProductsCreatePage;
}
if (semver.lt(psVersion, '8.3.0')) {
return require('@versions/8.2/pages/BO/catalog/products/create').createProduct;
return require('@versions/8.2/pages/BO/catalog/products/create').boProductsCreatePage;
}
return require('@versions/develop/pages/BO/catalog/products/create').createProduct;
return require('@versions/develop/pages/BO/catalog/products/create').boProductsCreatePage;
}

/* eslint-enable global-require, @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires */
Expand Down
10 changes: 5 additions & 5 deletions src/versions/1.7.2/pages/BO/catalog/products/create/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// Import pages
import type {BOProductsCreatePageInterface} from '@interfaces/BO/catalog/products/create';
import {CreateProduct} from '@versions/1.7.3/pages/BO/catalog/products/create';
import {BOProductsCreatePage} from '@versions/1.7.3/pages/BO/catalog/products/create';
import {type Page} from '@playwright/test';

/**
* Bo create product page, contains functions that can be used on the page
* @class
* @extends CreateProduct
* @extends BOProductsCreatePage
*/
class BOCreateProductVersion extends CreateProduct implements BOProductsCreatePageInterface {
class BOProductsCreatePageVersion extends BOProductsCreatePage implements BOProductsCreatePageInterface {
private readonly confirmationModalContinueButton: string;

/**
Expand Down Expand Up @@ -36,5 +36,5 @@ class BOCreateProductVersion extends CreateProduct implements BOProductsCreatePa
}
}

const createProduct = new BOCreateProductVersion();
export {createProduct, BOCreateProductVersion as CreateProduct};
const boProductsCreatePage = new BOProductsCreatePageVersion();
export {boProductsCreatePage, BOProductsCreatePageVersion as BOProductsCreatePage};
10 changes: 5 additions & 5 deletions src/versions/1.7.3/pages/BO/catalog/products/create/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// Import pages
import type {BOProductsCreatePageInterface} from '@interfaces/BO/catalog/products/create';
import {CreateProduct} from '@versions/1.7.5/pages/BO/catalog/products/create';
import {BOProductsCreatePage} from '@versions/1.7.5/pages/BO/catalog/products/create';
import {type Page} from '@playwright/test';

/**
* Bo create product page, contains functions that can be used on the page
* @class
* @extends CreateProduct
* @extends BOProductsCreatePage
*/
class BOCreateProductVersion extends CreateProduct implements BOProductsCreatePageInterface {
class BOProductsCreatePageVersion extends BOProductsCreatePage implements BOProductsCreatePageInterface {
/**
* @constructs
* Setting up texts and selectors to use on create products page
Expand All @@ -31,5 +31,5 @@ class BOCreateProductVersion extends CreateProduct implements BOProductsCreatePa
}
}

const createProduct = new BOCreateProductVersion();
export {createProduct, BOCreateProductVersion as CreateProduct};
const boProductsCreatePage = new BOProductsCreatePageVersion();
export {boProductsCreatePage, BOProductsCreatePageVersion as BOProductsCreatePage};
10 changes: 5 additions & 5 deletions src/versions/1.7.5/pages/BO/catalog/products/create/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Import pages
import type {BOProductsCreatePageInterface} from '@interfaces/BO/catalog/products/create';
import {CreateProduct} from '@versions/8.0/pages/BO/catalog/products/create';
import {BOProductsCreatePage} from '@versions/8.0/pages/BO/catalog/products/create';

/**
* Bo create product page, contains functions that can be used on the page
* @class
* @extends CreateProduct
* @extends BOProductsCreatePage
*/
class BOCreateProductVersion extends CreateProduct implements BOProductsCreatePageInterface {
class BOProductsCreatePageVersion extends BOProductsCreatePage implements BOProductsCreatePageInterface {
/**
* @constructs
* Setting up texts and selectors to use on create product page
Expand All @@ -19,5 +19,5 @@ class BOCreateProductVersion extends CreateProduct implements BOProductsCreatePa
}
}

const createProduct = new BOCreateProductVersion();
export {createProduct, BOCreateProductVersion as CreateProduct};
const boProductsCreatePage = new BOProductsCreatePageVersion();
export {boProductsCreatePage, BOProductsCreatePageVersion as BOProductsCreatePage};
14 changes: 7 additions & 7 deletions src/versions/8.0/pages/BO/catalog/products/create/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// Import pages
import type {BOProductsCreatePageInterface} from '@interfaces/BO/catalog/products/create';
import {CreateProduct} from '@versions/8.2/pages/BO/catalog/products/create';
import {BOProductsCreatePage} from '@versions/8.2/pages/BO/catalog/products/create';

import type {Page} from 'playwright';

/**
* Bo create product page, contains functions that can be used on the page
* @class
* @extends CreateProduct
* @extends BOProductsCreatePage
*/
class BOCreateProductVersion extends CreateProduct implements BOProductsCreatePageInterface {
class BOProductsCreatePageVersion extends BOProductsCreatePage implements BOProductsCreatePageInterface {
public readonly productOnlineTitle: string;

public readonly deleteProductLink: string;
Expand Down Expand Up @@ -123,12 +123,12 @@ class BOCreateProductVersion extends CreateProduct implements BOProductsCreatePa
* @param page {Page} Browser tab
* @returns {Promise<string>}
*/
async saveProduct(page: Page): Promise<string|null> {
async saveProduct(page: Page): Promise<string> {
await page.click(this.saveProductButton);
const growlTextMessage = await this.getGrowlMessageContent(page, 30000);
await this.closeGrowlMessage(page);

return growlTextMessage;
return growlTextMessage ?? '';
}

/**
Expand Down Expand Up @@ -203,5 +203,5 @@ class BOCreateProductVersion extends CreateProduct implements BOProductsCreatePa
}
}

const createProduct = new BOCreateProductVersion();
export {createProduct, BOCreateProductVersion as CreateProduct};
const boProductsCreatePage = new BOProductsCreatePageVersion();
export {boProductsCreatePage, BOProductsCreatePageVersion as BOProductsCreatePage};
2 changes: 1 addition & 1 deletion src/versions/8.1/pages/BO/catalog/suppliers/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type {Page} from 'playwright';
/**
* Bo create supplier page, contains functions that can be used on the page
* @class
* @extends CreateProduct
* @extends CreateSupplier
*/
class BOCreateSupplierVersion extends CreateSupplier implements BOSuppliersCreatePageInterface {
/**
Expand Down
10 changes: 5 additions & 5 deletions src/versions/8.2/pages/BO/catalog/products/create/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Import pages
import type {BOProductsCreatePageInterface} from '@interfaces/BO/catalog/products/create';
import {CreateProduct} from '@versions/develop/pages/BO/catalog/products/create';
import {BOProductsCreatePage} from '@versions/develop/pages/BO/catalog/products/create';

import descriptionTab from '@pages/BO/catalog/products/create/tabDescription';
import pricingTab from '@pages/BO/catalog/products/create/tabPricing';
Expand All @@ -16,9 +16,9 @@ import type {Page} from 'playwright';
/**
* Bo create product page, contains functions that can be used on the page
* @class
* @extends CreateProduct
* @extends BOProductsCreatePage
*/
class BOCreateProductVersion extends CreateProduct implements BOProductsCreatePageInterface {
class BOProductsCreatePageVersion extends BOProductsCreatePage implements BOProductsCreatePageInterface {
/**
* Set product
* @param page {Page} Browser tab
Expand Down Expand Up @@ -59,5 +59,5 @@ class BOCreateProductVersion extends CreateProduct implements BOProductsCreatePa
}
}

const createProduct = new BOCreateProductVersion();
export {createProduct, BOCreateProductVersion as CreateProduct};
const boProductsCreatePage = new BOProductsCreatePageVersion();
export {boProductsCreatePage, BOProductsCreatePageVersion as BOProductsCreatePage};
Loading

0 comments on commit e0fc31b

Please sign in to comment.