[AAE-1936] Attach File E2E APS1 (#5623)

* [AAE-1936] Attach File E2E APS1

* * minor changes

* * fix title
This commit is contained in:
dhrn
2020-04-22 02:01:26 +05:30
committed by GitHub
parent f5c08f041e
commit fde037498f
13 changed files with 427 additions and 65 deletions

View File

@@ -129,6 +129,11 @@ export class ContentNodeSelectorDialogPage {
await this.clickMoveCopyButton();
}
async searchAndSelectResult(searchText: string, name: string) {
await this.typeIntoNodeSelectorSearchField(searchText);
await this.clickContentNodeSelectorResult(name);
}
contentListPage(): DocumentListPage {
return this.contentList;
}

View File

@@ -17,16 +17,6 @@
import { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api';
export interface IntegrationType {
name: string;
tenantId: number;
alfrescoTenantId: string;
repositoryUrl: string;
shareUrl: string;
version: string;
useShareConnector: boolean;
}
export class IntegrationService {
api: AlfrescoApi;
@@ -34,14 +24,22 @@ export class IntegrationService {
this.api = api;
}
addCSIntegration(body: IntegrationType): Promise<any> {
addCSIntegration({ name, tenantId, host }): Promise<any> {
const repository = {
name,
tenantId,
alfrescoTenantId: '',
repositoryUrl: `${host}/alfresco`,
shareUrl: `${host}/share`,
version: '4.2',
useShareConnector: false
};
return this.api.activiti.integrationAccountApi.apiClient.callApi('app/rest/integration/alfresco', 'POST',
{}, {}, {}, {}, body, [], [], Object);
{}, {}, {}, {}, repository, [], [], Object);
}
authenticateRepositary(id: number, body: { username: string, password: string }): Promise<any> {
authenticateRepository(id: number, body: { username: string, password: string }): Promise<any> {
return this.api.activiti.integrationAccountApi.apiClient.callApi(`app/rest/integration/alfresco/${id}/account`, 'POST',
{}, {}, {}, body, {}, [], []);
}
}

View File

@@ -58,8 +58,14 @@ export class AttachFileWidgetPage {
await BrowserVisibility.waitUntilElementIsVisible(this.attachFileWidget);
}
async toggleAttachedFileMenu(): Promise<void> {
await BrowserActions.click(this.attachedFileMenu);
async toggleAttachedFileMenu(fieldId: string, fileName: string): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
const widget = await this.formFields.getWidget(fieldId);
const fileAttached = await widget.element(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', fileName));
await BrowserVisibility.waitUntilElementIsVisible(fileAttached);
const id = await fileAttached.getAttribute('id');
const optionMenu = widget.element(by.css(`button[id='${id}-option-menu']`));
await BrowserActions.click(optionMenu);
}
async checkAttachFileOptionsActiveForm(): Promise <void> {
@@ -87,4 +93,36 @@ export class AttachFileWidgetPage {
async removeAttachedFile(): Promise<void> {
await BrowserActions.click(this.removeFileOptionButton);
}
async viewFileEnabled(): Promise<boolean> {
return this.viewFileOptionButton.isEnabled();
}
async downloadFileEnabled(): Promise<boolean> {
return this.downloadFileOptionButton.isEnabled();
}
async removeFileEnabled(): Promise<boolean> {
return this.removeFileOptionButton.isEnabled();
}
async checkUploadIsNotVisible(fieldId): Promise<void> {
browser.setFileDetector(new remote.FileDetector());
const widget = await this.formFields.getWidget(fieldId);
const uploadButton = await widget.element(this.uploadLocator);
await BrowserVisibility.waitUntilElementIsNotPresent(uploadButton);
}
async selectUploadSource(name: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.attachedFileOptions);
await BrowserActions.click(element(by.css(`button[id="attach-${name}"]`)));
}
async clickUploadButton(fieldId): Promise<void> {
browser.setFileDetector(new remote.FileDetector());
await BrowserActions.closeMenuAndDialogs();
const widget = await this.formFields.getWidget(fieldId);
const uploadButton = await widget.element(this.uploadLocator);
await BrowserActions.click(uploadButton);
}
}

View File

@@ -0,0 +1,71 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { by, element, ElementFinder } from 'protractor';
import { BrowserActions } from '../../core/utils/browser-actions';
import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { ContentNodeSelectorDialogPage } from '../../content-services/dialog/content-node-selector-dialog.page';
import { DocumentListPage } from '../../content-services/pages/document-list.page';
export class ExternalNodeSelectorDialogPage extends ContentNodeSelectorDialogPage {
txtUsername: ElementFinder = element(by.css('input[id="username"]'));
txtPassword: ElementFinder = element(by.css('input[id="password"]'));
loginElement: ElementFinder = element(by.css('[data-automation-id="attach-file-dialog-actions-login"]'));
title: ElementFinder = element(by.css('[data-automation-id="content-node-selector-title"]'));
constructor() {
super();
this.dialog = element(by.css(`adf-content-node-selector-panel`));
this.contentList = new DocumentListPage(this.dialog);
this.dataTable = this.contentList.dataTablePage();
this.header = this.dialog.element(by.css(`header[data-automation-id='content-node-selector-title']`));
this.searchInputElement = this.dialog.element(by.css(`input[data-automation-id='content-node-selector-search-input']`));
this.selectedRow = this.dialog.element(by.css(`adf-datatable-row[class*="adf-is-selected"]`));
this.moveCopyButton = element(by.css(`button[data-automation-id="attach-file-dialog-actions-choose"]`));
}
async getTitle(): Promise<string> {
await BrowserVisibility.waitUntilElementIsPresent(this.title);
return this.title.getText();
}
async clickLoginButton() {
await BrowserActions.click(this.loginElement);
}
async enterUsername(username): Promise<void> {
await BrowserActions.clearSendKeys(this.txtUsername, username);
}
async enterPassword(password): Promise<void> {
await BrowserActions.clearSendKeys(this.txtPassword, password);
}
async waitForLogInDialog(): Promise<void> {
await BrowserVisibility.waitUntilElementIsPresent(this.title);
await BrowserVisibility.waitUntilElementIsPresent(this.txtUsername);
await BrowserVisibility.waitUntilElementIsPresent(this.txtPassword);
await BrowserVisibility.waitUntilElementIsPresent(this.loginElement);
}
async login(username, password): Promise<void> {
await this.waitForLogInDialog();
await this.enterUsername(username);
await this.enterPassword(password);
await this.clickLoginButton();
}
}

View File

@@ -24,3 +24,4 @@ export * from './task-filters.page';
export * from './process-instance-tasks.page';
export * from './start-process.page';
export * from './select-apps-dialog.page';
export * from './external-node-selector-dialog.page';

View File

@@ -58,6 +58,14 @@ export interface TestConfiguration {
clientIdSso: string;
};
adf_external_acs: {
protocol: string;
host: string;
port: string;
apiContextRoot: string;
clientIdSso: string;
};
adf_aps: {
protocol: string;
host: string;