[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:
jdosti
2018-10-11 22:25:33 +01:00
committed by Eugenio Romano
parent 156a6cafbf
commit 9179b0ccbb
6 changed files with 288 additions and 0 deletions

View 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)));
}
}

View 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);
}
});
}
}

View 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);
}
});
}
}

View 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);
}
});
}
}