Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ACA-1928] e2e improvements - part1 #883

Merged
merged 6 commits into from
Dec 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions e2e/components/data-table/data-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,6 @@ export class DataTable extends Component {
}

async getItemLocationTooltip(name: string) {
return await this.getItemLocationEl(name).$('a').getAttribute('title');
}

async getItemLocationTileAttr(name: string) {
const location = this.getItemLocationEl(name).$('a');
const condition = () => location.getAttribute('title').then(value => value && value.length > 0);

Expand Down Expand Up @@ -319,4 +315,8 @@ export class DataTable extends Component {
async getLibraryRole(name: string) {
return await this.getRowByName(name).element(by.css(DataTable.selectors.libraryRole)).getText();
}

async isItemPresent(name: string) {
return await this.getRowByName(name).isPresent();
}
}
43 changes: 43 additions & 0 deletions e2e/components/dialog/confirm-dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,47 @@ export class ConfirmDialog extends Component {
const button = this.getButtonByName(name);
return await button.isEnabled();
}


async isOkEnabled() {
return await this.isButtonEnabled('OK');
}

async isCancelEnabled() {
return await this.isButtonEnabled('Cancel');
}

async isKeepEnabled() {
return await this.isButtonEnabled('Keep');
}

async isDeleteEnabled() {
return await this.isButtonEnabled('Delete');
}

async isRemoveEnabled() {
return await this.isButtonEnabled('Remove');
}


async clickOk() {
return await this.clickButton('OK');
}

async clickCancel() {
return await this.clickButton('Cancel');
}

async clickKeep() {
return await this.clickButton('Keep');
}

async clickDelete() {
return await this.clickButton('Delete');
}

async clickRemove() {
return await this.clickButton('Remove');
}

}
2 changes: 1 addition & 1 deletion e2e/components/dialog/copy-move-dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export class CopyMoveDialog extends Component {
await this.waitForDropDownToClose();
}

async chooseDestination(folderName: string) {
async selectDestination(folderName: string) {
const row = this.getRow(folderName);
await Utils.waitUntilElementClickable(row);
await row.click();
Expand Down
29 changes: 29 additions & 0 deletions e2e/components/dialog/create-edit-folder-dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,39 @@ export class CreateOrEditFolderDialog extends Component {
return await this.validationMessage.isDisplayed();
}

async isUpdateButtonEnabled() {
return this.updateButton.isEnabled();
}

async isCreateButtonEnabled() {
return this.createButton.isEnabled();
}

async isCancelButtonEnabled() {
return this.cancelButton.isEnabled();
}

async isNameDisplayed() {
return await this.nameInput.isDisplayed();
}

async isDescriptionDisplayed() {
return await this.descriptionTextArea.isDisplayed();
}

async getValidationMessage() {
await this.isValidationMessageDisplayed();
return await this.validationMessage.getText();
}

async getName() {
return await this.nameInput.getAttribute('value');
}

async getDescription() {
return await this.descriptionTextArea.getAttribute('value');
}

async enterName(name: string) {
await this.nameInput.clear();
await Utils.typeInField(this.nameInput, name);
Expand Down Expand Up @@ -104,4 +132,5 @@ export class CreateOrEditFolderDialog extends Component {
async clickUpdate() {
await this.updateButton.click();
}

}
4 changes: 4 additions & 0 deletions e2e/components/dialog/share-dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ export class ShareDialog extends Component {
return await this.url.getAttribute('readonly');
}

async isCloseEnabled() {
return await this.closeButton.isEnabled();
}

async clickClose() {
await this.closeButton.click();
await this.waitForDialogToClose();
Expand Down
4 changes: 4 additions & 0 deletions e2e/components/header/header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,9 @@ export class Header extends Component {
await this.moreActions.click();
await this.menu.waitForMenuToOpen();
}

async isSignOutDisplayed() {
return await this.userInfo.menu.isMenuItemPresent('Sign out');
}
}

23 changes: 22 additions & 1 deletion e2e/components/login/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ export class LoginComponent extends Component {
return this.submitButton.click();
}

async clickPasswordVisibility() {
return await this.passwordVisibility.click();
}

async getPasswordVisibility() {
const text = await this.passwordVisibility.getText();
if (text.endsWith('visibility_off')) {
Expand All @@ -84,7 +88,7 @@ export class LoginComponent extends Component {
}
}

async isPasswordShown() {
async isPasswordDisplayed() {
const type = await this.passwordInput.getAttribute('type');
if (type === 'text') {
return true;
Expand All @@ -95,4 +99,21 @@ export class LoginComponent extends Component {
}
}
}

async isUsernameEnabled() {
return await this.usernameInput.isEnabled();
}

async isPasswordEnabled() {
return await this.passwordInput.isEnabled();
}

async isSubmitEnabled() {
return await this.submitButton.isEnabled();
}

async isPasswordHidden() {
return !(await this.getPasswordVisibility());
}

}
152 changes: 145 additions & 7 deletions e2e/components/menu/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,35 @@ export class Menu extends Component {
icon: '.mat-icon',
uploadFiles: 'app-upload-files',

submenu: 'app-context-menu-item .mat-menu-item',

share: `[data-automation-id='share-action-button']`
submenu: 'app-context-menu-item .mat-menu-item'
};

items: ElementArrayFinder = this.component.all(by.css(Menu.selectors.item));
backdrop: ElementFinder = browser.element(by.css('.cdk-overlay-backdrop'));
uploadFiles: ElementFinder = browser.element(by.id(Menu.selectors.uploadFiles));
submenus: ElementArrayFinder = browser.element.all(by.css(Menu.selectors.submenu));

shareAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.share, 'Share'));
shareEditAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.share, 'Shared link settings'));
shareAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Share'));
shareEditAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Shared link settings'));
viewAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'View'));
downloadAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Download'));
editAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Edit'));
copyAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Copy'));
moveAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Move'));
deleteAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Delete'));
managePermissionsAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Permissions'));
manageVersionsAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Manage Versions'));
favoriteAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Favorite'));
leaveAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Leave'));
joinAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Join'));
cancelJoinAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Cancel join'));
permanentDeleteAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Permanently delete'));
restoreAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Restore'));
viewDetailsAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'View details'));
createFolderAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Create folder'));
createLibraryAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Create Library'));
uploadFileAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Upload file'));
uploadFolderAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Upload folder'));

constructor(ancestor?: ElementFinder) {
super(Menu.selectors.root, ancestor);
Expand Down Expand Up @@ -173,13 +190,134 @@ export class Menu extends Component {
return this.uploadFiles;
}

async clickShareAction() {

async clickShare() {
const action = this.shareAction;
await action.click();
}

async clickShareEditAction() {
async clickSharedLinkSettings() {
const action = this.shareEditAction;
await action.click();
}


async isViewPresent() {
return await this.viewAction.isPresent();
}

async isDownloadPresent() {
return await this.downloadAction.isPresent();
}

async isEditPresent() {
return await this.editAction.isPresent();
}

async isCopyPresent() {
return await this.copyAction.isPresent();
}

async isMovePresent() {
return await this.moveAction.isPresent();
}

async isDeletePresent() {
return await this.deleteAction.isPresent();
}

async isManagePermissionsPresent() {
return await this.managePermissionsAction.isPresent();
}

async isManageVersionsPresent() {
return await this.manageVersionsAction.isPresent();
}

async isFavoritePresent() {
return await this.favoriteAction.isPresent();
}

async isJoinLibraryPresent() {
return await this.joinAction.isPresent();
}

async isCancelJoinPresent() {
return await this.cancelJoinAction.isPresent();
}

async isLeaveLibraryPresent() {
return await this.leaveAction.isPresent();
}

async isPermanentDeletePresent() {
return await this.permanentDeleteAction.isPresent();
}

async isRestorePresent() {
return await this.restoreAction.isPresent();
}

async isSharePresent() {
return await this.shareAction.isPresent();
}

async isSharedLinkSettingsPresent() {
return await this.shareEditAction.isPresent();
}

async isViewDetailsPresent() {
return await this.viewDetailsAction.isPresent();
}

async isCreateFolderPresent() {
return await this.createFolderAction.isPresent();
}
async isCreateFolderEnabled() {
return await this.createFolderAction.isEnabled();
}

async isCreateLibraryPresent() {
return await this.createLibraryAction.isPresent();
}
async isCreateLibraryEnabled() {
return await this.createLibraryAction.isEnabled();
}

async isUploadFilePresent() {
return await this.uploadFileAction.isPresent();
}
async isUploadFileEnabled() {
return await this.uploadFileAction.isEnabled();
}

async isUploadFolderPresent() {
return await this.uploadFolderAction.isPresent();
}
async isUploadFolderEnabled() {
return await this.uploadFolderAction.isEnabled();
}



async clickCreateFolder() {
const action = this.createFolderAction;
await action.click();
}

async clickCreateLibrary() {
const action = this.createLibraryAction;
await action.click();
}

async clickUploadFile() {
const action = this.uploadFileAction;
await action.click();
}

async clickUploadFolder() {
const action = this.uploadFolderAction;
await action.click();
}

}
Loading