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 FormFields = require('../formFields');
|
||||||
|
import Util = require('../../../../util/util');
|
||||||
|
import { by, element } from 'protractor';
|
||||||
|
|
||||||
export class Dropdown {
|
export class Dropdown {
|
||||||
|
|
||||||
formFields = new FormFields();
|
formFields = new FormFields();
|
||||||
|
|
||||||
selectedOptionLocator = by.css('mat-select[id="dropdown"] span span');
|
selectedOptionLocator = by.css('mat-select[id="dropdown"] span span');
|
||||||
|
dropdown = element(by.id('dropdown'));
|
||||||
|
|
||||||
getSelectedOptionText(fieldId) {
|
getSelectedOptionText(fieldId) {
|
||||||
return this.formFields.getFieldText(fieldId, this.selectedOptionLocator);
|
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 FormFields = require('../formFields');
|
||||||
import Util = require('../../../../util/util');
|
import Util = require('../../../../util/util');
|
||||||
|
import { element, by, browser, protractor } from 'protractor';
|
||||||
|
|
||||||
export class DynamicTable {
|
export class DynamicTable {
|
||||||
formFields = new FormFields();
|
formFields = new FormFields();
|
||||||
@ -30,7 +31,7 @@ export class DynamicTable {
|
|||||||
calendarContent = element(by.css('div[class="mat-datetimepicker-calendar-content"]'));
|
calendarContent = element(by.css('div[class="mat-datetimepicker-calendar-content"]'));
|
||||||
saveButton = element(by.cssContainingText('button span', 'Save'));
|
saveButton = element(by.cssContainingText('button span', 'Save'));
|
||||||
errorMessage = element(by.css('div[class="adf-error-text"]'));
|
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'));
|
calendarNumber = element.all(by.css('td div'));
|
||||||
tableRow = element.all(by.css('tbody tr'));
|
tableRow = element.all(by.css('tbody tr'));
|
||||||
|
|
||||||
@ -96,4 +97,10 @@ export class DynamicTable {
|
|||||||
waitForCalendarToDisappear() {
|
waitForCalendarToDisappear() {
|
||||||
Util.waitUntilElementIsNotVisible(this.calendarNumber);
|
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 ProcessFiltersPage = require('../pages/adf/process_services/processFiltersPage');
|
||||||
import { AppNavigationBarPage } from '../pages/adf/process_services/appNavigationBarPage';
|
import { AppNavigationBarPage } from '../pages/adf/process_services/appNavigationBarPage';
|
||||||
import { DynamicTable } from '../pages/adf/process_services/widgets/dynamicTable';
|
import { DynamicTable } from '../pages/adf/process_services/widgets/dynamicTable';
|
||||||
|
import { Dropdown } from '../pages/adf/process_services/widgets/dropdown';
|
||||||
|
|
||||||
import TestConfig = require('../test.config');
|
import TestConfig = require('../test.config');
|
||||||
import resources = require('../util/resources');
|
import resources = require('../util/resources');
|
||||||
@ -28,16 +29,43 @@ import AlfrescoApi = require('alfresco-js-api-node');
|
|||||||
import { AppsActions } from '../actions/APS/apps.actions';
|
import { AppsActions } from '../actions/APS/apps.actions';
|
||||||
import { UsersActions } from '../actions/users.actions';
|
import { UsersActions } from '../actions/users.actions';
|
||||||
|
|
||||||
describe('Dynamic Table - Date Picker', () => {
|
describe('Dynamic Table', () => {
|
||||||
|
|
||||||
let loginPage = new LoginPage();
|
let loginPage = new LoginPage();
|
||||||
let processServicesPage = new ProcessServicesPage();
|
let processServicesPage = new ProcessServicesPage();
|
||||||
let processFiltersPage = new ProcessFiltersPage();
|
let processFiltersPage = new ProcessFiltersPage();
|
||||||
let appNavigationBarPage = new AppNavigationBarPage();
|
let appNavigationBarPage = new AppNavigationBarPage();
|
||||||
let dynamicTable = new DynamicTable();
|
let dynamicTable = new DynamicTable();
|
||||||
|
let user, tenantId, appId, apps, users;
|
||||||
|
|
||||||
|
beforeAll(async(done) => {
|
||||||
|
this.alfrescoJsApi = new AlfrescoApi({
|
||||||
|
provider: 'BPM',
|
||||||
|
hostBpm: TestConfig.adf.url
|
||||||
|
});
|
||||||
|
|
||||||
|
apps = new AppsActions();
|
||||||
|
users = new UsersActions();
|
||||||
|
|
||||||
|
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
|
||||||
|
|
||||||
|
user = await users.createTenantAndUser(this.alfrescoJsApi);
|
||||||
|
|
||||||
|
tenantId = user.tenantId;
|
||||||
|
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async(done) => {
|
||||||
|
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
|
||||||
|
|
||||||
|
await this.alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(tenantId);
|
||||||
|
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Date Picker', () => {
|
||||||
let app = resources.Files.DYNAMIC_TABLE_APP;
|
let app = resources.Files.DYNAMIC_TABLE_APP;
|
||||||
let user, tenantId, appId;
|
|
||||||
|
|
||||||
let randomText = {
|
let randomText = {
|
||||||
date: 'HELLO WORLD',
|
date: 'HELLO WORLD',
|
||||||
@ -49,19 +77,60 @@ describe('Dynamic Table - Date Picker', () => {
|
|||||||
let rowPosition = 0;
|
let rowPosition = 0;
|
||||||
|
|
||||||
beforeAll(async(done) => {
|
beforeAll(async(done) => {
|
||||||
this.alfrescoJsApi = new AlfrescoApi({
|
await this.alfrescoJsApi.login(user.email, user.password);
|
||||||
provider: 'BPM',
|
|
||||||
hostBpm: TestConfig.adf.url
|
let importedApp = await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location);
|
||||||
|
appId = importedApp.id;
|
||||||
|
|
||||||
|
await loginPage.loginToProcessServicesUsingUserModel(user);
|
||||||
|
|
||||||
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
let apps = new AppsActions();
|
afterAll(async(done) => {
|
||||||
let users = new UsersActions();
|
await this.alfrescoJsApi.login(user.email, user.password);
|
||||||
|
|
||||||
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
|
await this.alfrescoJsApi.activiti.modelsApi.deleteModel(appId);
|
||||||
|
|
||||||
user = await users.createTenantAndUser(this.alfrescoJsApi);
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
tenantId = user.tenantId;
|
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);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Required Dropdown', () => {
|
||||||
|
let app = resources.Files.APP_DYNAMIC_TABLE_DROPDOWN;
|
||||||
|
let dropdown = new Dropdown();
|
||||||
|
|
||||||
|
beforeAll(async(done) => {
|
||||||
|
|
||||||
await this.alfrescoJsApi.login(user.email, user.password);
|
await this.alfrescoJsApi.login(user.email, user.password);
|
||||||
|
|
||||||
@ -78,48 +147,25 @@ describe('Dynamic Table - Date Picker', () => {
|
|||||||
|
|
||||||
await this.alfrescoJsApi.activiti.modelsApi.deleteModel(appId);
|
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();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[C286277] Should have a datepicker and a mask for DateTime field', () => {
|
beforeEach(() => {
|
||||||
processServicesPage.goToProcessServices().goToTaskApp().clickProcessButton();
|
processServicesPage.goToProcessServices().goToApp(app.title).clickProcessButton();
|
||||||
|
|
||||||
appNavigationBarPage.clickProcessButton();
|
appNavigationBarPage.clickProcessButton();
|
||||||
|
|
||||||
processFiltersPage.clickCreateProcessButton();
|
processFiltersPage.clickCreateProcessButton();
|
||||||
processFiltersPage.clickNewProcessDropdown();
|
processFiltersPage.clickNewProcessDropdown();
|
||||||
|
|
||||||
dynamicTable.clickAddButton();
|
|
||||||
dynamicTable.clickColumnDateTime();
|
|
||||||
|
|
||||||
expect(dynamicTable.addRandomStringOnDateTime(randomText.dateTime)).toBe('');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[C286279] Should be able to save row with Date field', () => {
|
it('[C286519] Should be able to save row with required dropdown column', () => {
|
||||||
loginPage.loginToProcessServicesUsingUserModel(user);
|
let dropdownOption = 'Option 1';
|
||||||
|
|
||||||
processServicesPage.goToProcessServices().goToTaskApp().clickProcessButton();
|
|
||||||
|
|
||||||
appNavigationBarPage.clickProcessButton();
|
|
||||||
|
|
||||||
processFiltersPage.clickCreateProcessButton();
|
|
||||||
processFiltersPage.clickNewProcessDropdown();
|
|
||||||
|
|
||||||
dynamicTable.clickAddButton();
|
dynamicTable.clickAddButton();
|
||||||
dynamicTable.addRandomStringOnDate(randomText.date);
|
dropdown.selectOption(dropdownOption);
|
||||||
dynamicTable.clickSaveButton();
|
dynamicTable.clickSaveButton();
|
||||||
|
dynamicTable.checkItemIsPresent(dropdownOption);
|
||||||
expect(dynamicTable.checkErrorMessage()).toBe(randomText.error);
|
});
|
||||||
|
|
||||||
dynamicTable.clickDateWidget();
|
|
||||||
dynamicTable.getDateCalendarNumber(datePosition);
|
|
||||||
dynamicTable.waitForCalendarToDisappear();
|
|
||||||
dynamicTable.clickSaveButton();
|
|
||||||
dynamicTable.getTableRow(rowPosition);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
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"
|
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: {
|
SIMPLE_APP: {
|
||||||
file_location: "/resources/Simple App.zip",
|
file_location: "/resources/Simple App.zip",
|
||||||
title: "Simple App",
|
title: "Simple App",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user