Skip to content

Commit

Permalink
@utils : Added file & Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Progi1984 committed May 2, 2024
1 parent 2c3e92d commit 6e19559
Show file tree
Hide file tree
Showing 19 changed files with 1,477 additions and 77 deletions.
1,059 changes: 1,013 additions & 46 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
"dependencies": {
"@faker-js/faker": "^8.3.1",
"@playwright/test": "^1.40.1",
"csv-writer": "^1.6.0",
"js-image-generator": "^1.0.4",
"pdfjs-dist": "^3.4.120",
"semver": "^7.5.4"
},
"devDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,5 @@ 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/testContext';
export {default as utilsFile} from '@utils/file';
export {default as utilsTest} from '@utils/test';
9 changes: 5 additions & 4 deletions src/pages/BO/BOBasePage.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// Import pages
import { BOBasePagePageInterface } from '@interfaces/BO';
import CommonPage from '@pages/commonPage';

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

Expand All @@ -11,7 +12,7 @@ import semver from 'semver';
* @class
* @extends CommonPage
*/
export default class BOBasePage extends CommonPage {
export default class BOBasePage extends CommonPage implements BOBasePagePageInterface {
public successfulCreationMessage: string;

public successfulUpdateMessage: string;
Expand Down Expand Up @@ -718,7 +719,7 @@ export default class BOBasePage extends CommonPage {
await this.scrollTo(page, linkSelector);
await this.clickAndWaitForURL(page, linkSelector);

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

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

if (semver.lt(psVersion, '8.0.0')) {
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/testContext';
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/testContext';
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/testContext';
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/testContext';
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/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type {ModuleManagerPageInterface} from '@interfaces/BO/modules/moduleManager';
import testContext from '@utils/testContext';
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(): ModuleManagerPageInterface {
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/testContext';
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/testContext';
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/testContext';
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/category/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type {FoCategoryPageInterface} from '@interfaces/FO/category';
import testContext from '@utils/testContext';
import utilsTest from '@utils/test';
import semver from 'semver';

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

/* eslint-disable global-require */
function requirePage(): FoCategoryPageInterface {
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/testContext';
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/testContext';
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/testContext';
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/testContext';
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

0 comments on commit 6e19559

Please sign in to comment.