[ADF-3724]Create tests for visibility conditions on tabs on APS1 ()

* Create tests for visibility conditions on tabs on APS1

* Fix comments

* Fix linting

* Remove the final /
This commit is contained in:
cristinaj 2019-09-18 19:25:24 +03:00 committed by Popovics András
parent d5b4caa5ed
commit 7d0d45cb59
8 changed files with 3640 additions and 3418 deletions

@ -0,0 +1,33 @@
/*!
* @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 { FormRepresentation } from '@alfresco/js-api';
export class FormModelActions {
async getFormByName(alfrescoJsApi: any, name: String): Promise<FormRepresentation> {
const forms = await alfrescoJsApi.activiti.editorApi.getForms();
const form = forms.data.find((currentForm) => {
return currentForm.name === name;
});
return form;
}
}

@ -371,4 +371,8 @@ export class TaskDetailsPage {
return BrowserActions.getText(this.emptyTaskDetails);
}
async isCompleteButtonWithFormEnabled(): Promise<boolean> {
return await this.completeFormTask.isEnabled();
}
}

@ -16,7 +16,7 @@
*/
import { browser } from 'protractor';
import { StringUtil } from '@alfresco/adf-testing';
import { StringUtil, Widget } from '@alfresco/adf-testing';
import CONSTANTS = require('../util/constants');
import { LoginPage } from '@alfresco/adf-testing';
@ -25,18 +25,23 @@ import { NavigationBarPage } from '../pages/adf/navigationBarPage';
import { TasksListPage } from '../pages/adf/process-services/tasksListPage';
import { TaskDetailsPage } from '../pages/adf/process-services/taskDetailsPage';
import { FiltersPage } from '../pages/adf/process-services/filtersPage';
import { AppsActions } from '../actions/APS/apps.actions';
import { StandaloneTask } from '../models/APS/standaloneTask';
import { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api';
import { UsersActions } from '../actions/users.actions';
import { FormModelActions } from '../actions/APS/formModel.actions';
import resources = require('../util/resources');
describe('Task Details - Form', () => {
const loginPage = new LoginPage();
const tasksListPage = new TasksListPage();
const taskDetailsPage = new TaskDetailsPage();
const filtersPage = new FiltersPage();
const widget = new Widget();
let task, otherTask, user, newForm, attachedForm, otherAttachedForm;
let newTask;
beforeAll(async () => {
const users = new UsersActions();
@ -155,4 +160,200 @@ describe('Task Details - Form', () => {
await tasksListPage.selectRow(otherTask.name);
await taskDetailsPage.checkFormIsAttached(otherAttachedForm.name);
});
describe('Task Details - Complete form with visibility conditions on tabs', () => {
const widgets = {
textOneId: 'textone',
textTwoId: 'texttwo',
textThreeId: 'textthree',
textFourId: 'textfour',
numberOneId: 'numberone'
};
const value = {
displayTab: 'showTab',
notDisplayTab: 'anythingElse'
};
const tab = {
tabWithFields: 'tabWithFields',
tabFieldValue: 'tabBasicFieldValue',
tabFieldField: 'tabBasicFieldField',
tabFieldVar: 'tabBasicFieldVar'
};
const formActions = new FormModelActions();
beforeAll(async () => {
const app = resources.Files.SIMPLE_APP_WITH_USER_FORM;
const apps = new AppsActions();
await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location);
});
beforeEach(async () => {
newTask = await this.alfrescoJsApi.activiti.taskApi.createNewTask({ name: StringUtil.generateRandomString() });
const form = await formActions.getFormByName(this.alfrescoJsApi,
resources.Files.SIMPLE_APP_WITH_USER_FORM.visibilityTabForm.formName);
await this.alfrescoJsApi.activiti.taskApi.attachForm(newTask.id, { 'formId': form.id });
await (await new NavigationBarPage().navigateToProcessServicesPage()).goToTaskApp();
await tasksListPage.checkTaskListIsLoaded();
await filtersPage.goToFilter('Involved Tasks');
await tasksListPage.checkTaskListIsLoaded();
});
it('[C315190] Should be able to complete a standalone task with visible tab with empty value for field', async () => {
await tasksListPage.selectRow(newTask.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabFieldValue);
await widget.textWidget().isWidgetVisible(widgets.textOneId);
await widget.textWidget().isWidgetNotVisible(widgets.textThreeId);
await widget.textWidget().setValue(widgets.textOneId, value.displayTab);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabFieldValue);
await taskDetailsPage.checkCompleteFormButtonIsDisplayed();
await taskDetailsPage.clickCompleteFormTask();
await tasksListPage.checkContentIsNotDisplayed(newTask.name);
await tasksListPage.checkTaskListIsLoaded();
await filtersPage.goToFilter('Completed Tasks');
await tasksListPage.checkTaskListIsLoaded();
await tasksListPage.checkContentIsDisplayed(newTask.name);
await tasksListPage.selectRow(newTask.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabFieldValue);
});
it('[C315191] Should be able to complete a standalone task with invisible tab with empty value for field', async () => {
await tasksListPage.selectRow(newTask.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabFieldValue);
await widget.textWidget().isWidgetVisible(widgets.textOneId);
await widget.textWidget().isWidgetNotVisible(widgets.textThreeId);
await taskDetailsPage.checkCompleteFormButtonIsDisplayed();
await taskDetailsPage.clickCompleteFormTask();
await tasksListPage.checkContentIsNotDisplayed(newTask.name);
await tasksListPage.checkTaskListIsLoaded();
await filtersPage.goToFilter('Completed Tasks');
await tasksListPage.checkTaskListIsLoaded();
await tasksListPage.checkContentIsDisplayed(newTask.name);
await tasksListPage.selectRow(newTask.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabFieldValue);
});
it('[C315192] Should not be able to complete a standalone task with visible tab with invalid value for field', async () => {
await tasksListPage.selectRow(newTask.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabFieldField);
await widget.textWidget().isWidgetVisible(widgets.textOneId);
await widget.textWidget().setValue(widgets.textOneId, value.displayTab);
await widget.textWidget().setValue(widgets.textTwoId, value.displayTab);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabFieldField);
await widget.tab().clickTabByLabel(tab.tabFieldField);
await widget.textWidget().setValue(widgets.numberOneId, value.displayTab);
await expect(await taskDetailsPage.isCompleteButtonWithFormEnabled()).toEqual(false);
});
it('[C315193] Should be able to complete a standalone task with invisible tab with invalid value for field', async () => {
// ACTIVITI-3746
await tasksListPage.selectRow(newTask.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabFieldField);
await widget.textWidget().isWidgetVisible(widgets.textOneId);
await widget.textWidget().setValue(widgets.textOneId, value.displayTab);
await widget.textWidget().setValue(widgets.textTwoId, value.displayTab);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabFieldField);
await widget.tab().clickTabByLabel(tab.tabFieldField);
await widget.textWidget().setValue(widgets.numberOneId, value.displayTab);
await widget.tab().clickTabByLabel(tab.tabWithFields);
await widget.textWidget().setValue(widgets.textOneId, value.notDisplayTab);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabFieldField);
await taskDetailsPage.checkCompleteFormButtonIsDisplayed();
await taskDetailsPage.clickCompleteFormTask();
await tasksListPage.checkContentIsNotDisplayed(newTask.name);
await tasksListPage.checkTaskListIsLoaded();
await filtersPage.goToFilter('Completed Tasks');
await tasksListPage.checkTaskListIsLoaded();
await tasksListPage.checkContentIsDisplayed(newTask.name);
await tasksListPage.selectRow(newTask.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabFieldValue);
});
it('[C315194] Should be able to complete a standalone task with invisible tab with valid value', async () => {
await tasksListPage.selectRow(newTask.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabFieldField);
await widget.textWidget().isWidgetVisible(widgets.textOneId);
await widget.textWidget().setValue(widgets.textOneId, value.displayTab);
await widget.textWidget().setValue(widgets.textTwoId, value.displayTab);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabFieldField);
await widget.tab().clickTabByLabel(tab.tabFieldField);
await widget.textWidget().setValue(widgets.numberOneId, '123');
await widget.tab().clickTabByLabel(tab.tabWithFields);
await widget.textWidget().setValue(widgets.textOneId, value.notDisplayTab);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabFieldField);
await taskDetailsPage.checkCompleteFormButtonIsDisplayed();
await taskDetailsPage.clickCompleteFormTask();
await tasksListPage.checkContentIsNotDisplayed(newTask.name);
await tasksListPage.checkTaskListIsLoaded();
await filtersPage.goToFilter('Completed Tasks');
await tasksListPage.checkTaskListIsLoaded();
await tasksListPage.checkContentIsDisplayed(newTask.name);
await tasksListPage.selectRow(newTask.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabFieldValue);
});
it('[C315195] Should be able to complete a standalone task with visible tab with valid value for field', async () => {
await tasksListPage.selectRow(newTask.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabFieldField);
await widget.textWidget().isWidgetVisible(widgets.textOneId);
await widget.textWidget().setValue(widgets.textOneId, value.displayTab);
await widget.textWidget().setValue(widgets.textTwoId, value.displayTab);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabFieldField);
await widget.tab().clickTabByLabel(tab.tabFieldField);
await widget.textWidget().setValue(widgets.numberOneId, '123');
await taskDetailsPage.checkCompleteFormButtonIsDisplayed();
await taskDetailsPage.clickCompleteFormTask();
await tasksListPage.checkContentIsNotDisplayed(newTask.name);
await tasksListPage.checkTaskListIsLoaded();
await filtersPage.goToFilter('Completed Tasks');
await tasksListPage.checkTaskListIsLoaded();
await tasksListPage.checkContentIsDisplayed(newTask.name);
await tasksListPage.selectRow(newTask.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabFieldValue);
});
});
});

@ -170,7 +170,7 @@ describe('Task Details component', () => {
await expect(await taskPage.taskDetails().getAssignee()).toEqual(taskModel.getAssignee().getEntireName());
await expect(await taskPage.taskDetails().getCategory()).toEqual(CONSTANTS.TASK_DETAILS.NO_CATEGORY);
await expect(await taskPage.taskDetails().getDueDate()).toEqual(CONSTANTS.TASK_DETAILS.NO_DATE);
await expect(await taskPage.taskDetails().getParentName()).toEqual(appModel.definition.models[0].name);
await expect(await taskPage.taskDetails().getParentName()).toEqual(appModel.definition.models[1].name);
await expect(await taskPage.taskDetails().getDuration()).toEqual('');
await expect(await taskPage.taskDetails().getEndDate()).toEqual('');
await expect(await taskPage.taskDetails().getParentTaskId()).toEqual('');
@ -204,7 +204,7 @@ describe('Task Details component', () => {
await expect(await taskPage.taskDetails().getAssignee()).toEqual(taskModel.getAssignee().getEntireName());
await expect(await taskPage.taskDetails().getCategory()).toEqual(CONSTANTS.TASK_DETAILS.NO_CATEGORY);
await expect(await taskPage.taskDetails().getDueDate()).toEqual(CONSTANTS.TASK_DETAILS.NO_DATE);
await expect(await taskPage.taskDetails().getParentName()).toEqual(appModel.definition.models[0].name);
await expect(await taskPage.taskDetails().getParentName()).toEqual(appModel.definition.models[1].name);
await expect(await taskPage.taskDetails().getDuration()).toEqual('');
await expect(await taskPage.taskDetails().getEndDate()).toEqual('');
await expect(await taskPage.taskDetails().getParentTaskId()).toEqual('');

@ -82,7 +82,10 @@ exports.Files = {
text_field: "activiti-textfield",
form_fieldId: "textfield",
text_field_value: "Hi tester, from Rest call"
}
},
visibilityTabForm: {
formName: "visibilityTabWithFields"
},
},
WIDGETS_SMOKE_TEST: {

6807
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -9,7 +9,7 @@ CONTEXT_ENV="process-services"
./scripts/git-util/check-branch-updated.sh -b $TRAVIS_BRANCH || exit 1;
AFFECTED_LIBS="$(./scripts/affected-libs.sh -gnu -b $TRAVIS_BRANCH)";
AFFECTED_E2E="$(./scripts/git-util/affected-folder.sh -b $TRAVIS_BRANCH -f "e2e/$CONTEXT_ENV/")";
AFFECTED_E2E="$(./scripts/git-util/affected-folder.sh -b $TRAVIS_BRANCH -f "e2e/$CONTEXT_ENV")";
node ./scripts/check-env/check-ps-env.js --host "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" || exit 1
RUN_E2E=$(echo ./scripts/test-e2e-lib.sh -host http://localhost:4200 -proxy "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" -e "$E2E_EMAIL" --use-dist -b -m 4 -gnu )