Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for ps_emailalerts #24

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/data/faker/product.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,12 @@ export default class FakerProduct {
public deliveryTime: string;

/**
* Constructor for class FakerProduct
* @param productToCreate {Object} Could be used to force the value of some members
* @todo Replace taxRule & tax by FakerTax object
* @todo Rename price to priceTaxIncluded
* @todo Check if retailPrice & finalPrice can be removed
*/
* Constructor for class FakerProduct
* @param productToCreate {Object} Could be used to force the value of some members
* @todo Replace taxRule & tax by FakerTax object
* @todo Rename price to priceTaxIncluded
* @todo Check if retailPrice & finalPrice can be removed
*/
constructor(productToCreate: ProductCreator = {}) {
/** @type {number} ID of the product */
this.id = productToCreate.id || 0;
Expand Down
22 changes: 11 additions & 11 deletions src/data/types/product.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,16 @@ type ProductFiles = {
file: string,
}

type ProductImageInformation = {
id: number,
isCover: boolean,
position: number,
caption: {
en: string,
fr: string
},
};

type ProductCombinationOptions = {
reference: string
impactOnPriceTExc: number
Expand Down Expand Up @@ -198,16 +208,6 @@ type ProductImageUrls = {
thumbImage: string
};

type ProductImageInformation = {
id: number,
isCover: boolean,
position: number,
caption: {
en: string,
fr: string
},
};

type ProductPackItem = {
reference: string
quantity: number
Expand Down Expand Up @@ -266,8 +266,8 @@ export type {
ProductDiscount,
ProductFilterMinMax,
ProductHeaderSummary,
ProductImageUrls,
ProductImageInformation,
ProductImageUrls,
ProductInformations,
ProductOrderConfirmation,
ProductPackItem,
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ export {default as boProductsCreateTabDetailsPage} from '@pages/BO/catalog/produ
export {default as boProductsCreateTabOptionsPage} from '@pages/BO/catalog/products/create/tabOptions';
export {default as boProductsCreateTabPackPage} from '@pages/BO/catalog/products/create/tabPack';
export {default as boProductsCreateTabPricingPage} from '@pages/BO/catalog/products/create/tabPricing';
export {default as boProductsCreateTabSEOPage} from '@pages/BO/catalog/products/create/tabSeo';
export {default as boProductsCreateTabSeoPage} from '@pages/BO/catalog/products/create/tabSeo';
export {default as boProductsCreateTabShippingPage} from '@pages/BO/catalog/products/create/tabShipping';
export {default as boProductsCreateTabStocksPage} from '@pages/BO/catalog/products/create/tabStocks';
export {default as boProductsCreateTabVirtualProductPage} from '@pages/BO/catalog/products/create/tabVirtualProduct';
Expand Down
6 changes: 2 additions & 4 deletions src/interfaces/BO/catalog/products/create/tabDescription.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import {BOBasePagePageInterface} from '@interfaces/BO';

import type {Page} from '@playwright/test';

import type FakerProduct from '@data/faker/product';
import type {ProductImageInformation} from '@data/types/product';
import {BOBasePagePageInterface} from '@interfaces/BO';
import type {Page} from '@playwright/test';

export interface BOProductsCreateTabDescriptionPageInterface extends BOBasePagePageInterface {
addNewCategory(page: Page, categories: string[]): Promise<void>;
Expand Down
6 changes: 2 additions & 4 deletions src/interfaces/BO/catalog/products/create/tabDetails.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import {BOBasePagePageInterface} from '@interfaces/BO';

import type {Page} from '@playwright/test';

import type FakerProduct from '@data/faker/product';
import type {ProductFeatures} from '@data/types/product';
import {BOBasePagePageInterface} from '@interfaces/BO';
import type {Page} from '@playwright/test';

export interface BOProductsCreateTabDetailsPageInterface extends BOBasePagePageInterface {
addNewCustomizations(page: Page, productData: FakerProduct): Promise<void>;
Expand Down
1 change: 0 additions & 1 deletion src/interfaces/BO/catalog/products/create/tabOptions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {BOBasePagePageInterface} from '@interfaces/BO';

import type {Page} from '@playwright/test';

export interface BOProductsCreateTabOptionsPageInterface extends BOBasePagePageInterface {
Expand Down
6 changes: 2 additions & 4 deletions src/interfaces/BO/catalog/products/create/tabPack.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import {BOBasePagePageInterface} from '@interfaces/BO';

import type {Page} from '@playwright/test';

import type {
ProductPackInformation,
ProductPackItem,
ProductPackOptions,
ProductStockMovement,
} from '@data/types/product';
import {BOBasePagePageInterface} from '@interfaces/BO';
import type {Page} from '@playwright/test';

export interface BOProductsCreateTabPackPageInterface extends BOBasePagePageInterface {
addProductToPack(page: Page, product: string, quantity: number): Promise<void>;
Expand Down
6 changes: 2 additions & 4 deletions src/interfaces/BO/catalog/products/create/tabPricing.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import {BOBasePagePageInterface} from '@interfaces/BO';

import type {Page} from '@playwright/test';

import FakerProduct from '@data/faker/product';
import type {ProductSpecificPrice} from '@data/types/product';
import {BOBasePagePageInterface} from '@interfaces/BO';
import type {Page} from '@playwright/test';

export interface BOProductsCreateTabPricingPageInterface extends BOBasePagePageInterface {
addEcoTax(page: Page, ecoTax: number): Promise<void>
Expand Down
1 change: 0 additions & 1 deletion src/interfaces/BO/catalog/products/create/tabSeo.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {BOBasePagePageInterface} from '@interfaces/BO';

import type {Page} from '@playwright/test';

export interface BOProductsCreateTabSeoPageInterface extends BOBasePagePageInterface {
Expand Down
4 changes: 1 addition & 3 deletions src/interfaces/BO/catalog/products/create/tabShipping.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import type FakerProduct from '@data/faker/product';
import {BOBasePagePageInterface} from '@interfaces/BO';

import type {Page} from '@playwright/test';

import type FakerProduct from '@data/faker/product';

export interface BOProductsCreateTabShippingPageInterface extends BOBasePagePageInterface {
clickOnEditDeliveryTimeLink(page: Page): Promise<Page>;
getValue(page: Page, inputName: string, languageId?: string): Promise<string>;
Expand Down
4 changes: 1 addition & 3 deletions src/interfaces/BO/catalog/products/create/tabStocks.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import {BOBasePagePageInterface} from '@interfaces/BO';

import type FakerProduct from '@data/faker/product';
import type {ProductStockMovement} from '@data/types/product';

import {BOBasePagePageInterface} from '@interfaces/BO';
import type {Page} from '@playwright/test';

export interface BOProductsCreateTabStocksPageInterface extends BOBasePagePageInterface {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import type FakerProduct from '@data/faker/product';
import {BOBasePagePageInterface} from '@interfaces/BO';

import type {Page} from '@playwright/test';

import type FakerProduct from '@data/faker/product';

export interface BOProductsCreateTabVirtualProductPageInterface extends BOBasePagePageInterface {
clickOnEditDefaultBehaviourLink(page: Page): Promise<Page>;
getErrorMessageInDownloadFileInput(page: Page): Promise<string>;
Expand Down
27 changes: 12 additions & 15 deletions src/interfaces/BO/catalog/products/index.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
import {BOBasePagePageInterface} from '@interfaces/BO';

import type {Page} from '@playwright/test';

import {ProductFilterMinMax} from '@data/types/product';
import type FakerProduct from '@data/faker/product';
import {type ProductFilterMinMax} from '@data/types/product';
import {type BOBasePagePageInterface} from '@interfaces/BO';
import {type Page} from '@playwright/test';

export interface BOProductsPageInterface extends BOBasePagePageInterface {
readonly alertDangerIDFilterValue: string;
readonly alertDangerPriceFilterValue: string;
readonly alertDangerQuantityFilterValue: string;
readonly modalCreateProduct: string;
readonly modalDialog: string;
readonly packOfProductsDescription: string;
readonly pageTitle: string;
readonly productWithCombinationsDescription: string;
readonly standardProductDescription: string;
readonly virtualProductDescription: string;
readonly alertDangerIDFilterValue: string;
readonly alertDangerPriceFilterValue: string;
readonly alertDangerQuantityFilterValue: string;
readonly modalCreateProduct: string;
readonly packOfProductsDescription: string;
readonly pageTitle: string;
readonly productWithCombinationsDescription: string;
readonly standardProductDescription: string;
readonly virtualProductDescription: string;

bulkActionsProduct(page: Page, action: string): Promise<string>;
bulkSelectProducts(page: Page, products?: FakerProduct[]): Promise<boolean>
Expand Down
1 change: 0 additions & 1 deletion src/interfaces/FO/category/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export interface FoCategoryPageInterface extends FOBasePagePageInterface {
hasSearchFilterType(page: Page, facetType: string, facetLabel?: string): Promise<boolean>;
isActiveFilterNotVisible(page: Page): Promise<boolean>;
isAddedToWishlist(page: Page, idxProduct: number): Promise<boolean>;
isAddedToWishlist(page: Page, idxProduct: number): Promise<boolean>;
isCategoryPage(page: Page): Promise<boolean>;
isPagesListVisible(page: Page): Promise<boolean>;
isSearchFilterDropdown(page: Page, facetType: string, facetLabel?: string): Promise<boolean>;
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/FO/product/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type {
ProductAttribute, ProductDetailsBasic, ProductImageUrls, ProductInformations,
} from '@data/types/product';
import {FOBasePagePageInterface} from '@interfaces/FO';
import type {Page} from '@playwright/test';
import {type Page} from '@playwright/test';

export interface FoProductPageInterface extends FOBasePagePageInterface {
readonly messageAlertNotificationAlreadyRegistered:string;
Expand Down
12 changes: 9 additions & 3 deletions src/pages/BO/BOBasePage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {type BOBasePagePageInterface} from '@interfaces/BO';
import CommonPage from '@pages/commonPage';

import {Frame, Page} from '@playwright/test';
import testContext from '@utils/test';
import utilsTest from '@utils/test';
import type {PageFunction} from 'playwright-core/types/structs';
import semver from 'semver';

Expand Down Expand Up @@ -735,7 +735,7 @@ export default class BOBasePage extends CommonPage implements BOBasePagePageInte
await this.scrollTo(page, linkSelector);
await this.clickAndWaitForURL(page, linkSelector);

const shopVersion = testContext.getPSVersion();
const shopVersion = utilsTest.getPSVersion();
let linkActiveClass: string = '-active';

// >= 1.7.8.0
Expand Down Expand Up @@ -1072,7 +1072,13 @@ export default class BOBasePage extends CommonPage implements BOBasePagePageInte
* @return {Promise<string|null>}
*/
async getGrowlMessageContent(page: Page, timeout: number = 10000): Promise<string | null> {
return page.textContent(this.growlMessageBlock, {timeout});
const psVersion = utilsTest.getPSVersion();
let {growlMessageBlock} = this;

if (semver.lt(psVersion, '8.0.0')) {
growlMessageBlock = `${this.growlDiv} .growl-message`;
}
return page.textContent(growlMessageBlock, {timeout});
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/pages/BO/catalog/products/create/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type {BOProductsCreatePageInterface} from '@interfaces/BO/catalog/products/create';
import testContext from '@utils/test';
import utilsTest from '@utils/test';
import semver from 'semver';

const psVersion = testContext.getPSVersion();
const psVersion = utilsTest.getPSVersion();

/* eslint-disable global-require, @typescript-eslint/no-var-requires */
function requirePage(): BOProductsCreatePageInterface {
Expand Down
4 changes: 2 additions & 2 deletions src/pages/BO/dashboard/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type {DashboardPageInterface} from '@interfaces/BO/dashboard';
import testContext from '@utils/test';
import utilsTest from '@utils/test';
import semver from 'semver';

const psVersion = testContext.getPSVersion();
const psVersion = utilsTest.getPSVersion();

/* eslint-disable global-require */
function requirePage(): DashboardPageInterface {
Expand Down
4 changes: 2 additions & 2 deletions src/pages/BO/login/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type {LoginPageInterface} from '@interfaces/BO/login';
import testContext from '@utils/test';
import utilsTest from '@utils/test';
import semver from 'semver';

const psVersion = testContext.getPSVersion();
const psVersion = utilsTest.getPSVersion();

/* eslint-disable global-require, @typescript-eslint/no-var-requires */
function requirePage(): LoginPageInterface {
Expand Down
4 changes: 2 additions & 2 deletions src/pages/BO/modules/blockwishlist/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type {ModuleBlockwishlistMainPageInterface} from '@interfaces/BO/modules/blockwishlist/index';
import testContext from '@utils/test';
import utilsTest from '@utils/test';
import semver from 'semver';

const psVersion = testContext.getPSVersion();
const psVersion = utilsTest.getPSVersion();

/* eslint-disable global-require */
function requirePage(): ModuleBlockwishlistMainPageInterface {
Expand Down
4 changes: 2 additions & 2 deletions src/pages/BO/modules/blockwishlist/statistics.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type {ModuleBlockwishlistStatisticsPageInterface} from '@interfaces/BO/modules/blockwishlist/statistics';
import testContext from '@utils/test';
import utilsTest from '@utils/test';
import semver from 'semver';

const psVersion = testContext.getPSVersion();
const psVersion = utilsTest.getPSVersion();

/* eslint-disable global-require */
function requirePage(): ModuleBlockwishlistStatisticsPageInterface {
Expand Down
4 changes: 2 additions & 2 deletions src/pages/BO/modules/moduleManager/uninstalledModules.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type {ModuleManagerUninstalledModulesPageInterface} from '@interfaces/BO/modules/moduleManager/uninstalledModules';
import testContext from '@utils/test';
import utilsTest from '@utils/test';
import semver from 'semver';

const psVersion = testContext.getPSVersion();
const psVersion = utilsTest.getPSVersion();

/* eslint-disable global-require, @typescript-eslint/no-var-requires */
function requirePage(): ModuleManagerUninstalledModulesPageInterface {
Expand Down
4 changes: 2 additions & 2 deletions src/pages/BO/orders/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type {BOOrdersPageInterface} from '@interfaces/BO/orders';
import testContext from '@utils/test';
import utilsTest from '@utils/test';
import semver from 'semver';

const psVersion = testContext.getPSVersion();
const psVersion = utilsTest.getPSVersion();

/* eslint-disable global-require, @typescript-eslint/no-var-requires */
function requirePage(): BOOrdersPageInterface {
Expand Down
4 changes: 2 additions & 2 deletions src/pages/FO/classic/cart/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type {FoCartPageInterface} from '@interfaces/FO/cart';
import testContext from '@utils/test';
import utilsTest from '@utils/test';
import semver from 'semver';

const psVersion = testContext.getPSVersion();
const psVersion = utilsTest.getPSVersion();

/* eslint-disable global-require, @typescript-eslint/no-var-requires */
function requirePage(): FoCartPageInterface {
Expand Down
4 changes: 2 additions & 2 deletions src/pages/FO/classic/checkout/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type {FoCheckoutPageInterface} from '@interfaces/FO/checkout';
import testContext from '@utils/test';
import utilsTest from '@utils/test';
import semver from 'semver';

const psVersion = testContext.getPSVersion();
const psVersion = utilsTest.getPSVersion();

/* eslint-disable global-require, @typescript-eslint/no-var-requires */
function requirePage(): FoCheckoutPageInterface {
Expand Down
4 changes: 2 additions & 2 deletions src/pages/FO/classic/checkout/orderConfirmation.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type {FoCheckoutOrderConfirmationPageInterface} from '@interfaces/FO/checkout/orderConfirmation';
import testContext from '@utils/test';
import utilsTest from '@utils/test';
import semver from 'semver';

const psVersion = testContext.getPSVersion();
const psVersion = utilsTest.getPSVersion();

/* eslint-disable global-require, @typescript-eslint/no-var-requires */
function requirePage(): FoCheckoutOrderConfirmationPageInterface {
Expand Down
4 changes: 2 additions & 2 deletions src/pages/FO/classic/home/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type {FoHomePageInterface} from '@interfaces/FO/home';
import testContext from '@utils/test';
import utilsTest from '@utils/test';
import semver from 'semver';

const psVersion = testContext.getPSVersion();
const psVersion = utilsTest.getPSVersion();

/* eslint-disable global-require, @typescript-eslint/no-var-requires */
function requirePage(): FoHomePageInterface {
Expand Down
4 changes: 2 additions & 2 deletions src/pages/FO/classic/login/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type {FoLoginPageInterface} from '@interfaces/FO/login';
import testContext from '@utils/test';
import utilsTest from '@utils/test';
import semver from 'semver';

const psVersion = testContext.getPSVersion();
const psVersion = utilsTest.getPSVersion();

/* eslint-disable global-require, @typescript-eslint/no-var-requires */
function requirePage(): FoLoginPageInterface {
Expand Down
Loading
Loading