mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-12 17:04:46 +00:00
fix e2e tests
This commit is contained in:
parent
fd74683a27
commit
027aeca81d
@ -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');
|
||||
});
|
||||
|
@ -55,6 +55,7 @@
|
||||
"karma-coverage-istanbul-reporter": "^1.2.1",
|
||||
"karma-jasmine": "~1.1.0",
|
||||
"karma-jasmine-html-reporter": "^0.2.2",
|
||||
"node-rest-client": "^3.1.0",
|
||||
"protractor": "~5.1.2",
|
||||
"ts-node": "~3.2.0",
|
||||
"tslint": "~5.7.0",
|
||||
|
20
yarn.lock
20
yarn.lock
@ -1442,13 +1442,13 @@ debug@*:
|
||||
dependencies:
|
||||
ms "2.0.0"
|
||||
|
||||
debug@2, debug@2.6.9, debug@^2.2.0, debug@^2.6.3, debug@^2.6.6, debug@^2.6.8, debug@~2.6.7:
|
||||
debug@2, debug@2.6.9, debug@^2.2.0, debug@^2.6.3, debug@^2.6.6, debug@^2.6.8, debug@^2.6.9, debug@~2.6.7:
|
||||
version "2.6.9"
|
||||
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
|
||||
dependencies:
|
||||
ms "2.0.0"
|
||||
|
||||
debug@2.2.0:
|
||||
debug@2.2.0, debug@~2.2.0:
|
||||
version "2.2.0"
|
||||
resolved "https://registry.yarnpkg.com/debug/-/debug-2.2.0.tgz#f87057e995b1a1f6ae6a4960664137bc56f039da"
|
||||
dependencies:
|
||||
@ -2099,6 +2099,12 @@ flatten@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/flatten/-/flatten-1.0.2.tgz#dae46a9d78fbe25292258cc1e780a41d95c03782"
|
||||
|
||||
follow-redirects@>=1.2.0:
|
||||
version "1.2.5"
|
||||
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.2.5.tgz#ffd3e14cbdd5eaa72f61b6368c1f68516c2a26cc"
|
||||
dependencies:
|
||||
debug "^2.6.9"
|
||||
|
||||
for-in@^0.1.3:
|
||||
version "0.1.8"
|
||||
resolved "https://registry.yarnpkg.com/for-in/-/for-in-0.1.8.tgz#d8773908e31256109952b1fdb9b3fa867d2775e1"
|
||||
@ -3901,6 +3907,14 @@ node-pre-gyp@^0.6.36:
|
||||
tar "^2.2.1"
|
||||
tar-pack "^3.4.0"
|
||||
|
||||
node-rest-client@^3.1.0:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/node-rest-client/-/node-rest-client-3.1.0.tgz#e0beb6dda7b20cc0b67a7847cf12c5fc419c37c3"
|
||||
dependencies:
|
||||
debug "~2.2.0"
|
||||
follow-redirects ">=1.2.0"
|
||||
xml2js ">=0.2.4"
|
||||
|
||||
node-sass@^4.3.0:
|
||||
version "4.5.3"
|
||||
resolved "https://registry.yarnpkg.com/node-sass/-/node-sass-4.5.3.tgz#d09c9d1179641239d1b97ffc6231fdcec53e1568"
|
||||
@ -6276,7 +6290,7 @@ xml2js@0.4.4:
|
||||
sax "0.6.x"
|
||||
xmlbuilder ">=1.0.0"
|
||||
|
||||
xml2js@^0.4.17:
|
||||
xml2js@>=0.2.4, xml2js@^0.4.17:
|
||||
version "0.4.19"
|
||||
resolved "https://registry.yarnpkg.com/xml2js/-/xml2js-0.4.19.tgz#686c20f213209e94abf0d1bcf1efaa291c7827a7"
|
||||
dependencies:
|
||||
|
Loading…
x
Reference in New Issue
Block a user