[ACA-4264] refactor page load and loginWith methods (#1952)

* update extensions json files

* no message

* on login, sign out if anyone is already logged in

* one more selector override needed by ACA-4262
This commit is contained in:
Adina Parpalita
2021-01-29 14:27:32 +02:00
committed by GitHub
parent bd81f52cfe
commit 2f8d3d58c4
16 changed files with 6666 additions and 4417 deletions

View File

@@ -41,6 +41,10 @@ export class SelectTemplateDialog extends GenericDialog {
super('.aca-template-node-selector-dialog');
}
get content() {
return this.rootElem.element(by.css('.adf-content-node-selector-content'));
}
async isCancelButtonEnabled(): Promise<boolean> {
return isPresentAndEnabled(this.cancelButton);
}

View File

@@ -114,7 +114,6 @@ export const FILES = {
};
export const EXTENSIBILITY_CONFIGS = {
DEFAULT_EXTENSIONS_CONFIG: 'extensions-default.json',
INFO_DRAWER: 'info-drawer-ext.json',
INFO_DRAWER_EMPTY: 'info-drawer-no-tabs-ext.json',
VIEWER: 'viewer-ext.json',

View File

@@ -26,8 +26,6 @@
import { Header, DataTable, Pagination, Toolbar, Breadcrumb, Sidenav } from '../components/components';
import { SIDEBAR_LABELS } from './../configs';
import { Page } from './page';
import { BrowserVisibility } from '@alfresco/adf-testing';
import { browser, by } from 'protractor';
export class BrowsingPage extends Page {
header = new Header(this.appRoot);
@@ -37,12 +35,6 @@ export class BrowsingPage extends Page {
dataTable = new DataTable(this.appRoot);
pagination = new Pagination(this.appRoot);
async signOut(): Promise<void> {
await this.header.openMoreMenu();
await this.header.menu.clickMenuItem('Sign out');
await BrowserVisibility.waitUntilElementIsPresent(browser.element(by.css('[class*="login-content"] input#username')));
}
async clickPersonalFiles(): Promise<void> {
await this.sidenav.clickLink(SIDEBAR_LABELS.PERSONAL_FILES);
}

View File

@@ -25,9 +25,8 @@
import { browser } from 'protractor';
import { LoginComponent } from '../components/components';
import { Page } from './page';
import { APP_ROUTES } from '../configs';
import { Utils, waitForPresence } from '../utilities/utils';
import { waitForPresence } from '../utilities/utils';
import { BrowserActions } from '@alfresco/adf-testing';
export class LoginPage extends Page {
@@ -39,22 +38,26 @@ export class LoginPage extends Page {
async load() {
await super.load();
await Utils.clearLocalStorage();
await super.load();
if (await this.isLoggedIn()) {
await this.signOut();
}
await waitForPresence(this.login.submitButton);
}
async loginWith(username: string, password?: string) {
const pass = password || username;
await this.load();
await this.login.enterCredentials(username, pass);
await BrowserActions.click(this.login.submitButton);
return super.waitForApp();
await this.waitForApp();
}
async loginWithAdmin() {
await this.load();
return this.loginWith(browser.params.ADMIN_USERNAME, browser.params.ADMIN_PASSWORD);
await this.loginWith(browser.params.ADMIN_USERNAME, browser.params.ADMIN_PASSWORD);
}
async tryLoginWith(username: string, password?: string) {

View File

@@ -25,8 +25,9 @@
import { browser, by, ElementFinder } from 'protractor';
import { BrowserActions, BrowserVisibility, Logger } from '@alfresco/adf-testing';
import { USE_HASH_STRATEGY } from './../configs';
import { APP_ROUTES, USE_HASH_STRATEGY } from './../configs';
import { Utils, waitElement, waitForPresence, isPresentAndDisplayed } from '../utilities/utils';
import { Header } from '../components';
export abstract class Page {
appRoot = 'app-root';
@@ -60,6 +61,12 @@ export abstract class Page {
await waitForPresence(this.layout);
}
async signOut(): Promise<void> {
await new Header().openMoreMenu();
await new Header().menu.clickMenuItem('Sign out');
await BrowserVisibility.waitUntilElementIsPresent(browser.element(by.css('[class*="login-content"] input#username')));
}
async waitForDialog() {
await BrowserVisibility.waitUntilElementIsVisible(this.dialogContainer);
}
@@ -102,4 +109,9 @@ export abstract class Page {
Logger.error(e, '.......failed on click snack bar action.........');
}
}
async isLoggedIn(): Promise<boolean> {
const url = await browser.driver.getCurrentUrl();
return !url.includes(APP_ROUTES.LOGIN);
}
}