Skip to content

Commit

Permalink
Fixed ESLint
Browse files Browse the repository at this point in the history
  • Loading branch information
Progi1984 committed May 28, 2024
1 parent f5d2666 commit cd7c8e1
Show file tree
Hide file tree
Showing 34 changed files with 208 additions and 115 deletions.
5 changes: 3 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"@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"
Expand Down
11 changes: 0 additions & 11 deletions src/data/types/product.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,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 @@ -257,7 +247,6 @@ export type {
ProductHeaderSummary,
ProductImageInformation,
ProductImageUrls,
ProductImageInformation,
ProductInformations,
ProductPackItem,
ProductPackInformation,
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ 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 {default as opsBOCatalogProduct} from '@ops/BO/catalog/product';

// Export Pages
export * as CommonPage from '@pages/commonPage';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {type BOBasePagePageInterface} from '@interfaces/BO';
import { Page } from '@playwright/test';
import {Page} from '@playwright/test';
import FakerProduct from '@data/faker/product';

export interface BOCatalogProductsCreateTabDescriptionPageInterface extends BOBasePagePageInterface {
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/BO/catalog/products/create/tabDetails.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {type BOBasePagePageInterface} from '@interfaces/BO';
import { Page } from '@playwright/test';
import {Page} from '@playwright/test';
import FakerProduct from '@data/faker/product';

export interface BOCatalogProductsCreateTabDetailsPageInterface extends BOBasePagePageInterface {
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/BO/catalog/products/create/tabPricing.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {type BOBasePagePageInterface} from '@interfaces/BO';
import {type Page } from '@playwright/test';
import {type Page} from '@playwright/test';
import FakerProduct from '@data/faker/product';

export interface BOCatalogProductsCreateTabPricingPageInterface extends BOBasePagePageInterface {
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/BO/catalog/products/create/tabStocks.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import FakerProduct from '@data/faker/product';
import {type BOBasePagePageInterface} from '@interfaces/BO';
import { Page } from '@playwright/test';
import {Page} from '@playwright/test';

export interface BOCatalogProductsCreateTabStocksPageInterface extends BOBasePagePageInterface {
setProductStock(page: Page, productData: FakerProduct): Promise<void>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import FakerProduct from '@data/faker/product';
import {type BOBasePagePageInterface} from '@interfaces/BO';
import { Page } from '@playwright/test';
import {Page} from '@playwright/test';

export interface BOCatalogProductsCreateTabVirtualProductPageInterface extends BOBasePagePageInterface {
setVirtualProduct(page: Page, productData: FakerProduct): Promise<void>;
Expand Down
11 changes: 4 additions & 7 deletions src/interfaces/BO/catalog/products/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import {BOBasePagePageInterface} from '@interfaces/BO';

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

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

export interface BOCatalogProductsPageInterface 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;
Expand All @@ -23,7 +20,7 @@ export interface BOCatalogProductsPageInterface extends BOBasePagePageInterface
clickOnCancelDialogButton(page: Page): Promise<boolean>;
clickOnClearFilterLink(page: Page): Promise<void>;
clickOnConfirmDialogButton(page: Page): Promise<string>;
clickOnDeleteProductButton(page: Page, row: number): Promise<boolean>;
clickOnDeleteProductButton(page: Page, row?: number): Promise<boolean>;
clickOnDeleteProductFromStoreButton(page: Page, row: number): Promise<boolean>;
clickOnDuplicateProductButton(page: Page, row: number): Promise<boolean>;
clickOnNewProductButton(page: Page): Promise<boolean>;
Expand Down
5 changes: 3 additions & 2 deletions src/interfaces/FO/product/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import ProductReviewData from '@data/faker/productReview';
import type {
ProductAttribute, ProductImageUrls, ProductInformations,
} from '@data/types/product';import {FOBasePagePageInterface} from '@interfaces/FO';
} from '@data/types/product';
import {FOBasePagePageInterface} from '@interfaces/FO';
import {type Page} from '@playwright/test';

export interface FoProductPageInterface extends FOBasePagePageInterface {
Expand Down Expand Up @@ -68,6 +69,7 @@ export interface FoProductPageInterface extends FOBasePagePageInterface {
hasProductFlag(page: Page, name: string): Promise<boolean>;
hasProductReviewGDPRLabel(page: Page): Promise<boolean>;
hasProductsBlock(page: Page, blockName:string): Promise<boolean>;
isAddToCartButtonDisplayed(page: Page): Promise<boolean>;
isAddToCartButtonEnabled(page: Page): Promise<boolean>;
isAvailabilityQuantityDisplayed(page: Page): Promise<boolean>;
isCustomizationBlockVisible(page: Page): Promise<boolean>;
Expand All @@ -83,7 +85,6 @@ export interface FoProductPageInterface extends FOBasePagePageInterface {
isUnavailableProductColorDisplayed(page: Page, color: string): Promise<boolean>;
isUnavailableProductSizeDisplayed(page: Page, size: string): Promise<boolean>;
notifyEmailAlert(page: Page, email: string | null): Promise<string>;
sAddToCartButtonDisplayed(page: Page): Promise<boolean>;
scrollBoxArrowsImages(page: Page, direction: string): Promise<void>;
selectAttributes(page: Page, type: string, attributes: ProductAttribute[], itemNumber: number): Promise<void>;
selectDefaultAttributes(page: Page, attributes: ProductAttribute[]): Promise<void>;
Expand Down
7 changes: 7 additions & 0 deletions src/interfaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ export interface CommonPageInterface {
getPageTitle(page: Page): Promise<string>;
goTo(page: Page, url: string): Promise<void>;
goToFo(page: Page): Promise<void>;
openLinkWithTargetBlank(
page: Page,
selector: string,
newPageSelector?: string,
state?: 'load' | 'domcontentloaded' | 'networkidle',
waitForVisible?: boolean,
): Promise<Page>
reloadPage(page: Page): Promise<void>;
resize(page: Page, mobileSize: boolean): Promise<void>;
}
14 changes: 6 additions & 8 deletions src/ops/BO/catalog/product.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import test, { Page, expect } from '@playwright/test';
import test, {Page, expect} from '@playwright/test';
import FakerProduct from '@data/faker/product';
import boProductsPage from '@pages/BO/catalog/products';
import boProductsCreatePage from '@pages/BO/catalog/products/create';
import boDashboardPage from '@pages/BO/dashboard';
import boLoginPage from '@pages/BO/login';
import utilsTest from '@utils/test';

let numberOfProducts: number;

export default {
/**
* Function to create standard product
Expand Down Expand Up @@ -128,12 +126,12 @@ export default {
});
},

/**
/**
* Function to bulk delete product
* @param productName {string} Value to set on product name input
* @param baseContext {string} String to identify the test
*/
/*
/*
function bulkDeleteProductsTest(productName: string, baseContext: string = 'commonTests-bulkDeleteProductsTest'): void {
describe('POST-TEST: Bulk delete created products', async () => {
let numberOfProductsAfterFilter: number;
Expand All @@ -150,10 +148,10 @@ function bulkDeleteProductsTest(productName: string, baseContext: string = 'comm
await test.step('should login in BO', async () => {
await utilsTest.addContextItem(test.info(), 'testIdentifier', 'loginBO', baseContext);
await boLoginPage.goTo(page, global.BO.URL);
await boLoginPage.successLogin(page, global.BO.EMAIL, global.BO.PASSWD);
const pageTitle = await boDashboardPage.getPageTitle(page);
expect(pageTitle).toContain(boDashboardPage.pageTitle);
});
Expand Down Expand Up @@ -222,4 +220,4 @@ function bulkDeleteProductsTest(productName: string, baseContext: string = 'comm
});
}*/

};
};
2 changes: 1 addition & 1 deletion src/pages/BO/catalog/products/create/tabCombinations.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BOCatalogProductsCreateTabCombinationsPageInterface } from "@interfaces/BO/catalog/products/create/tabCombinations";
import {BOCatalogProductsCreateTabCombinationsPageInterface} from '@interfaces/BO/catalog/products/create/tabCombinations';

/* eslint-disable global-require, @typescript-eslint/no-var-requires */
function requirePage(): BOCatalogProductsCreateTabCombinationsPageInterface {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/BO/catalog/products/create/tabDescription.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { BOCatalogProductsCreateTabDescriptionPageInterface } from '@interfaces/BO/catalog/products/create/tabDescription';
import type {BOCatalogProductsCreateTabDescriptionPageInterface} from '@interfaces/BO/catalog/products/create/tabDescription';

/* eslint-disable global-require, @typescript-eslint/no-var-requires */
function requirePage(): BOCatalogProductsCreateTabDescriptionPageInterface {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/BO/catalog/products/create/tabDetails.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { BOCatalogProductsCreateTabDetailsPageInterface } from "@interfaces/BO/catalog/products/create/tabDetails";
import type {BOCatalogProductsCreateTabDetailsPageInterface} from '@interfaces/BO/catalog/products/create/tabDetails';

/* eslint-disable global-require, @typescript-eslint/no-var-requires */
function requirePage(): BOCatalogProductsCreateTabDetailsPageInterface {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/BO/catalog/products/create/tabOptions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { BOCatalogProductsCreateTabOptionsPageInterface } from "@interfaces/BO/catalog/products/create/tabOptions";
import type {BOCatalogProductsCreateTabOptionsPageInterface} from '@interfaces/BO/catalog/products/create/tabOptions';

/* eslint-disable global-require, @typescript-eslint/no-var-requires */
function requirePage(): BOCatalogProductsCreateTabOptionsPageInterface {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/BO/catalog/products/create/tabPack.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { BOCatalogProductsCreateTabPackPageInterface } from '@interfaces/BO/catalog/products/create/tabPack';
import type {BOCatalogProductsCreateTabPackPageInterface} from '@interfaces/BO/catalog/products/create/tabPack';

/* eslint-disable global-require, @typescript-eslint/no-var-requires */
function requirePage(): BOCatalogProductsCreateTabPackPageInterface {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/BO/catalog/products/create/tabPricing.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { BOCatalogProductsCreateTabPricingPageInterface } from "@interfaces/BO/catalog/products/create/tabPricing";
import type {BOCatalogProductsCreateTabPricingPageInterface} from '@interfaces/BO/catalog/products/create/tabPricing';

/* eslint-disable global-require, @typescript-eslint/no-var-requires */
function requirePage(): BOCatalogProductsCreateTabPricingPageInterface {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/BO/catalog/products/create/tabSeo.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { BOCatalogProductsCreateTabSeoPageInterface } from "@interfaces/BO/catalog/products/create/tabSeo";
import type {BOCatalogProductsCreateTabSeoPageInterface} from '@interfaces/BO/catalog/products/create/tabSeo';

/* eslint-disable global-require, @typescript-eslint/no-var-requires */
function requirePage(): BOCatalogProductsCreateTabSeoPageInterface {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/BO/catalog/products/create/tabShipping.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { BOCatalogProductsCreateTabShippingPageInterface } from '@interfaces/BO/catalog/products/create/tabShipping';
import type {BOCatalogProductsCreateTabShippingPageInterface} from '@interfaces/BO/catalog/products/create/tabShipping';

/* eslint-disable global-require, @typescript-eslint/no-var-requires */
function requirePage(): BOCatalogProductsCreateTabShippingPageInterface {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/BO/catalog/products/create/tabStocks.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { BOCatalogProductsCreateTabStocksPageInterface } from '@interfaces/BO/catalog/products/create/tabStocks';
import type {BOCatalogProductsCreateTabStocksPageInterface} from '@interfaces/BO/catalog/products/create/tabStocks';

/* eslint-disable global-require, @typescript-eslint/no-var-requires */
function requirePage(): BOCatalogProductsCreateTabStocksPageInterface {
Expand Down
3 changes: 2 additions & 1 deletion src/pages/BO/catalog/products/create/tabVirtualProduct.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { BOCatalogProductsCreateTabVirtualProductPageInterface } from '@interfaces/BO/catalog/products/create/tabVirtualProduct';
import {type BOCatalogProductsCreateTabVirtualProductPageInterface}
from '@interfaces/BO/catalog/products/create/tabVirtualProduct';

/* eslint-disable global-require, @typescript-eslint/no-var-requires */
function requirePage(): BOCatalogProductsCreateTabVirtualProductPageInterface {
Expand Down
9 changes: 7 additions & 2 deletions src/pages/commonPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,21 +196,26 @@ export default class CommonPage implements CommonPageInterface {
* @param selector {string} String to locate the element for the click
* @param newPageSelector {string} String to locate the element on the opened page (default to FO logo)
* @param state {'load'|'domcontentloaded'|'networkidle'} The event to wait after click
* @param waitForVisible {boolean} true if we need to wait for visible selector
* @return {Promise<Page>} Opened tab after the click
*/
async openLinkWithTargetBlank(
page: Page,
selector: string,
newPageSelector: string = 'body .logo',
state: 'load' | 'domcontentloaded' | 'networkidle' = 'networkidle'): Promise<Page> {
state: 'load' | 'domcontentloaded' | 'networkidle' = 'networkidle',
waitForVisible: boolean = true,
): Promise<Page> {
const [newPage] = await Promise.all([
page.waitForEvent('popup'),
page.locator(selector).click(),
]);

await newPage.waitForLoadState(state);

await this.waitForVisibleSelector(newPage, newPageSelector);
if (waitForVisible) {
await this.waitForVisibleSelector(newPage, newPageSelector);
}
return newPage;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ import type ProductData from '@data/faker/product';
import type {ProductHeaderSummary} from '@data/types/product';

import type {Frame, Page} from 'playwright';
import { BOCatalogProductsCreatePageInterface } from '@interfaces/BO/catalog/products/create';
import {BOCatalogProductsCreatePageInterface} from '@interfaces/BO/catalog/products/create';

/**
* Create Product V2 page, contains functions that can be used on the page
* @class
* @extends BOBasePage
*/
class CreateProductPage extends BOBasePage implements BOCatalogProductsCreatePageInterface{
class CreateProductPage extends BOBasePage implements BOCatalogProductsCreatePageInterface {
public readonly pageTitle: string;

public readonly saveAndPublishButtonName: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
ProductCombinationOptions,
ProductStockMovement,
} from '@data/types/product';
import { BOCatalogProductsCreateTabCombinationsPageInterface } from '@interfaces/BO/catalog/products/create/tabCombinations';
import {BOCatalogProductsCreateTabCombinationsPageInterface} from '@interfaces/BO/catalog/products/create/tabCombinations';
import BOBasePage from '@pages/BO/BOBasePage';
import {expect, type Frame, type Page} from '@playwright/test';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {ProductImageInformation} from '@data/types/product';
import FakerProduct from '@data/faker/product';
import { BOCatalogProductsCreateTabDescriptionPageInterface } from '@interfaces/BO/catalog/products/create/tabDescription';
import {BOCatalogProductsCreateTabDescriptionPageInterface} from '@interfaces/BO/catalog/products/create/tabDescription';
import BOBasePage from '@pages/BO/BOBasePage';
import { Page } from '@playwright/test';
import {Page} from '@playwright/test';

/**
* Description tab on new product V2 page, contains functions that can be used on the page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import type ProductData from '@data/faker/product';
import {ProductFeatures} from '@data/types/product';

import type {Frame, Page} from 'playwright';
import { BOCatalogProductsCreateTabDetailsPageInterface } from '@interfaces/BO/catalog/products/create/tabDetails';
import { expect } from '@playwright/test';
import {BOCatalogProductsCreateTabDetailsPageInterface} from '@interfaces/BO/catalog/products/create/tabDetails';
import {expect} from '@playwright/test';

/**
* Details tab on new product V2 page, contains functions that can be used on the page
* @class
* @extends BOBasePage
*/
class DetailsTab extends BOBasePage implements BOCatalogProductsCreateTabDetailsPageInterface{
class DetailsTab extends BOBasePage implements BOCatalogProductsCreateTabDetailsPageInterface {
public readonly featureCustomValueNotDefaultLanguageMessage: string;

private readonly detailsTabLink: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type {ProductPackInformation, ProductPackItem} from '@data/types/product'

import type {Locator, Page} from 'playwright';
import {ProductPackOptions, ProductStockMovement} from '@data/types/product';
import { BOCatalogProductsCreateTabPackPageInterface } from '@interfaces/BO/catalog/products/create/tabPack';
import {BOCatalogProductsCreateTabPackPageInterface} from '@interfaces/BO/catalog/products/create/tabPack';

/**
* Pack tab on new product V2 page, contains functions that can be used on the page
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type FakerProduct from '@data/faker/product';
import type {ProductSpecificPrice} from '@data/types/product';
import { BOCatalogProductsCreateTabPricingPageInterface } from '@interfaces/BO/catalog/products/create/tabPricing';
import {BOCatalogProductsCreateTabPricingPageInterface} from '@interfaces/BO/catalog/products/create/tabPricing';
import BOBasePage from '@pages/BO/BOBasePage';
import { Page } from '@playwright/test';
import {Page} from '@playwright/test';

/**
* Pricing tab on new product V2 page, contains functions that can be used on the page
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type FakerProduct from '@data/faker/product';
import type {ProductStockMovement} from '@data/types/product';
import { BOCatalogProductsCreateTabStocksPageInterface } from '@interfaces/BO/catalog/products/create/tabStocks';
import {BOCatalogProductsCreateTabStocksPageInterface} from '@interfaces/BO/catalog/products/create/tabStocks';
import BOBasePage from '@pages/BO/BOBasePage';
import { type Page } from '@playwright/test';
import {type Page} from '@playwright/test';

/**
* Stocks tab on new product V2 page, contains functions that can be used on the page
Expand Down
Loading

0 comments on commit cd7c8e1

Please sign in to comment.