mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ADF-3597] Create automated test to cover Error Log on Form component (#3831)
* [ADF-3597] Create automated test to cover Error Log on Form component * Removing double quotes * Removing console log * Changing capital letter * Creating pages for each widget * Minor changes on spaces and namings * fix rebase
This commit is contained in:
@@ -34,6 +34,7 @@ export class NavigationBarPage {
|
|||||||
appTitle = element(by.css('.adf-app-title'));
|
appTitle = element(by.css('.adf-app-title'));
|
||||||
headerDataButton = element(by.css('a[data-automation-id="Header Data"]'));
|
headerDataButton = element(by.css('a[data-automation-id="Header Data"]'));
|
||||||
menuButton = element(by.css('button[data-automation-id="adf-menu-icon"]'));
|
menuButton = element(by.css('button[data-automation-id="adf-menu-icon"]'));
|
||||||
|
formButton = element(by.css('a[data-automation-id="Form"]'));
|
||||||
|
|
||||||
clickContentServicesButton() {
|
clickContentServicesButton() {
|
||||||
Util.waitUntilElementIsVisible(this.contentServicesButton);
|
Util.waitUntilElementIsVisible(this.contentServicesButton);
|
||||||
@@ -134,6 +135,11 @@ export class NavigationBarPage {
|
|||||||
this.appTitle.click();
|
this.appTitle.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clickFormButton = function () {
|
||||||
|
Util.waitUntilElementIsVisible(this.formButton);
|
||||||
|
return this.formButton.click();
|
||||||
|
};
|
||||||
|
|
||||||
checkLogoTooltip(logoTooltip) {
|
checkLogoTooltip(logoTooltip) {
|
||||||
let logoTooltip = element(by.css('a[title="' + logoTooltip + '"]'));
|
let logoTooltip = element(by.css('a[title="' + logoTooltip + '"]'));
|
||||||
Util.waitUntilElementIsVisible(logoTooltip);
|
Util.waitUntilElementIsVisible(logoTooltip);
|
||||||
|
39
e2e/pages/adf/process_services/formPage.ts
Normal file
39
e2e/pages/adf/process_services/formPage.ts
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
/*!
|
||||||
|
* @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 { element, by } from 'protractor';
|
||||||
|
import Util = require('../../../util/util');
|
||||||
|
|
||||||
|
export class FormPage {
|
||||||
|
|
||||||
|
errorLog = element(by.css('div[class*="console"]'));
|
||||||
|
|
||||||
|
checkErrorMessageForWidgetIsDisplayed(errorMessage) {
|
||||||
|
return Util.waitUntilElementIsVisible(element(by.cssContainingText('.adf-error-text', errorMessage)));
|
||||||
|
}
|
||||||
|
|
||||||
|
checkErrorLogMessage(errorMessage) {
|
||||||
|
Util.waitUntilElementIsVisible(this.errorLog);
|
||||||
|
return Util.waitUntilElementIsVisible(element(by.cssContainingText('div[class*="console"] p', errorMessage)));
|
||||||
|
}
|
||||||
|
|
||||||
|
checkErrorMessageIsNotDisplayed(errorMessage) {
|
||||||
|
Util.waitUntilElementIsVisible(this.errorLog);
|
||||||
|
return Util.waitUntilElementIsNotVisible(element(by.cssContainingText('div[class*="console"] p', errorMessage)));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
46
e2e/pages/adf/process_services/widgets/Amount.ts
Normal file
46
e2e/pages/adf/process_services/widgets/Amount.ts
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
/*!
|
||||||
|
* @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 { element, by, protractor } from 'protractor';
|
||||||
|
import Util = require('../../../../util/util');
|
||||||
|
|
||||||
|
export class Amount {
|
||||||
|
|
||||||
|
amountWidgetLabel11 = element(by.id('field-label11-container'));
|
||||||
|
amountWidgetInput = element(by.css('div[id="field-label11-container"] input[id="label11"]'));
|
||||||
|
|
||||||
|
checkLabel11IsDisplayed() {
|
||||||
|
return Util.waitUntilElementIsVisible(this.amountWidgetLabel11);
|
||||||
|
}
|
||||||
|
|
||||||
|
addIntoAmountWidget(input) {
|
||||||
|
Util.waitUntilElementIsVisible(this.amountWidgetLabel11);
|
||||||
|
this.amountWidgetInput.click();
|
||||||
|
this.amountWidgetInput.sendKeys(input);
|
||||||
|
return this.amountWidgetInput.sendKeys(protractor.Key.ENTER);
|
||||||
|
}
|
||||||
|
|
||||||
|
removeFromAmountWidget() {
|
||||||
|
Util.waitUntilElementIsVisible(this.amountWidgetLabel11);
|
||||||
|
|
||||||
|
this.amountWidgetInput.getAttribute('value').then((result) => {
|
||||||
|
for (let i = result.length; i >= 0; i--) {
|
||||||
|
this.amountWidgetInput.sendKeys(protractor.Key.BACK_SPACE);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
46
e2e/pages/adf/process_services/widgets/Date.ts
Normal file
46
e2e/pages/adf/process_services/widgets/Date.ts
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
/*!
|
||||||
|
* @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 { element, by, protractor } from 'protractor';
|
||||||
|
import Util = require('../../../../util/util');
|
||||||
|
|
||||||
|
export class Date {
|
||||||
|
|
||||||
|
dateWidgetLabel7 = element(by.id('field-label7-container'));
|
||||||
|
dateWidgetInput = element(by.css('div[id="field-label7-container"] input[id="label7"]'));
|
||||||
|
|
||||||
|
checkLabel7IsDisplayed() {
|
||||||
|
return Util.waitUntilElementIsVisible(this.dateWidgetLabel7);
|
||||||
|
}
|
||||||
|
|
||||||
|
addIntoDateWidget(input) {
|
||||||
|
Util.waitUntilElementIsVisible(this.dateWidgetLabel7);
|
||||||
|
this.dateWidgetInput.click();
|
||||||
|
this.dateWidgetInput.sendKeys(input);
|
||||||
|
return this.dateWidgetInput.sendKeys(protractor.Key.ENTER);
|
||||||
|
}
|
||||||
|
|
||||||
|
removeFromDateWidget() {
|
||||||
|
Util.waitUntilElementIsVisible(this.dateWidgetLabel7);
|
||||||
|
|
||||||
|
this.dateWidgetInput.getAttribute('value').then((result) => {
|
||||||
|
for (let i = result.length; i >= 0; i--) {
|
||||||
|
this.dateWidgetInput.sendKeys(protractor.Key.BACK_SPACE);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
46
e2e/pages/adf/process_services/widgets/Number.ts
Normal file
46
e2e/pages/adf/process_services/widgets/Number.ts
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
/*!
|
||||||
|
* @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 { element, by, protractor } from 'protractor';
|
||||||
|
import Util = require('../../../../util/util');
|
||||||
|
|
||||||
|
export class NumberWidget {
|
||||||
|
|
||||||
|
numberWidgetLabel4 = element(by.id('field-label4-container'));
|
||||||
|
numberWidgetInput = element(by.css('div[id="field-label4-container"] input[id="label4"]'));
|
||||||
|
|
||||||
|
checkLabel4IsDisplayed() {
|
||||||
|
return Util.waitUntilElementIsVisible(this.numberWidgetLabel4);
|
||||||
|
}
|
||||||
|
|
||||||
|
addIntoNumberWidget(input) {
|
||||||
|
Util.waitUntilElementIsVisible(this.numberWidgetLabel4);
|
||||||
|
this.numberWidgetInput.click();
|
||||||
|
this.numberWidgetInput.sendKeys(input);
|
||||||
|
return this.numberWidgetInput.sendKeys(protractor.Key.ENTER);
|
||||||
|
}
|
||||||
|
|
||||||
|
removeFromNumberWidget() {
|
||||||
|
Util.waitUntilElementIsVisible(this.numberWidgetLabel4);
|
||||||
|
|
||||||
|
this.numberWidgetInput.getAttribute('value').then((result) => {
|
||||||
|
for (let i = result.length; i >= 0; i--) {
|
||||||
|
this.numberWidgetInput.sendKeys(protractor.Key.BACK_SPACE);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
105
e2e/process-services/form_component.e2e.ts
Normal file
105
e2e/process-services/form_component.e2e.ts
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
/*!
|
||||||
|
* @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 } from '../pages/adf/loginPage';
|
||||||
|
import { NavigationBarPage } from '../pages/adf/navigationBarPage';
|
||||||
|
import { FormPage } from '../pages/adf/process_services/formPage';
|
||||||
|
import { Date } from '../pages/adf/process_services/widgets/Date';
|
||||||
|
import { Amount } from '../pages/adf/process_services/widgets/Amount';
|
||||||
|
import { NumberWidget } from '../pages/adf/process_services/widgets/Number';
|
||||||
|
import TestConfig = require('../test.config');
|
||||||
|
|
||||||
|
import AlfrescoApi = require('alfresco-js-api-node');
|
||||||
|
import { UsersActions } from '../actions/users.actions';
|
||||||
|
|
||||||
|
describe('Form Component', () => {
|
||||||
|
|
||||||
|
const loginPage = new LoginPage();
|
||||||
|
const navigationBarPage = new NavigationBarPage();
|
||||||
|
const formPage = new FormPage();
|
||||||
|
const dateWidget = new Date();
|
||||||
|
const amountWidget = new Amount();
|
||||||
|
const numberWidget = new NumberWidget();
|
||||||
|
|
||||||
|
let tenantId, user;
|
||||||
|
|
||||||
|
let message = {
|
||||||
|
test: 'Text Test',
|
||||||
|
warningNumberAndAmount: 'Use a different number format',
|
||||||
|
warningDate: 'D-M-YYYY',
|
||||||
|
errorLogNumber: 'Error Label4 Use a different number format',
|
||||||
|
errorLogDate: 'Error Label7 D-M-YYYY',
|
||||||
|
errorLogAmount: 'Error Label11 Use a different number format',
|
||||||
|
errorLabel: 'Error Label4'
|
||||||
|
};
|
||||||
|
|
||||||
|
beforeAll(async (done) => {
|
||||||
|
this.alfrescoJsApi = new AlfrescoApi({
|
||||||
|
provider: 'BPM',
|
||||||
|
hostBpm: TestConfig.adf.url
|
||||||
|
});
|
||||||
|
|
||||||
|
let users = new UsersActions();
|
||||||
|
|
||||||
|
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
|
||||||
|
|
||||||
|
user = await users.createTenantAndUser(this.alfrescoJsApi);
|
||||||
|
|
||||||
|
tenantId = user.tenantId;
|
||||||
|
|
||||||
|
await this.alfrescoJsApi.login(user.email, user.password);
|
||||||
|
|
||||||
|
await loginPage.loginToProcessServicesUsingUserModel(user);
|
||||||
|
|
||||||
|
navigationBarPage.clickFormButton();
|
||||||
|
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async (done) => {
|
||||||
|
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
|
||||||
|
|
||||||
|
await this.alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(tenantId);
|
||||||
|
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('[C286505] Should be able to display errors under the Error Log section', () => {
|
||||||
|
numberWidget.checkLabel4IsDisplayed();
|
||||||
|
numberWidget.addIntoNumberWidget(message.test);
|
||||||
|
formPage.checkErrorMessageForWidgetIsDisplayed(message.warningNumberAndAmount);
|
||||||
|
formPage.checkErrorLogMessage(message.errorLogNumber);
|
||||||
|
|
||||||
|
dateWidget.checkLabel7IsDisplayed();
|
||||||
|
dateWidget.addIntoDateWidget(message.test);
|
||||||
|
formPage.checkErrorMessageForWidgetIsDisplayed(message.warningDate);
|
||||||
|
formPage.checkErrorLogMessage(message.errorLogDate);
|
||||||
|
|
||||||
|
amountWidget.checkLabel11IsDisplayed();
|
||||||
|
amountWidget.addIntoAmountWidget(message.test);
|
||||||
|
formPage.checkErrorMessageForWidgetIsDisplayed(message.warningNumberAndAmount);
|
||||||
|
formPage.checkErrorLogMessage(message.errorLogAmount);
|
||||||
|
|
||||||
|
amountWidget.removeFromAmountWidget();
|
||||||
|
formPage.checkErrorMessageIsNotDisplayed(message.errorLogAmount);
|
||||||
|
|
||||||
|
dateWidget.removeFromDateWidget();
|
||||||
|
numberWidget.removeFromNumberWidget();
|
||||||
|
formPage.checkErrorMessageIsNotDisplayed(message.errorLogDate);
|
||||||
|
formPage.checkErrorLogMessage(message.errorLabel);
|
||||||
|
});
|
||||||
|
});
|
Reference in New Issue
Block a user