[ACS-5866] authentication playwright tests (#3391)

* viewer action files e2e migration

* viewer action files e2e remove comment

* review code fix

* [ci:force]

* [ACS-5650]viewer test with new user

* remove commented code

* login and logout playwright test

* Update error message login.spec.ts
This commit is contained in:
Akash Rathod
2023-08-18 18:49:46 +02:00
committed by GitHub
parent 9f1b8a0ac6
commit f8a30f3706
14 changed files with 325 additions and 238 deletions

View File

@@ -31,15 +31,18 @@ interface LoginOptions {
withNavigation?: boolean;
}
export class LoginPage extends BasePage {
private static pageUrl = 'login';
constructor(page: Page) {
super(page, '');
super(page, LoginPage.pageUrl);
}
private username = this.page.locator('#username');
private password = this.page.locator('#password');
private submitButton = this.page.locator('#login-button');
private userProfileButton = this.page.locator('aca-user-menu button');
private userLogOutButton = this.page.locator('aca-logout button');
public username = this.page.locator('#username');
public password = this.page.locator('#password');
public submitButton = this.page.locator('#login-button');
public userProfileButton = this.page.locator('aca-user-menu button');
public userLogOutButton = this.page.locator('aca-logout button');
public passwordVisibility = this.page.locator('.adf-login-password-icon');
async loginUser(userData: { username: string; password: string } | UserModel, options?: LoginOptions): Promise<void> {
if (options?.withNavigation) {
@@ -58,4 +61,12 @@ export class LoginPage extends BasePage {
await this.userProfileButton.click();
await this.userLogOutButton.click();
}
async isPasswordDisplayed(): Promise<boolean> {
const type = await this.password.getAttribute('type');
if (type === 'text') {
return true;
}
return false;
}
}