diff --git a/src/common/BO/loginBO.ts b/src/common/BO/loginBO.ts index 7a6e624f..fb105c85 100644 --- a/src/common/BO/loginBO.ts +++ b/src/common/BO/loginBO.ts @@ -1,6 +1,6 @@ //import testContext from '@utils/testContext'; -import loginPage from '@pages/BO/login'; +let loginPage = require('@pages/BO/login'); import dashboardPage from '@pages/BO/dashboard'; import {expect} from '@playwright/test'; @@ -15,7 +15,10 @@ export default { ): Promise { //await testContext.addContextItem(testInfo, 'testIdentifier', 'loginBO'); - //await loginPage.goTo(page, global.BO.URL); + console.log(loginPage); + console.log(loginPage.goTo); + + await loginPage.goTo(page, global.BO.URL); await loginPage.successLogin(page, email, password); const pageTitle = await dashboardPage.getPageTitle(page); diff --git a/src/interfaces/BO/dashboard/index.ts b/src/interfaces/BO/dashboard/index.ts index e4670ea4..66070005 100644 --- a/src/interfaces/BO/dashboard/index.ts +++ b/src/interfaces/BO/dashboard/index.ts @@ -1,3 +1,5 @@ -export interface DashboardPageInterface { +import { BOBasePagePageInterface } from "@interfaces/BO"; + +export interface DashboardPageInterface extends BOBasePagePageInterface { readonly pageTitle: string; } diff --git a/src/interfaces/BO/index.ts b/src/interfaces/BO/index.ts new file mode 100644 index 00000000..e204130e --- /dev/null +++ b/src/interfaces/BO/index.ts @@ -0,0 +1,6 @@ +import type { CommonPageInterface } from "@interfaces/index"; +import type { Page } from "@playwright/test"; + +export interface BOBasePagePageInterface extends CommonPageInterface { + logoutBO(page: Page): Promise; +} \ No newline at end of file diff --git a/src/interfaces/BO/login/index.ts b/src/interfaces/BO/login/index.ts index cbcc6764..80631047 100644 --- a/src/interfaces/BO/login/index.ts +++ b/src/interfaces/BO/login/index.ts @@ -1,6 +1,9 @@ +import { BOBasePagePageInterface } from "@interfaces/BO"; + import type {Page} from '@playwright/test'; -export interface LoginPageInterface { + +export interface LoginPageInterface extends BOBasePagePageInterface { readonly pageTitle: string; successLogin(page: Page, email: string, password: string): Promise; diff --git a/src/interfaces/index.ts b/src/interfaces/index.ts new file mode 100644 index 00000000..f350d4f4 --- /dev/null +++ b/src/interfaces/index.ts @@ -0,0 +1,7 @@ +import type { Page } from "@playwright/test"; + +export interface CommonPageInterface { + getPageTitle(page: Page): Promise; + + goTo(page: Page, url: string): Promise; +} \ No newline at end of file diff --git a/src/pages/BO/dashboard/index.ts b/src/pages/BO/dashboard/index.ts index 063aa5e6..65205b7e 100644 --- a/src/pages/BO/dashboard/index.ts +++ b/src/pages/BO/dashboard/index.ts @@ -1,11 +1,12 @@ +import type { DashboardPageInterface } from '@interfaces/BO/dashboard'; import semver from 'semver'; const psVersion = process.env.PS_VERSION ?? '99.99.99'; -let Dashboard: any; +let Dashboard: DashboardPageInterface; if (semver.gte(psVersion, '8.0.0')) { Dashboard = require('@versions/8.0.0/pages/BO/dashboard'); } else { Dashboard = require('@versions/8.0.0/pages/BO/dashboard'); } -export default Dashboard.constructor(); +export default Dashboard; diff --git a/src/pages/BO/login/index.ts b/src/pages/BO/login/index.ts index b9c935cc..f62dd6bc 100644 --- a/src/pages/BO/login/index.ts +++ b/src/pages/BO/login/index.ts @@ -1,11 +1,12 @@ +import type { LoginPageInterface } from '@interfaces/BO/login'; import semver from 'semver'; const psVersion = process.env.PS_VERSION ?? '99.99.99'; -let Login: any; -if (semver.gte(psVersion, '8.0.0')) {= +let Login: LoginPageInterface; +if (semver.gte(psVersion, '8.0.0')) { Login = require('@versions/8.0.0/pages/BO/login'); } else { Login = require('@versions/8.0.0/pages/BO/login'); } -export default Login.constructor(); +export default Login; diff --git a/src/versions/8.0.0/pages/BO/dashboard/index.ts b/src/versions/8.0.0/pages/BO/dashboard/index.ts index 6ec14568..b1ccbfab 100644 --- a/src/versions/8.0.0/pages/BO/dashboard/index.ts +++ b/src/versions/8.0.0/pages/BO/dashboard/index.ts @@ -9,7 +9,7 @@ import {DashboardPageInterface} from '@interfaces/BO/dashboard'; * @class * @extends BOBasePage */ -export default class Dashboard extends BOBasePage implements DashboardPageInterface { +class Dashboard extends BOBasePage implements DashboardPageInterface { public readonly pageTitle: string; private readonly demoModeButton: string; @@ -624,3 +624,5 @@ export default class Dashboard extends BOBasePage implements DashboardPageInterf return this.getTextContent(page, this.helpCardDocumentTitle); } } + +export default new Dashboard(); \ No newline at end of file diff --git a/src/versions/8.0.0/pages/BO/login/index.ts b/src/versions/8.0.0/pages/BO/login/index.ts index d81ff221..2d6154a8 100644 --- a/src/versions/8.0.0/pages/BO/login/index.ts +++ b/src/versions/8.0.0/pages/BO/login/index.ts @@ -9,7 +9,7 @@ import type {Page} from 'playwright'; * @class * @extends BOBasePage */ -export default class Login extends BOBasePage implements LoginPageInterface { +class Login extends BOBasePage implements LoginPageInterface { public readonly pageTitle: string; public readonly loginErrorText: string; @@ -183,3 +183,5 @@ export default class Login extends BOBasePage implements LoginPageInterface { return this.getTextContent(page, this.resetPasswordSuccessConfirmationText); } } + +export default new Login(); \ No newline at end of file