[AAE-1929] Attach Folder APS1 E2E (#5606)

* [AAE-1929] Attach Folder APS1 E2E

* * updated selector

* * wait for spinner

* * wait for spinner
This commit is contained in:
dhrn
2020-04-15 20:32:41 +05:30
committed by GitHub
parent bb74dbf9a0
commit 4cdaced7bc
7 changed files with 238 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
/*!
* @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 { 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;
constructor(api: AlfrescoApi) {
this.api = api;
}
addCSIntegration(body: IntegrationType): Promise<any> {
return this.api.activiti.integrationAccountApi.apiClient.callApi('app/rest/integration/alfresco', 'POST',
{}, {}, {}, {}, body, [], [], Object);
}
authenticateRepositary(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

@@ -17,3 +17,4 @@
export * from './applications.service';
export * from './models.service';
export * from './integration.service';

View File

@@ -0,0 +1,58 @@
/*!
* @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 * as remote from 'selenium-webdriver/remote';
import { browser, by, element } from 'protractor';
import { FormFields } from '../form-fields';
import { BrowserActions, BrowserVisibility } from '../../../utils/public-api';
export class AttachFolderWidgetPage {
formFields: FormFields = new FormFields();
foldersListLocator = by.css('.adf-attach-folder-result');
async clickWidget(fieldId: string): Promise<void> {
browser.setFileDetector(new remote.FileDetector());
const widget = await this.formFields.getWidget(fieldId).element(by.css(`button[id="folder-${fieldId}-button"]`));
await BrowserActions.click(widget);
}
async checkFolderIsAttached(fieldId, name): Promise<void> {
const widget = await this.formFields.getWidget(fieldId);
const folderAttached = widget.element(this.foldersListLocator).element(by.cssContainingText('span', name));
await BrowserVisibility.waitUntilElementIsVisible(folderAttached);
}
async checkFolderIsNotAttached(fieldId, name): Promise<void> {
const widget = await this.formFields.getWidget(fieldId);
const folderAttached = widget.element(this.foldersListLocator).element(by.cssContainingText('span', name));
await BrowserVisibility.waitUntilElementIsNotPresent(folderAttached);
}
async attachFileWidgetDisplayed(id: string): Promise<void> {
const locator = element(by.css(id ? id : '#attachfolder'));
await BrowserVisibility.waitUntilElementIsVisible(locator);
}
async removeFolder(fieldId: string, name: string): Promise<void> {
await this.checkFolderIsAttached(fieldId, name);
const widget = await this.formFields.getWidget(fieldId);
const folderToBeRemoved = widget.element(this.foldersListLocator).element(by.css(`[id="folder-${fieldId}-remove"]`));
await BrowserActions.click(folderToBeRemoved);
}
}

View File

@@ -36,6 +36,7 @@ import { TabPage } from './tab.page';
import { DocumentWidgetPage } from './document-widget.page';
import { GroupWidgetPage } from './group-widget.page';
import { TypeaheadWidgetPage } from './typeahead-widget.page';
import { AttachFolderWidgetPage } from './attach-folder-widget.page';
export class Widget {
@@ -55,6 +56,10 @@ export class Widget {
return new AttachFileWidgetPage();
}
attachFolderWidget(): AttachFolderWidgetPage {
return new AttachFolderWidgetPage();
}
displayValueWidget(): DisplayValueWidgetPage {
return new DisplayValueWidgetPage();
}