mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-19 17:14:57 +00:00
[ADF-3608] Automated test for required dropdown column in Dynamic Table (#3896)
This commit is contained in:
parent
0ecb6c13ec
commit
ccc52d40dd
@ -16,15 +16,34 @@
|
||||
*/
|
||||
|
||||
import FormFields = require('../formFields');
|
||||
import Util = require('../../../../util/util');
|
||||
import { by, element } from 'protractor';
|
||||
|
||||
export class Dropdown {
|
||||
|
||||
formFields = new FormFields();
|
||||
|
||||
selectedOptionLocator = by.css('mat-select[id="dropdown"] span span');
|
||||
dropdown = element(by.id('dropdown'));
|
||||
|
||||
getSelectedOptionText(fieldId) {
|
||||
return this.formFields.getFieldText(fieldId, this.selectedOptionLocator);
|
||||
}
|
||||
|
||||
selectOption(option) {
|
||||
this.openDropdown();
|
||||
let row = element(by.cssContainingText('mat-option span', option));
|
||||
return row.click();
|
||||
}
|
||||
|
||||
openDropdown() {
|
||||
this.checkDropdownIsDisplayed();
|
||||
Util.waitUntilElementIsClickable(this.dropdown);
|
||||
return this.dropdown.click();
|
||||
}
|
||||
|
||||
checkDropdownIsDisplayed() {
|
||||
Util.waitUntilElementIsVisible(this.dropdown);
|
||||
return this.dropdown;
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
import FormFields = require('../formFields');
|
||||
import Util = require('../../../../util/util');
|
||||
import { element, by, browser, protractor } from 'protractor';
|
||||
|
||||
export class DynamicTable {
|
||||
formFields = new FormFields();
|
||||
@ -30,7 +31,7 @@ export class DynamicTable {
|
||||
calendarContent = element(by.css('div[class="mat-datetimepicker-calendar-content"]'));
|
||||
saveButton = element(by.cssContainingText('button span', 'Save'));
|
||||
errorMessage = element(by.css('div[class="adf-error-text"]'));
|
||||
dateWidget = element(by.css('button[aria-label="Open calendar"]'));
|
||||
dateWidget = element.all(by.css('button[aria-label="Open calendar"]')).first();
|
||||
calendarNumber = element.all(by.css('td div'));
|
||||
tableRow = element.all(by.css('tbody tr'));
|
||||
|
||||
@ -96,4 +97,10 @@ export class DynamicTable {
|
||||
waitForCalendarToDisappear() {
|
||||
Util.waitUntilElementIsNotVisible(this.calendarNumber);
|
||||
}
|
||||
|
||||
checkItemIsPresent(item) {
|
||||
let row = element(by.cssContainingText('table tbody tr td span', item));
|
||||
let present = Util.waitUntilElementIsVisible(row);
|
||||
expect(present).toBe(true);
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ import { ProcessServicesPage } from '../pages/adf/process_services/processServic
|
||||
import ProcessFiltersPage = require('../pages/adf/process_services/processFiltersPage');
|
||||
import { AppNavigationBarPage } from '../pages/adf/process_services/appNavigationBarPage';
|
||||
import { DynamicTable } from '../pages/adf/process_services/widgets/dynamicTable';
|
||||
import { Dropdown } from '../pages/adf/process_services/widgets/dropdown';
|
||||
|
||||
import TestConfig = require('../test.config');
|
||||
import resources = require('../util/resources');
|
||||
@ -28,25 +29,14 @@ import AlfrescoApi = require('alfresco-js-api-node');
|
||||
import { AppsActions } from '../actions/APS/apps.actions';
|
||||
import { UsersActions } from '../actions/users.actions';
|
||||
|
||||
describe('Dynamic Table - Date Picker', () => {
|
||||
describe('Dynamic Table', () => {
|
||||
|
||||
let loginPage = new LoginPage();
|
||||
let processServicesPage = new ProcessServicesPage();
|
||||
let processFiltersPage = new ProcessFiltersPage();
|
||||
let appNavigationBarPage = new AppNavigationBarPage();
|
||||
let dynamicTable = new DynamicTable();
|
||||
|
||||
let app = resources.Files.DYNAMIC_TABLE_APP;
|
||||
let user, tenantId, appId;
|
||||
|
||||
let randomText = {
|
||||
date: 'HELLO WORLD',
|
||||
dateTime: 'Test',
|
||||
error: `Field 'columnDate' is required.`
|
||||
};
|
||||
|
||||
let datePosition = 15;
|
||||
let rowPosition = 0;
|
||||
let user, tenantId, appId, apps, users;
|
||||
|
||||
beforeAll(async(done) => {
|
||||
this.alfrescoJsApi = new AlfrescoApi({
|
||||
@ -54,8 +44,8 @@ describe('Dynamic Table - Date Picker', () => {
|
||||
hostBpm: TestConfig.adf.url
|
||||
});
|
||||
|
||||
let apps = new AppsActions();
|
||||
let users = new UsersActions();
|
||||
apps = new AppsActions();
|
||||
users = new UsersActions();
|
||||
|
||||
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
|
||||
|
||||
@ -63,21 +53,10 @@ describe('Dynamic Table - Date Picker', () => {
|
||||
|
||||
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 loginPage.loginToProcessServicesUsingUserModel(user);
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
afterAll(async(done) => {
|
||||
await this.alfrescoJsApi.login(user.email, user.password);
|
||||
|
||||
await this.alfrescoJsApi.activiti.modelsApi.deleteModel(appId);
|
||||
|
||||
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
|
||||
|
||||
await this.alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(tenantId);
|
||||
@ -85,41 +64,108 @@ describe('Dynamic Table - Date Picker', () => {
|
||||
done();
|
||||
});
|
||||
|
||||
it('[C286277] Should have a datepicker and a mask for DateTime field', () => {
|
||||
processServicesPage.goToProcessServices().goToTaskApp().clickProcessButton();
|
||||
describe('Date Picker', () => {
|
||||
let app = resources.Files.DYNAMIC_TABLE_APP;
|
||||
|
||||
appNavigationBarPage.clickProcessButton();
|
||||
let randomText = {
|
||||
date: 'HELLO WORLD',
|
||||
dateTime: 'Test',
|
||||
error: `Field 'columnDate' is required.`
|
||||
};
|
||||
|
||||
processFiltersPage.clickCreateProcessButton();
|
||||
processFiltersPage.clickNewProcessDropdown();
|
||||
let datePosition = 15;
|
||||
let rowPosition = 0;
|
||||
|
||||
dynamicTable.clickAddButton();
|
||||
dynamicTable.clickColumnDateTime();
|
||||
beforeAll(async(done) => {
|
||||
await this.alfrescoJsApi.login(user.email, user.password);
|
||||
|
||||
expect(dynamicTable.addRandomStringOnDateTime(randomText.dateTime)).toBe('');
|
||||
let importedApp = await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location);
|
||||
appId = importedApp.id;
|
||||
|
||||
await loginPage.loginToProcessServicesUsingUserModel(user);
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
afterAll(async(done) => {
|
||||
await this.alfrescoJsApi.login(user.email, user.password);
|
||||
|
||||
await this.alfrescoJsApi.activiti.modelsApi.deleteModel(appId);
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
processServicesPage.goToProcessServices().goToTaskApp().clickProcessButton();
|
||||
|
||||
appNavigationBarPage.clickProcessButton();
|
||||
|
||||
processFiltersPage.clickCreateProcessButton();
|
||||
processFiltersPage.clickNewProcessDropdown();
|
||||
});
|
||||
|
||||
it('[C286277] Should have a datepicker and a mask for DateTime field', () => {
|
||||
dynamicTable.clickAddButton();
|
||||
dynamicTable.clickColumnDateTime();
|
||||
|
||||
expect(dynamicTable.addRandomStringOnDateTime(randomText.dateTime)).toBe('');
|
||||
});
|
||||
|
||||
it('[C286279] Should be able to save row with Date field', () => {
|
||||
dynamicTable.clickAddButton();
|
||||
dynamicTable.addRandomStringOnDate(randomText.date);
|
||||
dynamicTable.clickSaveButton();
|
||||
|
||||
expect(dynamicTable.checkErrorMessage()).toBe(randomText.error);
|
||||
|
||||
dynamicTable.clickDateWidget();
|
||||
dynamicTable.getDateCalendarNumber(datePosition);
|
||||
dynamicTable.waitForCalendarToDisappear();
|
||||
dynamicTable.clickSaveButton();
|
||||
dynamicTable.getTableRow(rowPosition);
|
||||
});
|
||||
});
|
||||
|
||||
it('[C286279] Should be able to save row with Date field', () => {
|
||||
loginPage.loginToProcessServicesUsingUserModel(user);
|
||||
describe('Required Dropdown', () => {
|
||||
let app = resources.Files.APP_DYNAMIC_TABLE_DROPDOWN;
|
||||
let dropdown = new Dropdown();
|
||||
|
||||
processServicesPage.goToProcessServices().goToTaskApp().clickProcessButton();
|
||||
beforeAll(async(done) => {
|
||||
|
||||
appNavigationBarPage.clickProcessButton();
|
||||
await this.alfrescoJsApi.login(user.email, user.password);
|
||||
|
||||
processFiltersPage.clickCreateProcessButton();
|
||||
processFiltersPage.clickNewProcessDropdown();
|
||||
let importedApp = await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location);
|
||||
appId = importedApp.id;
|
||||
|
||||
dynamicTable.clickAddButton();
|
||||
dynamicTable.addRandomStringOnDate(randomText.date);
|
||||
dynamicTable.clickSaveButton();
|
||||
await loginPage.loginToProcessServicesUsingUserModel(user);
|
||||
|
||||
expect(dynamicTable.checkErrorMessage()).toBe(randomText.error);
|
||||
done();
|
||||
});
|
||||
|
||||
dynamicTable.clickDateWidget();
|
||||
dynamicTable.getDateCalendarNumber(datePosition);
|
||||
dynamicTable.waitForCalendarToDisappear();
|
||||
dynamicTable.clickSaveButton();
|
||||
dynamicTable.getTableRow(rowPosition);
|
||||
afterAll(async(done) => {
|
||||
await this.alfrescoJsApi.login(user.email, user.password);
|
||||
|
||||
await this.alfrescoJsApi.activiti.modelsApi.deleteModel(appId);
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
processServicesPage.goToProcessServices().goToApp(app.title).clickProcessButton();
|
||||
|
||||
appNavigationBarPage.clickProcessButton();
|
||||
|
||||
processFiltersPage.clickCreateProcessButton();
|
||||
processFiltersPage.clickNewProcessDropdown();
|
||||
});
|
||||
|
||||
it('[C286519] Should be able to save row with required dropdown column', () => {
|
||||
let dropdownOption = 'Option 1';
|
||||
dynamicTable.clickAddButton();
|
||||
dropdown.selectOption(dropdownOption);
|
||||
dynamicTable.clickSaveButton();
|
||||
dynamicTable.checkItemIsPresent(dropdownOption);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
BIN
e2e/resources/apps/AppDynamicTableDropdown.zip
Normal file
BIN
e2e/resources/apps/AppDynamicTableDropdown.zip
Normal file
Binary file not shown.
@ -44,6 +44,13 @@ exports.Files = {
|
||||
task_name: "Task Test 2"
|
||||
},
|
||||
|
||||
APP_DYNAMIC_TABLE_DROPDOWN:{
|
||||
file_location:"/resources/apps/AppDynamicTableDropdown.zip",
|
||||
title: "App3576",
|
||||
description: "Description for app",
|
||||
processName: "Process3576"
|
||||
},
|
||||
|
||||
SIMPLE_APP: {
|
||||
file_location: "/resources/Simple App.zip",
|
||||
title: "Simple App",
|
||||
|
Loading…
x
Reference in New Issue
Block a user