mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-19 17:14:45 +00:00
* refactor Mark as favourite tests rename method to be more clear create separate methods for some checks and actions * forgot some changes * refactor delete-undo tests * some more refactoring * fix
128 lines
3.6 KiB
TypeScript
Executable File
128 lines
3.6 KiB
TypeScript
Executable File
/*!
|
|
* @license
|
|
* Alfresco Example Content Application
|
|
*
|
|
* Copyright (C) 2005 - 2018 Alfresco Software Limited
|
|
*
|
|
* This file is part of the Alfresco Example Content Application.
|
|
* If the software was purchased under a paid Alfresco license, the terms of
|
|
* the paid license agreement will prevail. Otherwise, the software is
|
|
* provided under the following open source license terms:
|
|
*
|
|
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Lesser General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
import { ElementFinder, by, browser, ExpectedConditions as EC } from 'protractor';
|
|
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
|
|
import { Component } from '../component';
|
|
|
|
export class ConfirmDialog extends Component {
|
|
private static selectors = {
|
|
root: 'adf-confirm-dialog',
|
|
|
|
title: '.mat-dialog-title',
|
|
content: '.mat-dialog-content',
|
|
accept: 'adf-confirm-accept',
|
|
cancel: 'adf-confirm-cancel',
|
|
actionButton: 'adf-confirm'
|
|
};
|
|
|
|
title: ElementFinder = this.component.element(by.css(ConfirmDialog.selectors.title));
|
|
content: ElementFinder = this.component.element(by.css(ConfirmDialog.selectors.content));
|
|
acceptButton: ElementFinder = this.component.element(by.id(ConfirmDialog.selectors.accept));
|
|
cancelButton: ElementFinder = this.component.element(by.id(ConfirmDialog.selectors.cancel));
|
|
actionButton: ElementFinder = this.component.element(by.id(ConfirmDialog.selectors.actionButton));
|
|
|
|
constructor(ancestor?: ElementFinder) {
|
|
super(ConfirmDialog.selectors.root, ancestor);
|
|
}
|
|
|
|
async waitForDialogToClose() {
|
|
await browser.wait(EC.stalenessOf(this.title), BROWSER_WAIT_TIMEOUT);
|
|
}
|
|
|
|
async waitForDialogToOpen() {
|
|
await browser.wait(EC.presenceOf(this.title), BROWSER_WAIT_TIMEOUT);
|
|
}
|
|
|
|
async isDialogOpen() {
|
|
return await browser.isElementPresent(by.css(ConfirmDialog.selectors.root));
|
|
}
|
|
|
|
async getTitle() {
|
|
return await this.title.getText();
|
|
}
|
|
|
|
async getText() {
|
|
return await this.content.getText();
|
|
}
|
|
|
|
getButtonByName(name: string) {
|
|
return this.component.element(by.buttonText(name));
|
|
}
|
|
|
|
async clickButton(name: string) {
|
|
const button = this.getButtonByName(name);
|
|
await button.click();
|
|
}
|
|
|
|
async isButtonEnabled(name: string) {
|
|
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');
|
|
}
|
|
|
|
}
|