mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-3022] Create automated test for attachment list - processes (#3575)
This commit is contained in:
@@ -18,8 +18,9 @@
|
||||
import LoginPage = require('./pages/adf/loginPage');
|
||||
import ProcessServicesPage = require('./pages/adf/process_services/processServicesPage');
|
||||
import ProcessFiltersPage = require('./pages/adf/process_services/processFiltersPage');
|
||||
import AttachmentListPage = require('./pages/adf/process_services/attachmentListPage');
|
||||
import FileModel = require('./models/ACS/fileModel');
|
||||
import { AttachmentListPage } from './pages/adf/process_services/attachmentListPage';
|
||||
|
||||
|
||||
import TestConfig = require('./test.config');
|
||||
import resources = require('./util/resources');
|
||||
@@ -43,7 +44,7 @@ describe('Attachment list', () => {
|
||||
});
|
||||
let pdfFile = new FileModel({ 'name': resources.Files.ADF_DOCUMENTS.PDF.file_name });
|
||||
|
||||
beforeAll(async (done) => {
|
||||
beforeAll(async(done) => {
|
||||
let users = new UsersActions();
|
||||
let apps = new AppsActions();
|
||||
|
||||
|
@@ -1,42 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2016 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.
|
||||
*/
|
||||
|
||||
var Util = require('../../../util/util');
|
||||
var TestConfig = require('../../../test.config');
|
||||
var path = require('path');
|
||||
|
||||
var AttachmentListPage = function () {
|
||||
|
||||
var attachFileButton = element(by.css("input[type='file']"));
|
||||
|
||||
this.clickAttachFileButton = function (fileLocation) {
|
||||
Util.waitUntilElementIsVisible(attachFileButton);
|
||||
attachFileButton.sendKeys(path.resolve(path.join(TestConfig.main.rootPath, fileLocation)));
|
||||
};
|
||||
|
||||
this.checkFileIsAttached = function (name) {
|
||||
var fileAttached = element.all(by.css('div[filename="'+name+'"]')).first();
|
||||
Util.waitUntilElementIsVisible(fileAttached);
|
||||
|
||||
};
|
||||
|
||||
this.checkAttachFileButtonIsNotDisplayed = function () {
|
||||
Util.waitUntilElementIsNotVisible(attachFileButton);
|
||||
};
|
||||
|
||||
};
|
||||
module.exports = AttachmentListPage;
|
101
e2e/pages/adf/process_services/attachmentListPage.ts
Normal file
101
e2e/pages/adf/process_services/attachmentListPage.ts
Normal file
@@ -0,0 +1,101 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2016 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 Util = require('../../../util/util');
|
||||
import TestConfig = require('../../../test.config');
|
||||
import path = require('path');
|
||||
|
||||
export class AttachmentListPage {
|
||||
|
||||
attachFileButton = element(by.css("input[type='file']"));
|
||||
buttonMenu = element(by.css("button[data-automation-id='action_menu_0']"));
|
||||
menuPanel = element(by.css("div[class*='mat-menu-panel'] div[class*='mat-menu-content']"));
|
||||
viewButton = element(by.css("button[data-automation-id*='MENU_ACTIONS.VIEW_CONTENT']"));
|
||||
removeButton = element(by.css("button[data-automation-id*='MENU_ACTIONS.REMOVE_CONTENT']"));
|
||||
downloadButton = element(by.css("button[data-automation-id*='MENU_ACTIONS.DOWNLOAD_CONTENT']"));
|
||||
noContentContainer = element(by.css("div[class*='adf-no-content-container']"));
|
||||
|
||||
checkEmptyAttachmentList() {
|
||||
Util.waitUntilElementIsVisible(this.noContentContainer);
|
||||
}
|
||||
|
||||
clickAttachFileButton(fileLocation) {
|
||||
Util.waitUntilElementIsVisible(this.attachFileButton);
|
||||
this.attachFileButton.sendKeys(path.resolve(path.join(TestConfig.main.rootPath, fileLocation)));
|
||||
}
|
||||
|
||||
checkFileIsAttached(name) {
|
||||
let fileAttached = element(by.css('div[filename="' + name + '"]'));
|
||||
Util.waitUntilElementIsVisible(fileAttached);
|
||||
}
|
||||
|
||||
checkAttachFileButtonIsNotDisplayed() {
|
||||
Util.waitUntilElementIsNotVisible(this.attachFileButton);
|
||||
}
|
||||
|
||||
viewFile(name) {
|
||||
let fileAttached = element(by.css('div[filename="' + name + '"]'));
|
||||
Util.waitUntilElementIsVisible(fileAttached);
|
||||
fileAttached.click();
|
||||
Util.waitUntilElementIsVisible(this.buttonMenu);
|
||||
Util.waitUntilElementIsClickable(this.buttonMenu);
|
||||
this.buttonMenu.click();
|
||||
Util.waitUntilElementIsVisible(this.menuPanel);
|
||||
Util.waitUntilElementIsVisible(this.viewButton);
|
||||
this.viewButton.click();
|
||||
return this;
|
||||
}
|
||||
|
||||
removeFile(name) {
|
||||
let fileAttached = element(by.css('div[filename="' + name + '"]'));
|
||||
fileAttached.click();
|
||||
Util.waitUntilElementIsVisible(this.buttonMenu);
|
||||
Util.waitUntilElementIsClickable(this.buttonMenu);
|
||||
this.buttonMenu.click();
|
||||
Util.waitUntilElementIsVisible(this.menuPanel);
|
||||
Util.waitUntilElementIsVisible(this.removeButton);
|
||||
this.removeButton.click();
|
||||
return this;
|
||||
}
|
||||
|
||||
downloadFile(name) {
|
||||
let fileAttached = element(by.css('div[filename="' + name + '"]'));
|
||||
fileAttached.click();
|
||||
Util.waitUntilElementIsVisible(this.buttonMenu);
|
||||
Util.waitUntilElementIsClickable(this.buttonMenu);
|
||||
this.buttonMenu.click();
|
||||
Util.waitUntilElementIsVisible(this.menuPanel);
|
||||
Util.waitUntilElementIsVisible(this.downloadButton);
|
||||
this.downloadButton.click();
|
||||
return this;
|
||||
}
|
||||
|
||||
doubleClickFile(name) {
|
||||
let fileAttached = element(by.css('div[filename="' + name + '"]'));
|
||||
Util.waitUntilElementIsVisible(fileAttached);
|
||||
Util.waitUntilElementIsClickable(fileAttached);
|
||||
fileAttached.click();
|
||||
browser.actions().sendKeys(protractor.Key.ENTER).perform();
|
||||
}
|
||||
|
||||
checkFileIsRemoved(name) {
|
||||
let fileAttached = element(by.css('div[filename="' + name + '"]'));
|
||||
Util.waitUntilElementIsNotVisible(fileAttached);
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
190
e2e/process_attachmentList_actionMenu.e2e.ts
Normal file
190
e2e/process_attachmentList_actionMenu.e2e.ts
Normal file
@@ -0,0 +1,190 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2016 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 LoginPage = require('./pages/adf/loginPage');
|
||||
import ProcessServicesPage = require('./pages/adf/process_services/processServicesPage');
|
||||
import ProcessFiltersPage = require('./pages/adf/process_services/processFiltersPage.js');
|
||||
import ProcessDetailsPage = require('./pages/adf/process_services/processDetailsPage.js');
|
||||
import { AttachmentListPage } from './pages/adf/process_services/attachmentListPage';
|
||||
import ViewerPage = require('./pages/adf/viewerPage.js');
|
||||
|
||||
import CONSTANTS = require('./util/constants');
|
||||
|
||||
import TestConfig = require('./test.config');
|
||||
import resources = require('./util/resources');
|
||||
import Util = require('./util/util.js');
|
||||
|
||||
import path = require('path');
|
||||
|
||||
import AlfrescoApi = require('alfresco-js-api-node');
|
||||
import {UsersActions} from './actions/users.actions';
|
||||
import {AppsActions} from './actions/APS/apps.actions';
|
||||
import FileModel = require('./models/ACS/fileModel');
|
||||
|
||||
describe('Attachment list action menu for processes', () => {
|
||||
|
||||
let loginPage = new LoginPage();
|
||||
let processServicesPage = new ProcessServicesPage();
|
||||
let processFiltersPage = new ProcessFiltersPage();
|
||||
let processDetailsPage = new ProcessDetailsPage();
|
||||
let attachmentListPage = new AttachmentListPage();
|
||||
let viewerPage = new ViewerPage();
|
||||
let app = resources.Files.SIMPLE_APP_WITH_USER_FORM;
|
||||
let jpgFile = new FileModel({
|
||||
location: resources.Files.ADF_DOCUMENTS.JPG.file_location,
|
||||
name: resources.Files.ADF_DOCUMENTS.JPG.file_name
|
||||
});
|
||||
|
||||
let downloadedJpgFile = path.join(__dirname, 'downloads', jpgFile.name);
|
||||
let tenantId, appId;
|
||||
let processName = {
|
||||
active: 'Active Process',
|
||||
completed: 'Completed Process',
|
||||
taskApp: 'Task App Name',
|
||||
emptyList: 'Empty List',
|
||||
dragDrop: 'Drag and Drop'
|
||||
};
|
||||
|
||||
beforeAll(async(done) => {
|
||||
let apps = new AppsActions();
|
||||
let users = new UsersActions();
|
||||
|
||||
this.alfrescoJsApi = new AlfrescoApi({
|
||||
provider: 'BPM',
|
||||
hostBpm: TestConfig.adf.url
|
||||
});
|
||||
|
||||
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
|
||||
|
||||
let user = await users.createTenantAndUser(this.alfrescoJsApi);
|
||||
|
||||
tenantId = user.tenantId;
|
||||
|
||||
await this.alfrescoJsApi.login(user.email, user.password);
|
||||
|
||||
let importedApp = await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location);
|
||||
appId = importedApp.id;
|
||||
|
||||
await apps.startProcess(this.alfrescoJsApi, importedApp, processName.completed);
|
||||
await apps.startProcess(this.alfrescoJsApi, importedApp, processName.active);
|
||||
await apps.startProcess(this.alfrescoJsApi, 'Task App', processName.taskApp);
|
||||
await apps.startProcess(this.alfrescoJsApi, 'Task App', processName.emptyList);
|
||||
await apps.startProcess(this.alfrescoJsApi, 'Task App', processName.dragDrop);
|
||||
|
||||
await loginPage.loginToProcessServicesUsingUserModel(user);
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
afterAll(async(done) => {
|
||||
await this.alfrescoJsApi.activiti.modelsApi.deleteModel(appId);
|
||||
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
|
||||
await this.alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(tenantId);
|
||||
done();
|
||||
});
|
||||
|
||||
it('[C260228] Option menu functionality - Active Process', () => {
|
||||
processServicesPage.goToProcessServices().goToApp(app.title).clickProcessButton();
|
||||
|
||||
processFiltersPage.selectFromProcessList(processName.active);
|
||||
|
||||
processDetailsPage.checkProcessTitleIsDisplayed();
|
||||
|
||||
attachmentListPage.clickAttachFileButton(jpgFile.location);
|
||||
attachmentListPage.viewFile(jpgFile.name);
|
||||
|
||||
viewerPage.checkFileNameIsDisplayed(jpgFile.name);
|
||||
viewerPage.clickCloseButton();
|
||||
|
||||
processFiltersPage.clickRunningFilterButton();
|
||||
processFiltersPage.selectFromProcessList(processName.active);
|
||||
|
||||
attachmentListPage.doubleClickFile(jpgFile.name);
|
||||
|
||||
viewerPage.checkFileNameIsDisplayed(jpgFile.name);
|
||||
viewerPage.clickCloseButton();
|
||||
|
||||
processFiltersPage.clickRunningFilterButton();
|
||||
processFiltersPage.selectFromProcessList(processName.active);
|
||||
|
||||
attachmentListPage.downloadFile(jpgFile.name);
|
||||
|
||||
expect(Util.fileExists(downloadedJpgFile, 20)).toBe(true);
|
||||
|
||||
attachmentListPage.removeFile(jpgFile.name);
|
||||
attachmentListPage.checkFileIsRemoved(jpgFile.name);
|
||||
});
|
||||
|
||||
it('[C279886Edit] Option menu functionality - Completed Process', () => {
|
||||
processServicesPage.goToProcessServices().goToApp(app.title).clickProcessButton();
|
||||
|
||||
processFiltersPage.clickRunningFilterButton();
|
||||
processFiltersPage.selectFromProcessList(processName.completed);
|
||||
|
||||
processDetailsPage.checkProcessTitleIsDisplayed();
|
||||
|
||||
attachmentListPage.clickAttachFileButton(jpgFile.location);
|
||||
|
||||
processDetailsPage.clickCancelProcessButton();
|
||||
|
||||
processFiltersPage.clickCompletedFilterButton();
|
||||
|
||||
processDetailsPage.checkProcessTitleIsDisplayed();
|
||||
|
||||
attachmentListPage.checkAttachFileButtonIsNotDisplayed();
|
||||
attachmentListPage.viewFile(jpgFile.name);
|
||||
|
||||
viewerPage.checkFileNameIsDisplayed(jpgFile.name);
|
||||
viewerPage.clickCloseButton();
|
||||
|
||||
processFiltersPage.clickCompletedFilterButton();
|
||||
|
||||
attachmentListPage.downloadFile(jpgFile.name);
|
||||
|
||||
expect(Util.fileExists(downloadedJpgFile, 20)).toBe(true);
|
||||
|
||||
attachmentListPage.removeFile(jpgFile.name);
|
||||
attachmentListPage.checkFileIsRemoved(jpgFile.name);
|
||||
});
|
||||
|
||||
it('[C277296] Upload file - ProcessList - Task APP', () => {
|
||||
processServicesPage.goToProcessServices().goToTaskApp().clickProcessButton();
|
||||
|
||||
processFiltersPage.clickRunningFilterButton();
|
||||
processFiltersPage.selectFromProcessList(processName.taskApp);
|
||||
|
||||
processDetailsPage.checkProcessTitleIsDisplayed();
|
||||
|
||||
attachmentListPage.clickAttachFileButton(jpgFile.location);
|
||||
attachmentListPage.checkFileIsAttached(jpgFile.name);
|
||||
});
|
||||
|
||||
it('[C260235] Empty list component', () => {
|
||||
processServicesPage.goToProcessServices().goToTaskApp().clickProcessButton();
|
||||
|
||||
processFiltersPage.clickRunningFilterButton();
|
||||
processFiltersPage.selectFromProcessList(processName.emptyList);
|
||||
|
||||
attachmentListPage.checkEmptyAttachmentList();
|
||||
attachmentListPage.clickAttachFileButton(jpgFile.location);
|
||||
attachmentListPage.checkFileIsAttached(jpgFile.name);
|
||||
attachmentListPage.removeFile(jpgFile.name);
|
||||
attachmentListPage.checkFileIsRemoved(jpgFile.name);
|
||||
attachmentListPage.checkEmptyAttachmentList();
|
||||
});
|
||||
|
||||
});
|
@@ -26,7 +26,7 @@ import StartProcessPage = require('./pages/adf/process_services/startProcessPage
|
||||
import ProcessFiltersPage = require('./pages/adf/process_services/processFiltersPage');
|
||||
import AppNavigationBarPage = require('./pages/adf/process_services/appNavigationBarPage');
|
||||
import ProcessDetailsPage = require('./pages/adf/process_services/processDetailsPage');
|
||||
import AttachmentListPage = require('./pages/adf/process_services/attachmentListPage');
|
||||
import {AttachmentListPage} from './pages/adf/process_services/attachmentListPage';
|
||||
|
||||
import User = require('./models/APS/User');
|
||||
import AppPublish = require('./models/APS/AppPublish');
|
||||
|
@@ -18,7 +18,7 @@
|
||||
import LoginPage = require('./pages/adf/loginPage');
|
||||
import ProcessServicesPage = require('./pages/adf/process_services/processServicesPage');
|
||||
import TasksPage = require('./pages/adf/process_services/tasksPage');
|
||||
import AttachmentListPage = require('./pages/adf/process_services/attachmentListPage');
|
||||
import {AttachmentListPage} from './pages/adf/process_services/attachmentListPage';
|
||||
import CONSTANTS = require('./util/constants');
|
||||
|
||||
import Task = require('./models/APS/Task');
|
||||
|
@@ -18,7 +18,7 @@
|
||||
import LoginPage = require('./pages/adf/loginPage');
|
||||
import ProcessServicesPage = require('./pages/adf/process_services/processServicesPage');
|
||||
import TasksPage = require('./pages/adf/process_services/tasksPage');
|
||||
import AttachmentListPage = require('./pages/adf/process_services/attachmentListPage');
|
||||
import {AttachmentListPage} from './pages/adf/process_services/attachmentListPage';
|
||||
|
||||
import CONSTANTS = require('./util/constants');
|
||||
|
||||
|
Reference in New Issue
Block a user