diff --git a/src/common/BO/loginBO.ts b/src/common/BO/loginBO.ts index 6919dad5..97cef4bf 100644 --- a/src/common/BO/loginBO.ts +++ b/src/common/BO/loginBO.ts @@ -1,11 +1,13 @@ -import testContext from '@utils/testContext'; +//import testContext from '@utils/testContext'; -import loginPage from '@pages/BO/login'; -import dashboardPage from '@pages/BO/dashboard'; +import Login from '@pages/BO/login'; +import Dashboard from '@pages/BO/dashboard'; import {expect} from '@playwright/test'; -import type {Page} from 'playwright'; -import type {TestInfo} from '@playwright/test'; +import type {Page, TestInfo} from '@playwright/test'; + +const loginPage = new Login(); +const dashboardPage = new Dashboard(); export default { async loginBO( @@ -14,9 +16,9 @@ export default { email: string = global.BO.EMAIL, password: string = global.BO.PASSWD, ): Promise { - await testContext.addContextItem(testInfo, 'testIdentifier', 'loginBO'); + //await testContext.addContextItem(testInfo, 'testIdentifier', 'loginBO'); - await loginPage.goTo(page, global.BO.URL); + //await loginPage.goTo(page, global.BO.URL); await loginPage.successLogin(page, email, password); const pageTitle = await dashboardPage.getPageTitle(page); @@ -24,11 +26,11 @@ export default { }, async logoutBO(testInfo: TestInfo, page: Page): Promise { - await testContext.addContextItem(testInfo, 'testIdentifier', 'logoutBO'); + //await testContext.addContextItem(testInfo, 'testIdentifier', 'logoutBO'); await dashboardPage.logoutBO(page); - const pageTitle = await loginPage.getPageTitle(page); - expect(pageTitle).toContain(loginPage.pageTitle); + //const pageTitle = await loginPage.getPageTitle(page); + //expect(pageTitle).toContain(loginPage.pageTitle); }, }; diff --git a/src/interfaces/BO/login/index.ts b/src/interfaces/BO/login/index.ts index cbcc6764..cf681d9b 100644 --- a/src/interfaces/BO/login/index.ts +++ b/src/interfaces/BO/login/index.ts @@ -1,6 +1,7 @@ import type {Page} from '@playwright/test'; export interface LoginPageInterface { + readonly pageTitle: string; successLogin(page: Page, email: string, password: string): Promise; diff --git a/src/pages/BO/dashboard/index.ts b/src/pages/BO/dashboard/index.ts index 0c4a9fa6..0d42241e 100644 --- a/src/pages/BO/dashboard/index.ts +++ b/src/pages/BO/dashboard/index.ts @@ -1,12 +1,9 @@ import semver from 'semver'; -let file: string; - +let Dashboard: any; if (semver.gte(process.env.PS_VERSION as string, '8.0.0')) { - file = '@versions/8.0.0/pages/BO/dashboard'; + Dashboard = require('@versions/8.0.0/pages/BO/dashboard'); } else { - file = '@versions/8.0.0/pages/BO/dashboard'; + Dashboard = require('@versions/8.0.0/pages/BO/dashboard'); } - -const Dashboard = await import(file); export default Dashboard; diff --git a/src/pages/BO/login/index.ts b/src/pages/BO/login/index.ts index 6f8dc815..f4f098d2 100644 --- a/src/pages/BO/login/index.ts +++ b/src/pages/BO/login/index.ts @@ -1,12 +1,9 @@ import semver from 'semver'; -let file: string; - +let Login: any ; if (semver.gte(process.env.PS_VERSION as string, '8.0.0')) { - file = '@versions/8.0.0/pages/BO/login'; + Login = require('@versions/8.0.0/pages/BO/login'); } else { - file = '@versions/8.0.0/pages/BO/login'; + Login = require('@versions/8.0.0/pages/BO/login'); } - -const Login = await import(file); 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 664f0deb..29e7408b 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 */ -class Dashboard extends BOBasePage implements DashboardPageInterface { +export default class Dashboard extends BOBasePage implements DashboardPageInterface { public readonly pageTitle: string; private readonly demoModeButton: string; @@ -625,4 +625,3 @@ class Dashboard extends BOBasePage implements DashboardPageInterface { } } -export default new Dashboard(); 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 415e46f1..82b2f62f 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 */ -class Login extends BOBasePage implements LoginPageInterface { +export default class Login extends BOBasePage implements LoginPageInterface { public readonly pageTitle: string; public readonly loginErrorText: string; @@ -184,4 +184,3 @@ class Login extends BOBasePage implements LoginPageInterface { } } -export default new Login(); diff --git a/tsconfig.json b/tsconfig.json index e58dffa6..13f3cec1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,19 +1,21 @@ { - "compilerOptions": { - "noImplicitAny": true, - "noImplicitThis": true, - "module": "es2022", - "target": "es2022", - "strict": true, - "moduleResolution": "node", + "compilerOptions": { "listEmittedFiles": true, "allowSyntheticDefaultImports": true, - "resolveJsonModule": true, "esModuleInterop": true, - "allowJs": true, - "downlevelIteration": true, - "baseUrl": "./", - "outDir": "dist", + "target": "es6", + "module": "commonjs", + "skipDefaultLibCheck": true, + "skipLibCheck": true, + "moduleResolution": "node", + "noImplicitAny": true, + "noImplicitThis": false, + "strict": true, + "strictFunctionTypes": true, + "isolatedModules": true, "declaration": true, + "lib": ["dom", "dom.iterable", "esnext"], + "baseUrl": "./", + "outDir": "./dist", "paths": { "@interfaces/*": ["src/interfaces/*"], "@pages/*": ["src/pages/*"], @@ -24,7 +26,6 @@ "@versions/*": ["src/versions/*"] }, "typeRoots": ["types", "node_modules/@types"], - "skipLibCheck": true }, "include": ["src/**/*"], "exclude": ["node_modules"]