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

1.7.8.x : BO : Close Onboarding Welcome popup #18

Merged
merged 1 commit into from
Mar 20, 2024
Merged
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
10 changes: 5 additions & 5 deletions src/pages/BO/login/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import semver from 'semver';

const psVersion = testContext.getPSVersion();

/* eslint-disable global-require */
/* eslint-disable global-require, @typescript-eslint/no-var-requires */
function requirePage(): LoginPageInterface {
if (semver.gte(psVersion, '0.0.0')) {
return require('@versions/develop/pages/BO/login');
if (semver.lt(psVersion, '8.0.0')) {
return require('@versions/1.7.8/pages/BO/login');
}
return require('@versions/develop/pages/BO/login');
return require('@versions/develop/pages/BO/login').loginPage;
}
/* eslint-enable global-require */
/* eslint-enable global-require, @typescript-eslint/no-var-requires */

export default requirePage();
53 changes: 53 additions & 0 deletions src/versions/1.7.8/pages/BO/login/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// Import pages
import type {LoginPageInterface} from '@interfaces/BO/login';
import {Page} from '@playwright/test';
import {LoginPage} from '@versions/develop/pages/BO/login';

/**
* Order confirmation page, contains functions that can be used on the page
* @class
* @extends OrderConfirmationPage
*/
class Login extends LoginPage implements LoginPageInterface {
private readonly onboardingCloseButton: string;

private readonly onboardingStopButton: string;

/**
* @constructs
* Setting up texts and selectors to use on order confirmation page
*/
constructor() {
super();

// welcome module
this.onboardingCloseButton = 'button.onboarding-button-shut-down';
this.onboardingStopButton = 'a.onboarding-button-stop';
}

/**
* Fill login form and success login
* @param page {Page} Browser tab
* @param email {string} String of employee email
* @param password {string} String of employee password
* @returns {Promise<void>}
*/
async successLogin(page: Page, email: string, password: string): Promise<void> {
await super.successLogin(page, email, password);

// closeOnboardingModal
if (await this.elementVisible(page, this.onboardingCloseButton, 3000)) {
// Close popup
await page.locator(this.onboardingCloseButton).click();
await this.waitForHiddenSelector(page, this.onboardingCloseButton);

// Close menu block
if (await this.elementVisible(page, this.onboardingStopButton, 3000)) {
await page.locator(this.onboardingStopButton).click();
await this.waitForHiddenSelector(page, this.onboardingStopButton);
}
}
}
}

module.exports = new Login();
5 changes: 3 additions & 2 deletions src/versions/develop/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 {
class LoginPage extends BOBasePage implements LoginPageInterface {
public readonly pageTitle: string;

public readonly loginErrorText: string;
Expand Down Expand Up @@ -184,4 +184,5 @@ class Login extends BOBasePage implements LoginPageInterface {
}
}

module.exports = new Login();
const loginPage = new LoginPage();
export {loginPage, LoginPage};
Loading