Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: commonjs build #4

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions src/common/BO/loginBO.ts
Original file line number Diff line number Diff line change
@@ -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(
Expand All @@ -14,21 +16,21 @@ export default {
email: string = global.BO.EMAIL,
password: string = global.BO.PASSWD,
): Promise<void> {
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);
expect(pageTitle).toContain(dashboardPage.pageTitle);
},

async logoutBO(testInfo: TestInfo, page: Page): Promise<void> {
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);
},
};
1 change: 1 addition & 0 deletions src/interfaces/BO/login/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type {Page} from '@playwright/test';

export interface LoginPageInterface {

readonly pageTitle: string;

successLogin(page: Page, email: string, password: string): Promise<void>;
Expand Down
9 changes: 3 additions & 6 deletions src/pages/BO/dashboard/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import semver from 'semver';

let file: string;

let Dashboard: any;

Check failure on line 3 in src/pages/BO/dashboard/index.ts

View workflow job for this annotation

GitHub Actions / ESLint

Exporting mutable 'let' binding, use 'const' instead
if (semver.gte(process.env.PS_VERSION as string, '8.0.0')) {

Check failure on line 4 in src/pages/BO/dashboard/index.ts

View workflow job for this annotation

GitHub Actions / ESLint

Expected blank line before this statement
file = '@versions/8.0.0/pages/BO/dashboard';
Dashboard = require('@versions/8.0.0/pages/BO/dashboard');

Check failure on line 5 in src/pages/BO/dashboard/index.ts

View workflow job for this annotation

GitHub Actions / ESLint

Unexpected require()
} else {
file = '@versions/8.0.0/pages/BO/dashboard';
Dashboard = require('@versions/8.0.0/pages/BO/dashboard');

Check failure on line 7 in src/pages/BO/dashboard/index.ts

View workflow job for this annotation

GitHub Actions / ESLint

Unexpected require()
}

const Dashboard = await import(file);
export default Dashboard;
9 changes: 3 additions & 6 deletions src/pages/BO/login/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import semver from 'semver';

let file: string;

let Login: any ;

Check failure on line 3 in src/pages/BO/login/index.ts

View workflow job for this annotation

GitHub Actions / ESLint

Exporting mutable 'let' binding, use 'const' instead

Check failure on line 3 in src/pages/BO/login/index.ts

View workflow job for this annotation

GitHub Actions / ESLint

Unexpected whitespace before semicolon
if (semver.gte(process.env.PS_VERSION as string, '8.0.0')) {

Check failure on line 4 in src/pages/BO/login/index.ts

View workflow job for this annotation

GitHub Actions / ESLint

Expected blank line before this statement
file = '@versions/8.0.0/pages/BO/login';
Login = require('@versions/8.0.0/pages/BO/login');

Check failure on line 5 in src/pages/BO/login/index.ts

View workflow job for this annotation

GitHub Actions / ESLint

Unexpected require()
} else {
file = '@versions/8.0.0/pages/BO/login';
Login = require('@versions/8.0.0/pages/BO/login');

Check failure on line 7 in src/pages/BO/login/index.ts

View workflow job for this annotation

GitHub Actions / ESLint

Unexpected require()
}

const Login = await import(file);
export default Login;
3 changes: 1 addition & 2 deletions src/versions/8.0.0/pages/BO/dashboard/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @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;
Expand Down Expand Up @@ -624,5 +624,4 @@
return this.getTextContent(page, this.helpCardDocumentTitle);
}
}

Check failure on line 627 in src/versions/8.0.0/pages/BO/dashboard/index.ts

View workflow job for this annotation

GitHub Actions / ESLint

Too many blank lines at the end of file. Max of 0 allowed
export default new Dashboard();
3 changes: 1 addition & 2 deletions src/versions/8.0.0/pages/BO/login/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -184,4 +184,3 @@ class Login extends BOBasePage implements LoginPageInterface {
}
}

export default new Login();
27 changes: 14 additions & 13 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -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/*"],
Expand All @@ -24,7 +26,6 @@
"@versions/*": ["src/versions/*"]
},
"typeRoots": ["types", "node_modules/@types"],
"skipLibCheck": true
},
"include": ["src/**/*"],
"exclude": ["node_modules"]
Expand Down