Skip to content

Commit

Permalink
Added support for ps_emailalerts
Browse files Browse the repository at this point in the history
  • Loading branch information
Progi1984 committed May 28, 2024
1 parent 864d7db commit 8efcae3
Show file tree
Hide file tree
Showing 56 changed files with 3,605 additions and 1,858 deletions.
1,060 changes: 1,014 additions & 46 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
"dependencies": {
"@faker-js/faker": "^8.3.1",
"@playwright/test": "^1.40.1",
"csv-writer": "^1.6.0",
"jpeg-js": "^0.4.4",
"js-image-generator": "^1.0.4",
"pdfjs-dist": "^3.4.120",
"semver": "^7.5.4"
},
"devDependencies": {
Expand Down
32 changes: 32 additions & 0 deletions src/data/faker/import.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import type {
ImportAddress,
ImportBrand,
ImportCategory,
ImportCombination,
ImportCreator,
ImportCustomer,
ImportHeaderItem,
ImportProduct,
} from '@data/types/import';

/**
* Create new address to use in customer address form on BO and FO
* @class
*/
export default class FakerImport {
public readonly entity: string;

public readonly header: ImportHeaderItem[];

public readonly records: ImportAddress[]|ImportBrand[]|ImportCategory[]|ImportCombination[]|ImportCustomer[]|ImportProduct[];

/**
* Constructor for class ImportData
* @param valueToCreate {ImportCreator} Could be used to force the value of some members
*/
constructor(valueToCreate: ImportCreator) {
this.entity = valueToCreate.entity;
this.header = valueToCreate.header;
this.records = valueToCreate.records;
}
}
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
119 changes: 119 additions & 0 deletions src/data/types/import.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
type ImportAddress = {
id: number
alias: string
active: number
email: string
customerID: number
manufacturer: string
supplier: string
company: string
lastname: string
firstname: string
address1: string
address2: string
zipCode: string
city: string
country: string
state: string
other: string
phone: string
mobilePhone: string
vatNumber: string
dni: string
};

type ImportBrand = {
id: number
active: number
name: string
description: string
shortDescription: string
metaTitle: string
metaKeywords: string[]
metaDescription: string
imageURL: string
};

type ImportCategory = {
id: number
active: number
name: string
parent_category: string
root_category: string
description: string
};

type ImportCombination = {
id: number
reference: string
attribute: string
value: string
};

type ImportCreator = {
entity: string
header: ImportHeaderItem[]
records: ImportAddress[]|ImportBrand[]|ImportCategory[]|ImportCombination[]|ImportCustomer[]|ImportProduct[]
}

type ImportCustomer = {
id: number
active: number
title: number
email: string
password: string
birthdate: string
lastName: string
firstName: string
newsletter: number
optIn: number
registrationDate: string
groups: string
defaultGroup: string
};

type ImportHeaderItem = {
id: string
title: string
}

type ImportProduct = {
id: number
active: number
name: string
categories: string
price_TEXC: string
tax_rule_id: string
cost_price: string
on_sale: string
discount_amount: string
discount_percent: string
discount_from: string
discount_to: string
reference: string
supplier_reference: string
supplier: string
brand: string
ean13: string
upc: string
value: string
mpn: string
width: string
height: string
depth: string
weight: string
delivery_time_in_stock: string
delivery_time_out_of_stock: string
quantity: number
};

export type {
ImportAddress,
ImportBrand,
ImportCategory,
ImportCombination,
ImportCreator,
ImportCustomer,
ImportHeaderItem,
ImportProduct,
};
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 @@ -184,16 +194,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 @@ -245,8 +245,8 @@ export type {
ProductDiscount,
ProductFilterMinMax,
ProductHeaderSummary,
ProductImageUrls,
ProductImageInformation,
ProductImageUrls,
ProductInformations,
ProductPackItem,
ProductPackInformation,
Expand Down
15 changes: 12 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export {default as FakerCountry} from '@data/faker/country';
export {default as FakerCurrency} from '@data/faker/currency';
export {default as FakerCustomer} from '@data/faker/customer';
export {default as FakerGroup} from '@data/faker/group';
export {default as FakerImport} from '@data/faker/import';
export {default as FakerModule} from '@data/faker/module';
export {default as FakerOrderStatus} from '@data/faker/orderStatus';
export {default as FakerOrder} from '@data/faker/order';
Expand All @@ -60,12 +61,19 @@ export {default as FakerTax} from '@data/faker/tax';
export {default as FakerTitle} from '@data/faker/title';
export {default as FakerZone} from '@data/faker/zone';

// Export common
export {default as opsBOCatalogProduct} from '@ops/BO/catalog/product';

// Export Pages
export * as CommonPage from '@pages/commonPage';
// Export Pages BO
export * as BOBasePage from '@pages/BO/BOBasePage';
export {default as boLoginPage} from '@pages/BO/login';
export {default as boDashboardPage} from '@pages/BO/dashboard';
export {default as boDesignPositionsPage} from '@pages/BO/design/positions/index';
export {default as boDesignPositionsHookModulePage} from '@pages/BO/design/positions/hookModule';
export {default as boModuleManagerPage} from '@pages/BO/modules/moduleManager';
export {default as boModuleManagerUninstalledModulesPage} from '@pages/BO/modules/moduleManager/uninstalledModules';
export {default as boOrdersPage} from '@pages/BO/orders';
export {default as boOrdersViewBasePage} from '@pages/BO/orders/view/viewOrderBasePage';
export {default as boOrdersViewProductsBlockPage} from '@pages/BO/orders/view/productsBlock';
Expand All @@ -77,7 +85,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 All @@ -97,5 +105,6 @@ export {default as modBlockwishlistBoMain} from '@pages/BO/modules/blockwishlist
export {default as modBlockwishlistBoStatistics} from '@pages/BO/modules/blockwishlist/statistics';

// Export utils
export {default as testContext} from '@utils/test';
export {default as basicHelper} from '@utils/basicHelper';
export {default as utilsBasicHelper} from '@utils/basicHelper';
export {default as utilsFile} from '@utils/file';
export {default as utilsTest} from '@utils/test';
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
Loading

0 comments on commit 8efcae3

Please sign in to comment.