Skip to content

Commit

Permalink
Merge pull request #18 from Progi1984/178xWelcome
Browse files Browse the repository at this point in the history
1.7.8.x : BO : Close Onboarding Welcome popup
  • Loading branch information
Progi1984 authored Mar 20, 2024
2 parents 0cce5ec + 8377916 commit 3fbdfe3
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 7 deletions.
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};

0 comments on commit 3fbdfe3

Please sign in to comment.