Skip to content

Commit

Permalink
boCarriersPage : Adapt the page for v9
Browse files Browse the repository at this point in the history
  • Loading branch information
Progi1984 committed Dec 18, 2024
1 parent 0b3ed30 commit 31dd9f5
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 4 deletions.
9 changes: 8 additions & 1 deletion src/pages/BO/shipping/carriers/create.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
import type {BOCarriersCreatePageInterface} from '@interfaces/BO/shipping/carriers/create';
import testContext from '@utils/test';
import semver from 'semver';

const psVersion = testContext.getPSVersion();

/* eslint-disable global-require, @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires */
function requirePage(): BOCarriersCreatePageInterface {
return require('@versions/develop/pages/BO/shipping/carriers/create');
if (semver.lt(psVersion, '9.0.0')) {
return require('@versions/8.2/pages/BO/shipping/carriers/create');
}
return require('@versions/develop/pages/BO/shipping/carriers/create').boCarriersCreatePage;
}
/* eslint-enable global-require, @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires */

Expand Down
9 changes: 8 additions & 1 deletion src/pages/BO/shipping/carriers/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
import type {BOCarriersPageInterface} from '@interfaces/BO/shipping/carriers';
import testContext from '@utils/test';
import semver from 'semver';

const psVersion = testContext.getPSVersion();

/* eslint-disable global-require, @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires */
function requirePage(): BOCarriersPageInterface {
return require('@versions/develop/pages/BO/shipping/carriers');
if (semver.lt(psVersion, '9.0.0')) {
return require('@versions/8.2/pages/BO/shipping/carriers');
}
return require('@versions/develop/pages/BO/shipping/carriers').boCarriersPage;
}
/* eslint-enable global-require, @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires */

Expand Down
8 changes: 8 additions & 0 deletions src/versions/8.2/pages/BO/shipping/carriers/create.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {BOCarriersCreatePageInterface} from '@interfaces/BO/shipping/carriers/create';
import {BOCarriersCreatePage as BOCarriersCreatePageVersion} from '@versions/develop/pages/BO/shipping/carriers/create';
import type {Page} from 'playwright';

Check failure on line 3 in src/versions/8.2/pages/BO/shipping/carriers/create.ts

View workflow job for this annotation

GitHub Actions / ESLint

'Page' is defined but never used. Allowed unused vars must match /^getPSVersion$/u

class BOCarriersCreatePage extends BOCarriersCreatePageVersion implements BOCarriersCreatePageInterface {
}

module.exports = new BOCarriersCreatePage();
8 changes: 8 additions & 0 deletions src/versions/8.2/pages/BO/shipping/carriers/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {BOCarriersPageInterface} from '@interfaces/BO/shipping/carriers';
import {BOCarriersPage as BOCarriersPageVersion} from '@versions/develop/pages/BO/shipping/carriers';
import type {Page} from 'playwright';

Check failure on line 3 in src/versions/8.2/pages/BO/shipping/carriers/index.ts

View workflow job for this annotation

GitHub Actions / ESLint

'Page' is defined but never used. Allowed unused vars must match /^getPSVersion$/u

class BOCarriersPage extends BOCarriersPageVersion implements BOCarriersPageInterface {
}

module.exports = new BOCarriersPage();
3 changes: 2 additions & 1 deletion src/versions/develop/pages/BO/shipping/carriers/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,4 +275,5 @@ class BOCarriersCreatePage extends BOBasePage implements BOCarriersCreatePageInt
}
}

module.exports = new BOCarriersCreatePage();
const boCarriersCreatePage = new BOCarriersCreatePage();
export {boCarriersCreatePage, BOCarriersCreatePage};
3 changes: 2 additions & 1 deletion src/versions/develop/pages/BO/shipping/carriers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -579,4 +579,5 @@ class BOCarriersPage extends BOBasePage implements BOCarriersPageInterface {
}
}

module.exports = new BOCarriersPage();
const boCarriersPage = new BOCarriersPage();
export {boCarriersPage, BOCarriersPage};

0 comments on commit 31dd9f5

Please sign in to comment.