[ACA-3392] Create aca-testing-shared project to be reused in ADW (#1480)

* Move e2e framework to aca-shared/testing

* * Update e2e suites imports from @alfresco/aca-shared/testing
* Remove testing framework from 'e2e' directory

* Move e2e testing framework to `aca-testing-shared` project
This commit is contained in:
Roxana Diacenco
2020-06-04 23:40:07 +03:00
committed by GitHub
parent 33327bb505
commit 6e17405787
166 changed files with 2745 additions and 1128 deletions

View File

@@ -0,0 +1,64 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2020 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 { by } from 'protractor';
import { GenericDialog } from '../dialog/generic-dialog';
import { isPresentAndEnabled } from '../../utilities/utils';
export class ConfirmDialog extends GenericDialog {
okButton = this.childElement(by.buttonText('OK'));
cancelButton = this.childElement(by.buttonText('Cancel'));
keepButton = this.childElement(by.buttonText('Keep'));
deleteButton = this.childElement(by.buttonText('Delete'));
removeButton = this.childElement(by.buttonText('Remove'));
constructor() {
super('adf-confirm-dialog');
}
async getText(): Promise<string> {
return this.content.getText();
}
async isOkEnabled(): Promise<boolean> {
return isPresentAndEnabled(this.okButton);
}
async isCancelEnabled(): Promise<boolean> {
return isPresentAndEnabled(this.cancelButton);
}
async isKeepEnabled(): Promise<boolean> {
return isPresentAndEnabled(this.keepButton);
}
async isDeleteEnabled(): Promise<boolean> {
return isPresentAndEnabled(this.deleteButton);
}
async isRemoveEnabled(): Promise<boolean> {
return isPresentAndEnabled(this.removeButton);
}
}

View File

@@ -0,0 +1,119 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2020 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 { by, browser, protractor } from 'protractor';
import { GenericDialog } from '../dialog/generic-dialog';
import {
Utils,
isPresentAndDisplayed,
waitForStaleness,
waitForPresence,
isPresentAndEnabled,
waitForClickable
} from '../../utilities/utils';
import { DropDownBreadcrumb } from '../breadcrumb/dropdown-breadcrumb';
import { DataTable } from '../data-table/data-table';
export class ContentNodeSelectorDialog extends GenericDialog {
cancelButton = this.childElement(
by.css('[data-automation-id="content-node-selector-actions-cancel"]')
);
copyButton = this.childElement(
by.cssContainingText(
'[data-automation-id="content-node-selector-actions-choose"]',
'Copy'
)
);
moveButton = this.childElement(
by.cssContainingText(
'[data-automation-id="content-node-selector-actions-choose"]',
'Move'
)
);
locationDropDown = this.rootElem.element(by.id('site-dropdown-container'));
locationPersonalFiles = browser.element(
by.cssContainingText('.mat-option .mat-option-text', 'Personal Files')
);
locationFileLibraries = browser.element(
by.cssContainingText('.mat-option .mat-option-text', 'My Libraries')
);
searchInput = this.rootElem.element(by.css('#searchInput'));
toolbarTitle = this.rootElem.element(by.css('.adf-toolbar-title'));
breadcrumb = new DropDownBreadcrumb();
dataTable = new DataTable('.adf-content-node-selector-dialog');
constructor() {
super('.adf-content-node-selector-dialog');
}
async waitForDropDownToClose(): Promise<void> {
await waitForStaleness(browser.$('.mat-option .mat-option-text'));
}
async selectLocation(location: string): Promise<void> {
await this.locationDropDown.click();
await waitForPresence(this.locationPersonalFiles);
if (location === 'Personal Files') {
await this.locationPersonalFiles.click();
} else {
await this.locationFileLibraries.click();
}
await this.waitForDropDownToClose();
}
async selectDestination(folderName: string): Promise<void> {
const row = this.dataTable.getRowByName(folderName);
await waitForClickable(row);
await row.click();
await waitForPresence(browser.element(by.css('.adf-is-selected')));
}
async isSelectLocationDropdownDisplayed(): Promise<boolean> {
return isPresentAndDisplayed(this.locationDropDown);
}
async isCopyButtonEnabled(): Promise<boolean> {
return isPresentAndEnabled(this.copyButton);
}
async isCancelButtonEnabled(): Promise<boolean> {
return isPresentAndEnabled(this.cancelButton);
}
async searchFor(text: string): Promise<void> {
await Utils.clearFieldWithBackspace(this.searchInput);
await this.searchInput.sendKeys(text);
await this.searchInput.sendKeys(protractor.Key.ENTER);
}
async getToolbarTitle(): Promise<string> {
return this.toolbarTitle.getText();
}
}

View File

@@ -0,0 +1,99 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2020 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 { by } from 'protractor';
import { GenericDialog } from '../dialog/generic-dialog';
import {
isPresentAndDisplayed,
waitForClickable,
isPresentAndEnabled,
typeText
} from '../../utilities/utils';
export class CreateOrEditFolderDialog extends GenericDialog {
createButton = this.childElement(
by.cssContainingText('.mat-dialog-actions button', 'Create')
);
cancelButton = this.childElement(by.id('adf-folder-cancel-button'));
updateButton = this.childElement(
by.cssContainingText('.mat-dialog-actions button', 'Update')
);
nameInput = this.rootElem.element(by.css('input[placeholder="Name" i]'));
descriptionTextArea = this.rootElem.element(
by.css('textarea[placeholder="Description" i]')
);
validationMessage = this.rootElem.element(by.css('.mat-hint span'));
constructor() {
super('adf-folder-dialog');
}
async waitForDialogToOpen() {
await super.waitForDialogToOpen();
await waitForClickable(this.nameInput);
}
async isUpdateButtonEnabled(): Promise<boolean> {
return isPresentAndEnabled(this.updateButton);
}
async isCreateButtonEnabled(): Promise<boolean> {
return isPresentAndEnabled(this.createButton);
}
async isCancelButtonEnabled(): Promise<boolean> {
return isPresentAndEnabled(this.cancelButton);
}
async getValidationMessage(): Promise<string> {
if (await isPresentAndDisplayed(this.validationMessage)) {
return this.validationMessage.getText();
} else {
return '';
}
}
async getName(): Promise<string> {
return this.nameInput.getAttribute('value');
}
async getDescription(): Promise<string> {
return this.descriptionTextArea.getAttribute('value');
}
async enterName(name: string): Promise<void> {
await typeText(this.nameInput, name);
}
async enterDescription(description: string): Promise<void> {
await typeText(this.descriptionTextArea, description);
}
async clickCancel(): Promise<void> {
await this.cancelButton.click();
await this.waitForDialogToClose();
}
}

View File

@@ -0,0 +1,97 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2020 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 { by } from 'protractor';
import { GenericDialog } from '../dialog/generic-dialog';
import {
isPresentAndDisplayed,
isPresentAndEnabled,
typeText
} from '../../utilities/utils';
export class CreateFromTemplateDialog extends GenericDialog {
createButton = this.childElement(
by.cssContainingText('.mat-dialog-actions button', 'Create')
);
cancelButton = this.childElement(
by.cssContainingText('.mat-dialog-actions button', 'CANCEL')
);
nameInput = this.childElement(by.css('input[placeholder="Name" i]'));
titleInput = this.childElement(by.css('input[placeholder="Title" i]'));
descriptionTextArea = this.childElement(
by.css('textarea[placeholder="Description" i]')
);
validationMessage = this.childElement(by.css('.mat-error'));
constructor() {
super('.aca-create-from-template-dialog');
}
async isValidationMessageDisplayed(): Promise<boolean> {
return isPresentAndDisplayed(this.validationMessage);
}
async isCreateButtonEnabled(): Promise<boolean> {
return isPresentAndEnabled(this.createButton);
}
async isCancelButtonEnabled(): Promise<boolean> {
return isPresentAndEnabled(this.cancelButton);
}
async getValidationMessage(): Promise<string> {
if (await this.isValidationMessageDisplayed()) {
return this.validationMessage.getText();
} else {
return '';
}
}
async getName(): Promise<string> {
return this.nameInput.getAttribute('value');
}
async getDescription(): Promise<string> {
return this.descriptionTextArea.getAttribute('value');
}
async enterName(name: string): Promise<void> {
await typeText(this.nameInput, name);
}
async enterTitle(title: string): Promise<void> {
await typeText(this.titleInput, title);
}
async enterDescription(description: string): Promise<void> {
await typeText(this.descriptionTextArea, description);
}
async clickCancel(): Promise<void> {
await this.cancelButton.click();
await this.waitForDialogToClose();
}
}

View File

@@ -0,0 +1,120 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2020 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 { by, ElementFinder } from 'protractor';
import { GenericDialog } from '../dialog/generic-dialog';
import {
waitForClickable,
isPresentAndEnabled,
typeText
} from '../../utilities/utils';
export class CreateLibraryDialog extends GenericDialog {
createButton = this.childElement(
by.cssContainingText('.mat-dialog-actions button', 'Create')
);
cancelButton = this.childElement(
by.cssContainingText('.mat-dialog-actions button', 'Cancel')
);
nameInput = this.rootElem.element(by.css('input[placeholder="Name" i]'));
libraryIdInput = this.rootElem.element(
by.css('input[placeholder="Library ID" i]')
);
descriptionTextArea = this.rootElem.element(
by.css('textarea[placeholder="Description" i]')
);
visibilityPublic = this.rootElem.element(
by.cssContainingText('.mat-radio-label', 'Public')
);
visibilityModerated = this.rootElem.element(
by.cssContainingText('.mat-radio-label', 'Moderated')
);
visibilityPrivate = this.rootElem.element(
by.cssContainingText('.mat-radio-label', 'Private')
);
errorMessage = this.rootElem.element(by.css('.mat-error'));
constructor() {
super('adf-library-dialog');
}
async waitForDialogToOpen(): Promise<void> {
await super.waitForDialogToOpen();
await waitForClickable(this.nameInput);
}
async getErrorMessage(): Promise<string> {
if (await this.errorMessage.isDisplayed()) {
return this.errorMessage.getText();
}
return '';
}
async enterName(name: string): Promise<void> {
await typeText(this.nameInput, name);
}
async enterLibraryId(id: string): Promise<void> {
await typeText(this.libraryIdInput, id);
}
async enterDescription(description: string): Promise<void> {
await typeText(this.descriptionTextArea, description);
}
async isCreateEnabled(): Promise<boolean> {
return isPresentAndEnabled(this.createButton);
}
async isCancelEnabled(): Promise<boolean> {
return isPresentAndEnabled(this.cancelButton);
}
async clickCancel(): Promise<void> {
await this.cancelButton.click();
await this.waitForDialogToClose();
}
private async isChecked(target: ElementFinder): Promise<boolean> {
const elemClass = await target
.element(by.xpath('..'))
.getAttribute('class');
return elemClass.includes('mat-radio-checked');
}
async isPublicChecked(): Promise<boolean> {
return this.isChecked(this.visibilityPublic);
}
async isModeratedChecked(): Promise<boolean> {
return this.isChecked(this.visibilityModerated);
}
async isPrivateChecked(): Promise<boolean> {
return this.isChecked(this.visibilityPrivate);
}
}

View File

@@ -0,0 +1,74 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2020 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, Locator } from 'protractor';
import {
isPresentAndDisplayed,
waitForPresence,
waitForVisibility,
waitForStaleness
} from '../../utilities/utils';
export abstract class GenericDialog {
constructor(private rootCssSelector?: string) {}
get rootElem(): ElementFinder {
return browser.element(by.css(this.rootCssSelector));
}
get title(): ElementFinder {
return this.rootElem.element(by.css('.mat-dialog-title'));
}
get content(): ElementFinder {
return this.rootElem.element(by.css('.mat-dialog-content'));
}
async getText(): Promise<string> {
return this.content.getText();
}
async waitForDialogToOpen(): Promise<void> {
await waitForPresence(this.rootElem);
await waitForVisibility(this.content);
await waitForPresence(browser.element(by.css('.cdk-overlay-backdrop')));
}
async waitForDialogToClose(): Promise<void> {
await waitForStaleness(this.content);
}
async isDialogOpen(): Promise<boolean> {
return isPresentAndDisplayed(this.rootElem);
}
async getTitle(): Promise<string> {
return this.title.getText();
}
protected childElement(selector: Locator): ElementFinder {
return this.rootElem.element(selector);
}
}

View File

@@ -0,0 +1,36 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2020 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/>.
*/
export * from './confirm-dialog';
export * from './content-node-selector-dialog';
export * from './create-edit-folder-dialog';
export * from './create-from-template-dialog';
export * from './create-library-dialog';
export * from './generic-dialog';
export * from './manage-versions-dialog';
export * from './password-dialog';
export * from './select-template-dialog';
export * from './share-dialog';
export * from './upload-new-version-dialog';

View File

@@ -0,0 +1,40 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2020 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 { by } from 'protractor';
import { GenericDialog } from '../dialog/generic-dialog';
export class ManageVersionsDialog extends GenericDialog {
closeButton = this.childElement(by.cssContainingText('.mat-button', 'Close'));
constructor() {
super('.aca-node-versions-dialog');
}
async clickClose(): Promise<void> {
await this.closeButton.click();
await this.waitForDialogToClose();
}
}

View File

@@ -0,0 +1,101 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2020 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 { by, browser } from 'protractor';
import { GenericDialog } from '../dialog/generic-dialog';
import {
waitForClickable,
isPresentAndEnabled,
typeText
} from '../../utilities/utils';
export class PasswordDialog extends GenericDialog {
closeButton = this.childElement(
by.css('[data-automation-id="adf-password-dialog-close"]')
);
submitButton = this.childElement(
by.css('[data-automation-id="adf-password-dialog-submit"]')
);
passwordInput = this.childElement(by.css('input[type="Password"]'));
errorMessage = this.childElement(by.css('.mat-error'));
constructor() {
super('adf-pdf-viewer-password-dialog');
}
async waitForDialogToOpen(): Promise<void> {
await super.waitForDialogToOpen();
await waitForClickable(this.passwordInput);
}
async isDialogOpen(): Promise<boolean> {
try {
await this.waitForDialogToOpen();
return true;
} catch (error) {
return false;
}
}
async isCloseEnabled(): Promise<boolean> {
return isPresentAndEnabled(this.closeButton);
}
async isSubmitEnabled(): Promise<boolean> {
return isPresentAndEnabled(this.submitButton);
}
async isPasswordInputDisplayed(): Promise<boolean> {
const present = await browser.isElementPresent(this.passwordInput);
if (present) {
return this.passwordInput.isDisplayed();
} else {
return false;
}
}
async isErrorDisplayed(): Promise<boolean> {
try {
await this.waitForDialogToOpen();
return (
(await this.errorMessage.isPresent()) &&
(await this.errorMessage.isDisplayed())
);
} catch (error) {
return false;
}
}
async getErrorMessage(): Promise<string> {
if (await this.isErrorDisplayed()) {
return this.errorMessage.getText();
}
return '';
}
async enterPassword(password: string): Promise<void> {
await typeText(this.passwordInput, password);
}
}

View File

@@ -0,0 +1,65 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2020 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 { by } from 'protractor';
import { GenericDialog } from '../dialog/generic-dialog';
import { DropDownBreadcrumb } from '../breadcrumb/dropdown-breadcrumb';
import { DataTable } from '../data-table/data-table';
import { isPresentAndEnabled } from '../../utilities/utils';
export class SelectTemplateDialog extends GenericDialog {
nextButton = this.childElement(
by.css('[data-automation-id="content-node-selector-actions-choose"]')
);
cancelButton = this.childElement(
by.css('[data-automation-id="content-node-selector-actions-cancel"]')
);
breadcrumb = new DropDownBreadcrumb();
dataTable = new DataTable('.aca-template-node-selector-dialog');
constructor() {
super('.aca-template-node-selector-dialog');
}
async isCancelButtonEnabled(): Promise<boolean> {
return isPresentAndEnabled(this.cancelButton);
}
async isNextButtonEnabled(): Promise<boolean> {
return isPresentAndEnabled(this.nextButton);
}
async clickCancel(): Promise<void> {
await this.cancelButton.click();
await this.waitForDialogToClose();
}
async clickNext(): Promise<void> {
await this.nextButton.click();
await this.waitForDialogToClose();
}
}

View File

@@ -0,0 +1,110 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2020 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 { by } from 'protractor';
import { DateTimePicker } from '../../components/datetime-picker/datetime-picker';
import { GenericDialog } from '../dialog/generic-dialog';
import { isPresentAndEnabled } from '../../utilities/utils';
export class ShareDialog extends GenericDialog {
dateTimePicker = new DateTimePicker();
dialogTitle = this.childElement(
by.css(`[data-automation-id='adf-share-dialog-title']`)
);
infoText = this.childElement(by.css('.adf-share-link__info'));
labels = this.rootElem.all(by.css('.adf-share-link__label'));
shareToggle = this.childElement(
by.css(`[data-automation-id='adf-share-toggle']`)
);
url = this.childElement(by.css(`[data-automation-id='adf-share-link']`));
urlAction = this.childElement(by.css('.adf-input-action'));
expireToggle = this.childElement(
by.css(`[data-automation-id='adf-expire-toggle']`)
);
expireInput = this.childElement(by.css('input[formcontrolname="time"]'));
datetimePickerButton = this.childElement(
by.css('.mat-datetimepicker-toggle')
);
closeButton = this.childElement(
by.css(`[data-automation-id='adf-share-dialog-close']`)
);
constructor() {
super('.adf-share-dialog');
}
async getTitle(): Promise<string> {
return this.dialogTitle.getText();
}
async getInfoText(): Promise<string> {
return this.infoText.getText();
}
async getLinkUrl(): Promise<string> {
return this.url.getAttribute('value');
}
async isUrlReadOnly(): Promise<boolean> {
const urlAttr = await this.url.getAttribute('readonly');
return urlAttr === 'true';
}
async isCloseEnabled(): Promise<boolean> {
return isPresentAndEnabled(this.closeButton);
}
async clickClose(): Promise<void> {
await this.closeButton.click();
await this.waitForDialogToClose();
}
async isShareToggleChecked(): Promise<boolean> {
const toggleClass = await this.shareToggle.getAttribute('class');
return toggleClass.includes('checked');
}
async isShareToggleDisabled(): Promise<boolean> {
const toggleClass = await this.shareToggle.getAttribute('class');
return toggleClass.includes('mat-disabled');
}
async isExpireToggleEnabled(): Promise<boolean> {
const toggleClass = await this.expireToggle.getAttribute('class');
return toggleClass.includes('checked');
}
async closeDatetimePicker(): Promise<void> {
if (await this.dateTimePicker.isCalendarOpen()) {
await this.datetimePickerButton.click();
}
}
async getExpireDate(): Promise<string> {
return this.expireInput.getAttribute('value');
}
}

View File

@@ -0,0 +1,65 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2020 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 { by } from 'protractor';
import { GenericDialog } from '../dialog/generic-dialog';
import { isPresentAndEnabled, typeText } from '../../utilities/utils';
export class UploadNewVersionDialog extends GenericDialog {
cancelButton = this.childElement(
by.cssContainingText('.mat-button', 'Cancel')
);
uploadButton = this.childElement(
by.cssContainingText('.mat-button', 'Upload')
);
majorOption = this.childElement(
by.cssContainingText(`.mat-radio-label`, 'Major')
);
minorOption = this.childElement(
by.cssContainingText(`.mat-radio-label`, 'Minor')
);
description = this.childElement(by.css('textarea'));
constructor() {
super('.aca-node-version-upload-dialog');
}
async isCancelButtonEnabled(): Promise<boolean> {
return isPresentAndEnabled(this.cancelButton);
}
async isUploadButtonEnabled(): Promise<boolean> {
return isPresentAndEnabled(this.uploadButton);
}
async clickCancel(): Promise<void> {
await this.cancelButton.click();
await this.waitForDialogToClose();
}
async enterDescription(description: string): Promise<void> {
await typeText(this.description, description);
}
}