mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2026-09-09 18:02:54 +00:00
- remove some awaits
- add try catch - small refactoring
This commit is contained in:
@@ -57,15 +57,15 @@ export class ConfirmDialog extends Component {
|
||||
}
|
||||
|
||||
async isDialogOpen() {
|
||||
return await browser.isElementPresent(by.css(ConfirmDialog.selectors.root));
|
||||
return browser.isElementPresent(by.css(ConfirmDialog.selectors.root));
|
||||
}
|
||||
|
||||
async getTitle() {
|
||||
return await this.title.getText();
|
||||
return this.title.getText();
|
||||
}
|
||||
|
||||
async getText() {
|
||||
return await this.content.getText();
|
||||
return this.content.getText();
|
||||
}
|
||||
|
||||
getButtonByName(name: string) {
|
||||
@@ -79,49 +79,49 @@ export class ConfirmDialog extends Component {
|
||||
|
||||
async isButtonEnabled(name: string) {
|
||||
const button = this.getButtonByName(name);
|
||||
return await button.isEnabled();
|
||||
return button.isEnabled();
|
||||
}
|
||||
|
||||
|
||||
async isOkEnabled() {
|
||||
return await this.isButtonEnabled('OK');
|
||||
return this.isButtonEnabled('OK');
|
||||
}
|
||||
|
||||
async isCancelEnabled() {
|
||||
return await this.isButtonEnabled('Cancel');
|
||||
return this.isButtonEnabled('Cancel');
|
||||
}
|
||||
|
||||
async isKeepEnabled() {
|
||||
return await this.isButtonEnabled('Keep');
|
||||
return this.isButtonEnabled('Keep');
|
||||
}
|
||||
|
||||
async isDeleteEnabled() {
|
||||
return await this.isButtonEnabled('Delete');
|
||||
return this.isButtonEnabled('Delete');
|
||||
}
|
||||
|
||||
async isRemoveEnabled() {
|
||||
return await this.isButtonEnabled('Remove');
|
||||
return this.isButtonEnabled('Remove');
|
||||
}
|
||||
|
||||
|
||||
async clickOk() {
|
||||
return await this.clickButton('OK');
|
||||
await this.clickButton('OK');
|
||||
}
|
||||
|
||||
async clickCancel() {
|
||||
return await this.cancelButton.click();
|
||||
await this.cancelButton.click();
|
||||
}
|
||||
|
||||
async clickKeep() {
|
||||
return await this.clickButton('Keep');
|
||||
await this.clickButton('Keep');
|
||||
}
|
||||
|
||||
async clickDelete() {
|
||||
return await this.clickButton('Delete');
|
||||
await this.clickButton('Delete');
|
||||
}
|
||||
|
||||
async clickRemove() {
|
||||
return await this.clickButton('Remove');
|
||||
await this.clickButton('Remove');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -78,11 +78,11 @@ export class CopyMoveDialog extends Component {
|
||||
}
|
||||
|
||||
async isDialogOpen() {
|
||||
return await browser.$(CopyMoveDialog.selectors.root).isDisplayed();
|
||||
return browser.$(CopyMoveDialog.selectors.root).isDisplayed();
|
||||
}
|
||||
|
||||
async getTitle() {
|
||||
return await this.title.getText();
|
||||
return this.title.getText();
|
||||
}
|
||||
|
||||
async clickCancel() {
|
||||
|
||||
@@ -61,15 +61,15 @@ export class CreateOrEditFolderDialog extends Component {
|
||||
}
|
||||
|
||||
async isDialogOpen() {
|
||||
return await browser.isElementPresent(by.css(CreateOrEditFolderDialog.selectors.root));
|
||||
return browser.isElementPresent(by.css(CreateOrEditFolderDialog.selectors.root));
|
||||
}
|
||||
|
||||
async getTitle() {
|
||||
return await this.title.getText();
|
||||
return this.title.getText();
|
||||
}
|
||||
|
||||
async isValidationMessageDisplayed() {
|
||||
return await this.validationMessage.isDisplayed();
|
||||
return this.validationMessage.isDisplayed();
|
||||
}
|
||||
|
||||
async isUpdateButtonEnabled() {
|
||||
@@ -85,24 +85,24 @@ export class CreateOrEditFolderDialog extends Component {
|
||||
}
|
||||
|
||||
async isNameDisplayed() {
|
||||
return await this.nameInput.isDisplayed();
|
||||
return this.nameInput.isDisplayed();
|
||||
}
|
||||
|
||||
async isDescriptionDisplayed() {
|
||||
return await this.descriptionTextArea.isDisplayed();
|
||||
return this.descriptionTextArea.isDisplayed();
|
||||
}
|
||||
|
||||
async getValidationMessage() {
|
||||
await this.isValidationMessageDisplayed();
|
||||
return await this.validationMessage.getText();
|
||||
return this.validationMessage.getText();
|
||||
}
|
||||
|
||||
async getName() {
|
||||
return await this.nameInput.getAttribute('value');
|
||||
return this.nameInput.getAttribute('value');
|
||||
}
|
||||
|
||||
async getDescription() {
|
||||
return await this.descriptionTextArea.getAttribute('value');
|
||||
return this.descriptionTextArea.getAttribute('value');
|
||||
}
|
||||
|
||||
async enterName(name: string) {
|
||||
|
||||
@@ -67,44 +67,44 @@ export class CreateLibraryDialog extends Component {
|
||||
}
|
||||
|
||||
async isDialogOpen() {
|
||||
return await browser.isElementPresent(by.css(CreateLibraryDialog.selectors.root));
|
||||
return browser.isElementPresent(by.css(CreateLibraryDialog.selectors.root));
|
||||
}
|
||||
|
||||
async getTitle() {
|
||||
return await this.title.getText();
|
||||
return this.title.getText();
|
||||
}
|
||||
|
||||
async isErrorMessageDisplayed() {
|
||||
return await this.errorMessage.isDisplayed();
|
||||
return this.errorMessage.isDisplayed();
|
||||
}
|
||||
|
||||
async getErrorMessage() {
|
||||
await this.isErrorMessageDisplayed();
|
||||
return await this.errorMessage.getText();
|
||||
return this.errorMessage.getText();
|
||||
}
|
||||
|
||||
async isNameDisplayed() {
|
||||
return await this.nameInput.isDisplayed();
|
||||
return this.nameInput.isDisplayed();
|
||||
}
|
||||
|
||||
async isLibraryIdDisplayed() {
|
||||
return await this.libraryIdInput.isDisplayed();
|
||||
return this.libraryIdInput.isDisplayed();
|
||||
}
|
||||
|
||||
async isDescriptionDisplayed() {
|
||||
return await this.descriptionTextArea.isDisplayed();
|
||||
return this.descriptionTextArea.isDisplayed();
|
||||
}
|
||||
|
||||
async isPublicDisplayed() {
|
||||
return await this.visibilityPublic.isDisplayed();
|
||||
return this.visibilityPublic.isDisplayed();
|
||||
}
|
||||
|
||||
async isModeratedDisplayed() {
|
||||
return await this.visibilityModerated.isDisplayed();
|
||||
return this.visibilityModerated.isDisplayed();
|
||||
}
|
||||
|
||||
async isPrivateDisplayed() {
|
||||
return await this.visibilityPrivate.isDisplayed();
|
||||
return this.visibilityPrivate.isDisplayed();
|
||||
}
|
||||
|
||||
async enterName(name: string) {
|
||||
@@ -128,11 +128,11 @@ export class CreateLibraryDialog extends Component {
|
||||
}
|
||||
|
||||
async isCreateEnabled() {
|
||||
return await this.createButton.isEnabled();
|
||||
return this.createButton.isEnabled();
|
||||
}
|
||||
|
||||
async isCancelEnabled() {
|
||||
return await this.cancelButton.isEnabled();
|
||||
return this.cancelButton.isEnabled();
|
||||
}
|
||||
|
||||
async clickCreate() {
|
||||
@@ -146,17 +146,17 @@ export class CreateLibraryDialog extends Component {
|
||||
|
||||
async isPublicChecked() {
|
||||
const elemClass = await this.visibilityPublic.element(by.xpath('..')).getAttribute('class');
|
||||
return await elemClass.includes(CreateLibraryDialog.selectors.radioChecked);
|
||||
return elemClass.includes(CreateLibraryDialog.selectors.radioChecked);
|
||||
}
|
||||
|
||||
async isModeratedChecked() {
|
||||
const elemClass = await this.visibilityModerated.element(by.xpath('..')).getAttribute('class');
|
||||
return await elemClass.includes(CreateLibraryDialog.selectors.radioChecked);
|
||||
return elemClass.includes(CreateLibraryDialog.selectors.radioChecked);
|
||||
}
|
||||
|
||||
async isPrivateChecked() {
|
||||
const elemClass = await this.visibilityPrivate.element(by.xpath('..')).getAttribute('class');
|
||||
return await elemClass.includes(CreateLibraryDialog.selectors.radioChecked);
|
||||
return elemClass.includes(CreateLibraryDialog.selectors.radioChecked);
|
||||
}
|
||||
|
||||
async selectPublic() {
|
||||
|
||||
@@ -45,19 +45,19 @@ export class ManageVersionsDialog extends Component {
|
||||
}
|
||||
|
||||
async waitForDialogToClose() {
|
||||
return await browser.wait(EC.stalenessOf(this.title), BROWSER_WAIT_TIMEOUT);
|
||||
await browser.wait(EC.stalenessOf(this.title), BROWSER_WAIT_TIMEOUT);
|
||||
}
|
||||
|
||||
async isDialogOpen() {
|
||||
return await browser.$(ManageVersionsDialog.selectors.root).isDisplayed();
|
||||
return browser.$(ManageVersionsDialog.selectors.root).isDisplayed();
|
||||
}
|
||||
|
||||
async getTitle() {
|
||||
return await this.title.getText();
|
||||
return this.title.getText();
|
||||
}
|
||||
|
||||
async getText() {
|
||||
return await this.content.getText();
|
||||
return this.content.getText();
|
||||
}
|
||||
|
||||
async clickClose() {
|
||||
|
||||
@@ -58,33 +58,33 @@ export class PasswordDialog extends Component {
|
||||
}
|
||||
|
||||
async isDialogOpen() {
|
||||
return await browser.isElementPresent(by.css(PasswordDialog.selectors.root));
|
||||
return browser.isElementPresent(by.css(PasswordDialog.selectors.root));
|
||||
}
|
||||
|
||||
async getTitle() {
|
||||
return await this.title.getText();
|
||||
return this.title.getText();
|
||||
}
|
||||
|
||||
async isCloseEnabled() {
|
||||
return await this.closeButton.isEnabled();
|
||||
return this.closeButton.isEnabled();
|
||||
}
|
||||
|
||||
async isSubmitEnabled() {
|
||||
return await this.submitButton.isEnabled();
|
||||
return this.submitButton.isEnabled();
|
||||
}
|
||||
|
||||
async clickClose() {
|
||||
return await this.closeButton.click();
|
||||
await this.closeButton.click();
|
||||
}
|
||||
|
||||
async clickSubmit() {
|
||||
return await this.submitButton.click();
|
||||
await this.submitButton.click();
|
||||
}
|
||||
|
||||
async isPasswordInputDisplayed() {
|
||||
const present = await browser.isElementPresent(this.passwordInput);
|
||||
if (present) {
|
||||
return await this.passwordInput.isDisplayed();
|
||||
return this.passwordInput.isDisplayed();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@@ -92,12 +92,12 @@ export class PasswordDialog extends Component {
|
||||
|
||||
async isErrorDisplayed() {
|
||||
const elem = await browser.wait(until.elementLocated(by.css(PasswordDialog.selectors.errorMessage)), BROWSER_WAIT_TIMEOUT, '------- timeout waiting for error message to appear')
|
||||
return await browser.isElementPresent(elem);
|
||||
return browser.isElementPresent(elem);
|
||||
}
|
||||
|
||||
async getErrorMessage() {
|
||||
if (await this.isErrorDisplayed()) {
|
||||
return await this.errorMessage.getText();
|
||||
return this.errorMessage.getText();
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -71,15 +71,15 @@ export class ShareDialog extends Component {
|
||||
}
|
||||
|
||||
async isDialogOpen() {
|
||||
return await browser.isElementPresent(by.css(ShareDialog.selectors.root));
|
||||
return browser.isElementPresent(by.css(ShareDialog.selectors.root));
|
||||
}
|
||||
|
||||
async getTitle() {
|
||||
return await this.title.getText();
|
||||
return this.title.getText();
|
||||
}
|
||||
|
||||
async getInfoText() {
|
||||
return await this.infoText.getText();
|
||||
return this.infoText.getText();
|
||||
}
|
||||
|
||||
getLabels() {
|
||||
@@ -87,15 +87,15 @@ export class ShareDialog extends Component {
|
||||
}
|
||||
|
||||
async getLinkUrl() {
|
||||
return await this.url.getAttribute('value');
|
||||
return this.url.getAttribute('value');
|
||||
}
|
||||
|
||||
async isUrlReadOnly() {
|
||||
return await this.url.getAttribute('readonly');
|
||||
return this.url.getAttribute('readonly');
|
||||
}
|
||||
|
||||
async isCloseEnabled() {
|
||||
return await this.closeButton.isEnabled();
|
||||
return this.closeButton.isEnabled();
|
||||
}
|
||||
|
||||
async clickClose() {
|
||||
@@ -131,21 +131,21 @@ export class ShareDialog extends Component {
|
||||
}
|
||||
|
||||
async copyUrl() {
|
||||
return await this.urlAction.click();
|
||||
await this.urlAction.click();
|
||||
}
|
||||
|
||||
async openDatetimePicker() {
|
||||
return await this.datetimePickerButton.click();
|
||||
await this.datetimePickerButton.click();
|
||||
}
|
||||
|
||||
async closeDatetimePicker() {
|
||||
if (await this.dateTimePicker.isCalendarOpen()) {
|
||||
return await this.datetimePickerButton.click();
|
||||
await this.datetimePickerButton.click();
|
||||
}
|
||||
}
|
||||
|
||||
async getExpireDate() {
|
||||
return await this.getExpireInput().getAttribute('value');
|
||||
return this.getExpireInput().getAttribute('value');
|
||||
}
|
||||
|
||||
async clickExpirationToggle() {
|
||||
|
||||
@@ -56,32 +56,32 @@ export class UploadNewVersionDialog extends Component {
|
||||
}
|
||||
|
||||
async waitForDialogToClose() {
|
||||
return await browser.wait(EC.stalenessOf(this.title), BROWSER_WAIT_TIMEOUT);
|
||||
await browser.wait(EC.stalenessOf(this.title), BROWSER_WAIT_TIMEOUT);
|
||||
}
|
||||
|
||||
async isDialogOpen() {
|
||||
return await browser.$(UploadNewVersionDialog.selectors.root).isDisplayed();
|
||||
return browser.$(UploadNewVersionDialog.selectors.root).isDisplayed();
|
||||
}
|
||||
|
||||
async getTitle() {
|
||||
return await this.title.getText();
|
||||
return this.title.getText();
|
||||
}
|
||||
|
||||
async getText() {
|
||||
return await this.content.getText();
|
||||
return this.content.getText();
|
||||
}
|
||||
|
||||
|
||||
async isDescriptionDisplayed() {
|
||||
return await this.description.isDisplayed();
|
||||
return this.description.isDisplayed();
|
||||
}
|
||||
|
||||
async isMinorOptionDisplayed() {
|
||||
return await this.minorOption.isDisplayed();
|
||||
return this.minorOption.isDisplayed();
|
||||
}
|
||||
|
||||
async isMajorOptionDisplayed() {
|
||||
return await this.majorOption.isDisplayed();
|
||||
return this.majorOption.isDisplayed();
|
||||
}
|
||||
|
||||
async isCancelButtonEnabled() {
|
||||
@@ -105,11 +105,11 @@ export class UploadNewVersionDialog extends Component {
|
||||
|
||||
|
||||
async clickMajor() {
|
||||
return await this.majorOption.click();
|
||||
await this.majorOption.click();
|
||||
}
|
||||
|
||||
async clickMinor() {
|
||||
return await this.minorOption.click();
|
||||
await this.minorOption.click();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user