mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-3282] Add tests for length validation process/task name (#4083)
* add test for task name length validation * add test for process name length validation * add blur method * modify number of characters
This commit is contained in:
committed by
Eugenio Romano
parent
0357adc641
commit
6a6e9f3b39
@@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { element, by } from 'protractor';
|
import { element, by, Key } from 'protractor';
|
||||||
import { Util } from '../../../../util/util';
|
import { Util } from '../../../../util/util';
|
||||||
|
|
||||||
export class StartTaskDialog {
|
export class StartTaskDialog {
|
||||||
@@ -103,4 +103,16 @@ export class StartTaskDialog {
|
|||||||
Util.waitUntilElementIsClickable(this.cancelButton);
|
Util.waitUntilElementIsClickable(this.cancelButton);
|
||||||
return this.cancelButton.click();
|
return this.cancelButton.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
blur(locator) {
|
||||||
|
locator.click();
|
||||||
|
locator.sendKeys(Key.TAB);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
checkValidationErrorIsDisplayed(error, elementRef = 'mat-error') {
|
||||||
|
const errorElement = element(by.cssContainingText(elementRef, error));
|
||||||
|
Util.waitUntilElementIsVisible(errorElement);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -145,4 +145,9 @@ export class StartProcessPage {
|
|||||||
return processPlaceholder;
|
return processPlaceholder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
checkValidationErrorIsDisplayed(error, elementRef = 'mat-error') {
|
||||||
|
const errorElement = element(by.cssContainingText(elementRef, error));
|
||||||
|
Util.waitUntilElementIsVisible(errorElement);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -54,6 +54,9 @@ describe('Start Process Component', () => {
|
|||||||
let simpleApp = resources.Files.WIDGETS_SMOKE_TEST;
|
let simpleApp = resources.Files.WIDGETS_SMOKE_TEST;
|
||||||
let appId, procUserModel, secondProcUserModel, tenantId, simpleAppCreated;
|
let appId, procUserModel, secondProcUserModel, tenantId, simpleAppCreated;
|
||||||
let processModelWithSe = 'process_with_se', processModelWithoutSe = 'process_without_se';
|
let processModelWithSe = 'process_with_se', processModelWithoutSe = 'process_without_se';
|
||||||
|
const processName255Characters = Util.generateRandomString(255);
|
||||||
|
const processNameBiggerThen255Characters = Util.generateRandomString(256);
|
||||||
|
const lengthValidationError = 'Length exceeded, 255 characters max.';
|
||||||
|
|
||||||
let auditLogFile = path.join('../e2e/download/', 'Audit.pdf');
|
let auditLogFile = path.join('../e2e/download/', 'Audit.pdf');
|
||||||
|
|
||||||
@@ -423,6 +426,21 @@ describe('Start Process Component', () => {
|
|||||||
attachmentListPage.checkAttachFileButtonIsNotDisplayed();
|
attachmentListPage.checkAttachFileButtonIsNotDisplayed();
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
it('[C291781] Should be displayed an error message if process name exceed 255 characters', () => {
|
||||||
|
processServicesPage.goToApp(app.title);
|
||||||
|
|
||||||
|
appNavigationBarPage.clickProcessButton();
|
||||||
|
|
||||||
|
processFiltersPage.clickCreateProcessButton();
|
||||||
|
processFiltersPage.clickNewProcessDropdown();
|
||||||
|
|
||||||
|
startProcessPage.enterProcessName(processName255Characters);
|
||||||
|
startProcessPage.selectFromProcessDropdown(processModelWithoutSe);
|
||||||
|
startProcessPage.checkStartProcessButtonIsEnabled();
|
||||||
|
|
||||||
|
startProcessPage.enterProcessName(processNameBiggerThen255Characters);
|
||||||
|
startProcessPage.checkValidationErrorIsDisplayed(lengthValidationError);
|
||||||
|
startProcessPage.checkStartProcessButtonIsDisabled();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@@ -33,6 +33,7 @@ import resources = require('../util/resources');
|
|||||||
|
|
||||||
import AlfrescoApi = require('alfresco-js-api-node');
|
import AlfrescoApi = require('alfresco-js-api-node');
|
||||||
import { UsersActions } from '../actions/users.actions';
|
import { UsersActions } from '../actions/users.actions';
|
||||||
|
import { Util } from '../util/util';
|
||||||
import fs = require('fs');
|
import fs = require('fs');
|
||||||
import path = require('path');
|
import path = require('path');
|
||||||
|
|
||||||
@@ -49,6 +50,9 @@ describe('Start Task - Task App', () => {
|
|||||||
let formFieldValue = 'First value ';
|
let formFieldValue = 'First value ';
|
||||||
let taskPage = new TasksPage();
|
let taskPage = new TasksPage();
|
||||||
let firstComment = 'comm1', firstChecklist = 'checklist1';
|
let firstComment = 'comm1', firstChecklist = 'checklist1';
|
||||||
|
const taskName255Characters = Util.generateRandomString(255);
|
||||||
|
const taskNameBiggerThen255Characters = Util.generateRandomString(256);
|
||||||
|
const lengthValidationError = 'Length exceeded, 255 characters max.';
|
||||||
let tasks = ['Modifying task', 'Information box', 'No form', 'Not Created', 'Refreshing form', 'Assignee task', 'Attach File'];
|
let tasks = ['Modifying task', 'Information box', 'No form', 'Not Created', 'Refreshing form', 'Assignee task', 'Attach File'];
|
||||||
let showHeaderTask = 'Show Header';
|
let showHeaderTask = 'Show Header';
|
||||||
let jpgFile = new FileModel({
|
let jpgFile = new FileModel({
|
||||||
@@ -184,4 +188,12 @@ describe('Start Task - Task App', () => {
|
|||||||
taskPage.tasksListPage().getDataTable().checkSpinnerIsDisplayed();
|
taskPage.tasksListPage().getDataTable().checkSpinnerIsDisplayed();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('[C291780] Should be displayed an error message if task name exceed 255 characters', () => {
|
||||||
|
navigationBarPage.navigateToProcessServicesPage().goToTaskApp().clickTasksButton();
|
||||||
|
taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
|
||||||
|
const startDialog = taskPage.createNewTask().addName(taskName255Characters).checkStartButtonIsEnabled();
|
||||||
|
startDialog.addName(taskNameBiggerThen255Characters).blur(startDialog.name).checkValidationErrorIsDisplayed(lengthValidationError).checkStartButtonIsDisabled();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user