[ACA-4288] Fix API errors from logs (#2006)

* Add API login in afterAll - part 1

* viewer,infoDrawer,extensions - afterAll API login

* deleteActions - afterAll API login

* Improve before and after methods

* add Promise type to methods - part1

* remove unneeded done() method and add try-catch

* delete wrong import

* Login through API

* small change over log errors

* small improvement over the logs
This commit is contained in:
Iulia Burcă
2021-04-16 17:57:50 +03:00
committed by GitHub
parent 9427c0fc7d
commit d17744bfd9
49 changed files with 844 additions and 719 deletions

View File

@@ -27,7 +27,7 @@ import { LoginComponent } from '../components/components';
import { Page } from './page';
import { APP_ROUTES } from '../configs';
import { waitForPresence } from '../utilities/utils';
import { BrowserActions } from '@alfresco/adf-testing';
import { BrowserActions, Logger } from '@alfresco/adf-testing';
export class LoginPage extends Page {
login = new LoginComponent(this.appRoot);
@@ -47,13 +47,17 @@ export class LoginPage extends Page {
}
async loginWith(username: string, password?: string) {
const pass = password || username;
try {
const pass = password || username;
await this.load();
await this.load();
await this.login.enterCredentials(username, pass);
await BrowserActions.click(this.login.submitButton);
await this.waitForApp();
await this.login.enterCredentials(username, pass);
await BrowserActions.click(this.login.submitButton);
await this.waitForApp();
} catch (error) {
Logger.error(`----- loginWith catch : failed to login with user: ${username} : ${error}`);
}
}
async loginWithAdmin() {

View File

@@ -57,7 +57,7 @@ export abstract class Page {
return browser.get(path);
}
async waitForApp() {
async waitForApp(): Promise<void> {
await waitForPresence(this.layout);
}
@@ -67,15 +67,15 @@ export abstract class Page {
await BrowserVisibility.waitUntilElementIsPresent(browser.element(by.css('[class*="login-content"] input#username')));
}
async waitForDialog() {
async waitForDialog(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.dialogContainer);
}
async isDialogOpen() {
return browser.isElementPresent(this.dialogContainer);
async isDialogOpen(): Promise<boolean> {
return isPresentAndDisplayed(this.dialogContainer);
}
async closeOpenDialogs() {
async closeOpenDialogs(): Promise<void> {
while (await this.isDialogOpen()) {
await Utils.pressEscape();
}