mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
fix e2e tests
This commit is contained in:
@@ -68,7 +68,7 @@ export class DataTable extends Component {
|
||||
return this.head.element(locator);
|
||||
}
|
||||
|
||||
sortByColumn(columnName: string): Promise<void> {
|
||||
sortByColumn(columnName: string): promise.Promise<void> {
|
||||
const column = this.getColumnHeaderByLabel(columnName);
|
||||
const click = browser.actions().mouseMove(column).click();
|
||||
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { ElementFinder, by, browser, protractor, ExpectedConditions as EC } from 'protractor';
|
||||
import { ElementFinder, by, browser, protractor, ExpectedConditions as EC, promise } from 'protractor';
|
||||
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
|
||||
import { Component } from '../component';
|
||||
|
||||
@@ -50,15 +50,15 @@ export class CreateOrEditFolderDialog extends Component {
|
||||
return browser.wait(EC.stalenessOf(this.title), BROWSER_WAIT_TIMEOUT);
|
||||
}
|
||||
|
||||
getTitle(): Promise<string> {
|
||||
getTitle(): promise.Promise<string> {
|
||||
return this.title.getText();
|
||||
}
|
||||
|
||||
isValidationMessageDisplayed(): Promise<boolean> {
|
||||
isValidationMessageDisplayed(): promise.Promise<boolean> {
|
||||
return this.validationMessage.isDisplayed();
|
||||
}
|
||||
|
||||
getValidationMessage(): Promise<string> {
|
||||
getValidationMessage(): promise.Promise<string> {
|
||||
return this.isValidationMessageDisplayed()
|
||||
.then(() => this.validationMessage.getText())
|
||||
.catch(() => '');
|
||||
@@ -73,7 +73,7 @@ export class CreateOrEditFolderDialog extends Component {
|
||||
return this;
|
||||
}
|
||||
|
||||
deleteNameWithBackspace(): Promise<void> {
|
||||
deleteNameWithBackspace(): promise.Promise<void> {
|
||||
const { nameInput } = this;
|
||||
|
||||
return nameInput.clear()
|
||||
|
@@ -43,11 +43,11 @@ export class UserInfo extends Component {
|
||||
.then(() => menu);
|
||||
}
|
||||
|
||||
get name(): Promise<string> {
|
||||
get name(): promise.Promise<string> {
|
||||
return this.fullName.getText();
|
||||
}
|
||||
|
||||
signOut(): Promise<void> {
|
||||
signOut(): promise.Promise<void> {
|
||||
return this.openMenu()
|
||||
.then(menu => {
|
||||
menu.clickMenuItem('Sign out');
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { by, ElementFinder } from 'protractor';
|
||||
import { by, ElementFinder, promise } from 'protractor';
|
||||
import { Component } from '../component';
|
||||
|
||||
export class LoginComponent extends Component {
|
||||
@@ -61,7 +61,7 @@ export class LoginComponent extends Component {
|
||||
return this;
|
||||
}
|
||||
|
||||
submit(): Promise<void> {
|
||||
submit(): promise.Promise<void> {
|
||||
return this.submitButton.click();
|
||||
}
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC } from 'protractor';
|
||||
import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC, promise } from 'protractor';
|
||||
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
|
||||
import { Component } from '../component';
|
||||
|
||||
@@ -43,15 +43,15 @@ export class Menu extends Component {
|
||||
return this.component.element(by.cssContainingText(Menu.selectors.item, label));
|
||||
}
|
||||
|
||||
getItemTooltip(label: string): Promise<string> {
|
||||
getItemTooltip(label: string): promise.Promise<string> {
|
||||
return this.getItemByLabel(label).getAttribute('title');
|
||||
}
|
||||
|
||||
clicktNthItem(nth: number): Promise<void> {
|
||||
clicktNthItem(nth: number): promise.Promise<void> {
|
||||
return this.getNthItem(nth).click();
|
||||
}
|
||||
|
||||
clickMenuItem(label: string): Promise<void> {
|
||||
clickMenuItem(label: string): promise.Promise<void> {
|
||||
return this.getItemByLabel(label).click();
|
||||
}
|
||||
}
|
||||
|
@@ -49,7 +49,7 @@ export class Pagination extends Component {
|
||||
super(Pagination.selectors.root, ancestor);
|
||||
}
|
||||
|
||||
openMaxItemsMenu(): Promise<Menu> {
|
||||
openMaxItemsMenu(): promise.Promise<Menu> {
|
||||
const { menu, maxItemsButton } = this;
|
||||
|
||||
return maxItemsButton.click()
|
||||
@@ -57,7 +57,7 @@ export class Pagination extends Component {
|
||||
.then(() => menu);
|
||||
}
|
||||
|
||||
openCurrentPageMenu(): Promise<Menu> {
|
||||
openCurrentPageMenu(): promise.Promise<Menu> {
|
||||
const { menu, pagesButton } = this;
|
||||
|
||||
return this.pagesButton.click()
|
||||
|
@@ -32,7 +32,7 @@ export class ToolbarActions extends Component {
|
||||
super(ToolbarActions.selectors.root, ancestor);
|
||||
}
|
||||
|
||||
isEmpty(): Promise<boolean> {
|
||||
isEmpty(): promise.Promise<boolean> {
|
||||
return this.buttons.count().then(count => (count === 0));
|
||||
}
|
||||
|
||||
|
@@ -15,6 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { promise } from 'protractor';
|
||||
import { Header, DataTable, Pagination, Toolbar, Sidenav } from '../components/components';
|
||||
import { Page } from './page';
|
||||
|
||||
@@ -25,7 +26,7 @@ export class BrowsingPage extends Page {
|
||||
dataTable = new DataTable(this.app);
|
||||
pagination = new Pagination(this.app);
|
||||
|
||||
signOut(): Promise<void> {
|
||||
signOut(): promise.Promise<void> {
|
||||
return this.header.userInfo.signOut();
|
||||
}
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { browser, ExpectedConditions as EC } from 'protractor';
|
||||
import { browser, ExpectedConditions as EC, promise } from 'protractor';
|
||||
import { LoginComponent } from '../components/components';
|
||||
import { Page } from './page';
|
||||
|
||||
@@ -35,7 +35,7 @@ export class LoginPage extends Page {
|
||||
}
|
||||
|
||||
/** @override */
|
||||
load(): Promise<any> {
|
||||
load(): promise.Promise<any> {
|
||||
return super.load().then(() => {
|
||||
const { submitButton } = this.login;
|
||||
const hasSumbitButton = EC.presenceOf(submitButton);
|
||||
@@ -44,11 +44,11 @@ export class LoginPage extends Page {
|
||||
});
|
||||
}
|
||||
|
||||
loginWith(username: string, password: string): Promise<void> {
|
||||
loginWith(username: string, password: string): promise.Promise<void> {
|
||||
return this.login.enterCredentials(username, password).submit();
|
||||
}
|
||||
|
||||
loginWithAdmin(): Promise<any> {
|
||||
loginWithAdmin(): promise.Promise<any> {
|
||||
return this.loginWith(ADMIN_USERNAME, ADMIN_PASSWORD);
|
||||
}
|
||||
}
|
||||
|
@@ -15,6 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { promise } from 'protractor';
|
||||
import { Page } from './page';
|
||||
import { APP_ROUTES } from '../configs';
|
||||
|
||||
@@ -25,7 +26,7 @@ export class LogoutPage extends Page {
|
||||
}
|
||||
|
||||
/** @override */
|
||||
load(): Promise<any> {
|
||||
load(): promise.Promise<any> {
|
||||
return super.load();
|
||||
}
|
||||
}
|
||||
|
@@ -15,10 +15,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { browser, element, by, ElementFinder } from 'protractor';
|
||||
import { browser, element, by, ElementFinder, promise } from 'protractor';
|
||||
|
||||
export abstract class Page {
|
||||
private static USE_HASH_STRATEGY: boolean = true;
|
||||
private static USE_HASH_STRATEGY = true;
|
||||
|
||||
private locators = {
|
||||
app: by.css('alfresco-content-app'),
|
||||
@@ -32,26 +32,26 @@ export abstract class Page {
|
||||
|
||||
constructor(public url: string = '') {}
|
||||
|
||||
get title(): Promise<string> {
|
||||
get title(): promise.Promise<string> {
|
||||
return browser.getTitle();
|
||||
}
|
||||
|
||||
load(relativeUrl: string = ''): Promise<void> {
|
||||
load(relativeUrl: string = ''): promise.Promise<void> {
|
||||
const hash = Page.USE_HASH_STRATEGY ? '/#' : '';
|
||||
const path = `${hash}${this.url}${relativeUrl}`;
|
||||
|
||||
return browser.get(path);
|
||||
}
|
||||
|
||||
refresh(): Promise<void> {
|
||||
refresh(): promise.Promise<void> {
|
||||
return browser.refresh();
|
||||
}
|
||||
|
||||
isSnackBarDisplayed(): Promise<boolean> {
|
||||
isSnackBarDisplayed(): promise.Promise<boolean> {
|
||||
return this.snackBar.isDisplayed();
|
||||
}
|
||||
|
||||
getSnackBarMessage(): Promise<string> {
|
||||
getSnackBarMessage(): promise.Promise<string> {
|
||||
return this.isSnackBarDisplayed()
|
||||
.then(() => this.snackBar.getText())
|
||||
.catch(() => '');
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { protractor, element, browser, by, ElementFinder } from 'protractor';
|
||||
import { protractor, element, browser, by, ElementFinder, promise } from 'protractor';
|
||||
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
||||
import { APP_ROUTES, SITE_VISIBILITY, SITE_ROLES } from '../../configs';
|
||||
import { RepoClient } from '../../utilities/repo-client/repo-client';
|
||||
@@ -62,7 +62,7 @@ describe('Edit folder', () => {
|
||||
apis.user.nodes.createFolders([ folderNameToEdit, duplicateFolderName ]),
|
||||
loginPage.load()
|
||||
]))
|
||||
.then(() => loginPage.loginWith(username, password))
|
||||
.then(() => { loginPage.loginWith(username, password); })
|
||||
.then(done);
|
||||
});
|
||||
|
||||
@@ -181,7 +181,7 @@ describe('Edit folder', () => {
|
||||
dataTable.clickOnRowByContainingText(folderName)
|
||||
.then(() => editButton.click())
|
||||
.then(() => editDialog.clickCancel())
|
||||
.then(() => expect(editDialog.component.isPresent()).not.toBe(true, 'dialog is not closed'));
|
||||
.then(() => { expect(editDialog.component.isPresent()).not.toBe(true, 'dialog is not closed'); });
|
||||
});
|
||||
|
||||
it('with duplicate folder name', () => {
|
||||
|
@@ -15,18 +15,18 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { browser } from 'protractor';
|
||||
import { browser, promise } from 'protractor';
|
||||
|
||||
declare var window;
|
||||
|
||||
export class LocalStorageUtility {
|
||||
static clear(): Promise<any> {
|
||||
static clear(): promise.Promise<any> {
|
||||
return browser.executeScript(() => {
|
||||
return window.localStorage.clear();
|
||||
});
|
||||
}
|
||||
|
||||
static getTicket(): Promise<any> {
|
||||
static getTicket(): promise.Promise<any> {
|
||||
return browser.executeScript(() => {
|
||||
return window.localStorage.getItem('ticket-ECM');
|
||||
});
|
||||
|
Reference in New Issue
Block a user