From 31dd9f5975e26a9ccece8b9196774bf9477761e4 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Wed, 18 Dec 2024 10:14:35 +0100 Subject: [PATCH] `boCarriersPage` : Adapt the page for v9 --- src/pages/BO/shipping/carriers/create.ts | 9 ++++++++- src/pages/BO/shipping/carriers/index.ts | 9 ++++++++- src/versions/8.2/pages/BO/shipping/carriers/create.ts | 8 ++++++++ src/versions/8.2/pages/BO/shipping/carriers/index.ts | 8 ++++++++ .../develop/pages/BO/shipping/carriers/create.ts | 3 ++- src/versions/develop/pages/BO/shipping/carriers/index.ts | 3 ++- 6 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 src/versions/8.2/pages/BO/shipping/carriers/create.ts create mode 100644 src/versions/8.2/pages/BO/shipping/carriers/index.ts diff --git a/src/pages/BO/shipping/carriers/create.ts b/src/pages/BO/shipping/carriers/create.ts index 77323568..a4de29cb 100644 --- a/src/pages/BO/shipping/carriers/create.ts +++ b/src/pages/BO/shipping/carriers/create.ts @@ -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 */ diff --git a/src/pages/BO/shipping/carriers/index.ts b/src/pages/BO/shipping/carriers/index.ts index 645d172f..12eae1d7 100644 --- a/src/pages/BO/shipping/carriers/index.ts +++ b/src/pages/BO/shipping/carriers/index.ts @@ -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 */ diff --git a/src/versions/8.2/pages/BO/shipping/carriers/create.ts b/src/versions/8.2/pages/BO/shipping/carriers/create.ts new file mode 100644 index 00000000..88106bfd --- /dev/null +++ b/src/versions/8.2/pages/BO/shipping/carriers/create.ts @@ -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'; + +class BOCarriersCreatePage extends BOCarriersCreatePageVersion implements BOCarriersCreatePageInterface { +} + +module.exports = new BOCarriersCreatePage(); diff --git a/src/versions/8.2/pages/BO/shipping/carriers/index.ts b/src/versions/8.2/pages/BO/shipping/carriers/index.ts new file mode 100644 index 00000000..3e014fe8 --- /dev/null +++ b/src/versions/8.2/pages/BO/shipping/carriers/index.ts @@ -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'; + +class BOCarriersPage extends BOCarriersPageVersion implements BOCarriersPageInterface { +} + +module.exports = new BOCarriersPage(); diff --git a/src/versions/develop/pages/BO/shipping/carriers/create.ts b/src/versions/develop/pages/BO/shipping/carriers/create.ts index 5f014a1d..39f5103d 100644 --- a/src/versions/develop/pages/BO/shipping/carriers/create.ts +++ b/src/versions/develop/pages/BO/shipping/carriers/create.ts @@ -275,4 +275,5 @@ class BOCarriersCreatePage extends BOBasePage implements BOCarriersCreatePageInt } } -module.exports = new BOCarriersCreatePage(); +const boCarriersCreatePage = new BOCarriersCreatePage(); +export {boCarriersCreatePage, BOCarriersCreatePage}; diff --git a/src/versions/develop/pages/BO/shipping/carriers/index.ts b/src/versions/develop/pages/BO/shipping/carriers/index.ts index df6531f9..99ebfa48 100644 --- a/src/versions/develop/pages/BO/shipping/carriers/index.ts +++ b/src/versions/develop/pages/BO/shipping/carriers/index.ts @@ -579,4 +579,5 @@ class BOCarriersPage extends BOBasePage implements BOCarriersPageInterface { } } -module.exports = new BOCarriersPage(); +const boCarriersPage = new BOCarriersPage(); +export {boCarriersPage, BOCarriersPage};