mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ADF-3259] [ADF-3363] e2e login and card metadata (#3612)
* remember me * add login component e2e test * add success route test * add change logo check * redirect url after logout e2e * move redirection test in a separate file * login component tslint * cardview e2e * fix login test * add test case number * move version test in a separate file * clean unused elements * metadata part 1 * tslint fix * fix metadata test * remove fit * fix formatting file viewerPage * multi propety test * metadata and login improvements * fix data automation fix * metadata permission e2e * fix tslint problems * improve selector * stabilize search component test * stabilize test step 1 * fix tag test add config timeout * tentative * delay after download * change meatdata test * stabilize metadata * use smaller file for not extension related test * stabilize test step 2 * exclude failing test * timeout fix * split in multiple task e2e * trick travis * trigger build * fix command issue * fix save screenshot * fix run subfolder * test timeout increase
This commit is contained in:
committed by
Eugenio Romano
parent
66f534b32c
commit
b2cb93468d
@@ -17,51 +17,174 @@
|
||||
|
||||
var Util = require('../../util/util');
|
||||
|
||||
var CardViewComponentPage = function (){
|
||||
var CardViewComponentPage = function () {
|
||||
|
||||
const addButton = element(by.className('card-view__key-value-pairs__add-btn'));
|
||||
const keyValueRow = 'card-view__key-value-pairs__row';
|
||||
const selectValue = 'mat-option';
|
||||
const valueInputField = element(by.xpath("//*[contains(@id,'input') and @placeholder='Value']"));
|
||||
const nameInputField = element(by.xpath("//*[contains(@id,'input') and @placeholder='Name']"));
|
||||
const consoleLog = element(by.className('console'));
|
||||
const deleteButton = element(by.className('card-view__key-value-pairs__remove-btn'));
|
||||
const select = element(by.css('mat-select[data-automation-class="select-box"]'));
|
||||
const listContent = element(by.className('mat-select-content'));
|
||||
const selectedValue = element(by.css('.mat-select-value-text span'));
|
||||
const addButton = element(by.className('card-view__key-value-pairs__add-btn'));
|
||||
const keyValueRow = 'card-view__key-value-pairs__row';
|
||||
const selectValue = 'mat-option';
|
||||
const textField = element(by.css("input[data-automation-id='card-textitem-editinput-name']"));
|
||||
const intField = element(by.css("input[data-automation-id='card-textitem-editinput-int']"));
|
||||
const floatField = element(by.css("input[data-automation-id='card-textitem-editinput-float']"));
|
||||
const valueInputField = element(by.xpath("//*[contains(@id,'input') and @placeholder='Value']"));
|
||||
const nameInputField = element(by.xpath("//*[contains(@id,'input') and @placeholder='Name']"));
|
||||
const consoleLog = element(by.className('console'));
|
||||
const deleteButton = element.all(by.className('card-view__key-value-pairs__remove-btn')).first();
|
||||
const select = element(by.css('mat-select[data-automation-class="select-box"]'));
|
||||
const checkbox = element(by.css("mat-checkbox[data-automation-id='card-boolean-boolean']"));
|
||||
const resetButton = element(by.css("#adf-reset-card-log"));
|
||||
const selectedValue = element(by.css('.mat-select-value-text span'));
|
||||
const listContent = element(by.className('mat-select-content'));
|
||||
const editableSwitch = element(by.id('adf-toogle-editable'));
|
||||
|
||||
this.clickOnAddButton = function() {
|
||||
this.clickOnAddButton = function () {
|
||||
Util.waitUntilElementIsVisible(addButton);
|
||||
addButton.click();
|
||||
return this;
|
||||
};
|
||||
};
|
||||
|
||||
this.setName = function(name) {
|
||||
this.clickOnResetButton= function () {
|
||||
Util.waitUntilElementIsVisible(resetButton);
|
||||
resetButton.click();
|
||||
return this;
|
||||
};
|
||||
|
||||
this.clickOnTextField = function () {
|
||||
let toggleText = element(by.css("div[data-automation-id='card-textitem-edit-toggle-name']"));
|
||||
Util.waitUntilElementIsVisible(toggleText);
|
||||
toggleText.click();
|
||||
Util.waitUntilElementIsVisible(textField);
|
||||
return this;
|
||||
};
|
||||
|
||||
this.clickOnTextClearIcon = function () {
|
||||
let clearIcon = element(by.css("mat-icon[data-automation-id=\"card-textitem-reset-name\"]"));
|
||||
Util.waitUntilElementIsVisible(clearIcon);
|
||||
return clearIcon.click();
|
||||
};
|
||||
|
||||
this.clickOnTextSaveIcon = function () {
|
||||
let saveIcon = element(by.css("mat-icon[data-automation-id=\"card-textitem-update-name\"]"));
|
||||
Util.waitUntilElementIsVisible(saveIcon);
|
||||
return saveIcon.click();
|
||||
};
|
||||
|
||||
this.getTextFieldText = function (text) {
|
||||
var textField = element(by.css("span[data-automation-id='card-textitem-value-name']"));
|
||||
Util.waitUntilElementIsVisible(textField);
|
||||
return textField.getText();
|
||||
};
|
||||
|
||||
this.enterTextField = function (text) {
|
||||
Util.waitUntilElementIsVisible(textField);
|
||||
textField.sendKeys('');
|
||||
textField.clear().sendKeys(text);
|
||||
return this;
|
||||
};
|
||||
|
||||
this.clickOnIntField = function () {
|
||||
let toggleText = element(by.css('div[data-automation-id="card-textitem-edit-toggle-int"]'));
|
||||
Util.waitUntilElementIsVisible(toggleText);
|
||||
toggleText.click();
|
||||
Util.waitUntilElementIsVisible(intField);
|
||||
return this;
|
||||
};
|
||||
|
||||
this.clickOnIntClearIcon = function () {
|
||||
let clearIcon = element(by.css('mat-icon[data-automation-id="card-textitem-reset-int"]'));
|
||||
Util.waitUntilElementIsVisible(clearIcon);
|
||||
return clearIcon.click();
|
||||
};
|
||||
|
||||
this.clickOnIntSaveIcon = function () {
|
||||
let saveIcon = element(by.css('mat-icon[data-automation-id="card-textitem-update-int"]'));
|
||||
Util.waitUntilElementIsVisible(saveIcon);
|
||||
return saveIcon.click();
|
||||
};
|
||||
|
||||
this.enterIntField = function (text) {
|
||||
Util.waitUntilElementIsVisible(intField);
|
||||
intField.sendKeys('');
|
||||
intField.clear().sendKeys(text);
|
||||
return this;
|
||||
};
|
||||
|
||||
this.getIntFieldText = function (text) {
|
||||
var textField = element(by.css('span[data-automation-id="card-textitem-value-int"]'));
|
||||
Util.waitUntilElementIsVisible(textField);
|
||||
return textField.getText();
|
||||
};
|
||||
|
||||
this.getErrorInt = function (text) {
|
||||
let errorElement = element(by.css('mat-error[data-automation-id="card-textitem-error-int"]'));
|
||||
Util.waitUntilElementIsVisible(errorElement);
|
||||
return errorElement.getText();
|
||||
};
|
||||
|
||||
this.clickOnFloatField = function () {
|
||||
let toggleText = element(by.css('div[data-automation-id="card-textitem-edit-toggle-float"]'));
|
||||
Util.waitUntilElementIsVisible(toggleText);
|
||||
toggleText.click();
|
||||
Util.waitUntilElementIsVisible(floatField);
|
||||
return this;
|
||||
};
|
||||
|
||||
this.clickOnFloatClearIcon = function () {
|
||||
let clearIcon = element(by.css("mat-icon[data-automation-id='card-textitem-reset-float']"));
|
||||
Util.waitUntilElementIsVisible(clearIcon);
|
||||
return clearIcon.click();
|
||||
};
|
||||
|
||||
this.clickOnFloatSaveIcon = function () {
|
||||
let saveIcon = element(by.css("mat-icon[data-automation-id='card-textitem-update-float']"));
|
||||
Util.waitUntilElementIsVisible(saveIcon);
|
||||
return saveIcon.click();
|
||||
};
|
||||
|
||||
this.enterFloatField = function (text) {
|
||||
Util.waitUntilElementIsVisible(floatField);
|
||||
floatField.sendKeys('');
|
||||
floatField.clear().sendKeys(text);
|
||||
return this;
|
||||
};
|
||||
|
||||
this.getFloatFieldText = function (text) {
|
||||
var textField = element(by.css('span[data-automation-id="card-textitem-value-float"]'));
|
||||
Util.waitUntilElementIsVisible(textField);
|
||||
return textField.getText();
|
||||
};
|
||||
|
||||
this.getErrorFloat = function (text) {
|
||||
let errorElement = element(by.css('mat-error[data-automation-id="card-textitem-error-float"]'));
|
||||
Util.waitUntilElementIsVisible(errorElement);
|
||||
return errorElement.getText();
|
||||
};
|
||||
|
||||
this.setName = function (name) {
|
||||
Util.waitUntilElementIsVisible(nameInputField);
|
||||
nameInputField.sendKeys(name);
|
||||
return this;
|
||||
};
|
||||
};
|
||||
|
||||
this.setValue = function(value) {
|
||||
this.setValue = function (value) {
|
||||
Util.waitUntilElementIsVisible(valueInputField);
|
||||
valueInputField.sendKeys(value);
|
||||
return this;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
this.waitForOutput = function(){
|
||||
this.waitForOutput = function () {
|
||||
Util.waitUntilElementIsVisible(consoleLog);
|
||||
return this;
|
||||
};
|
||||
|
||||
this.getOutputText = function(index){
|
||||
return consoleLog.all(by.css('p')).get(index).getText()
|
||||
this.getOutputText = function (index) {
|
||||
return consoleLog.all(by.css('p')).get(index).getText();
|
||||
};
|
||||
|
||||
this.deletePairsValues = function(){
|
||||
Util.waitUntilElementIsVisible(deleteButton);
|
||||
deleteButton.click();
|
||||
return this;
|
||||
this.deletePairsValues = function () {
|
||||
Util.waitUntilElementIsVisible(deleteButton);
|
||||
deleteButton.click();
|
||||
return this;
|
||||
};
|
||||
|
||||
this.checkNameAndValueVisibility = (index) => {
|
||||
@@ -70,7 +193,7 @@ var CardViewComponentPage = function (){
|
||||
};
|
||||
|
||||
this.getKeyValueRow = (index) => {
|
||||
return element.all(by.css(keyValueRow)).get(index);
|
||||
return element.all(by.css(keyValueRow)).get(index);
|
||||
|
||||
};
|
||||
|
||||
@@ -78,20 +201,34 @@ var CardViewComponentPage = function (){
|
||||
return element.all(by.className(selectValue)).get(index);
|
||||
};
|
||||
|
||||
this.clickComboBox = () => {
|
||||
select.click();
|
||||
Util.waitUntilElementIsVisible(listContent);
|
||||
this.clickSelectBox = () => {
|
||||
select.click();
|
||||
Util.waitUntilElementIsVisible(listContent);
|
||||
};
|
||||
|
||||
this.checkboxClick = () => {
|
||||
checkbox.click();
|
||||
};
|
||||
|
||||
this.selectValueFromComboBox = (index) => {
|
||||
this.getMatSelectValue(index).click();
|
||||
Util.waitUntilElementIsVisible(consoleLog);
|
||||
return this;
|
||||
return this;
|
||||
};
|
||||
|
||||
this.getSelectionValue = () => {
|
||||
return selectedValue.getText();
|
||||
};
|
||||
|
||||
this.disableEdit = function () {
|
||||
Util.waitUntilElementIsVisible(editableSwitch);
|
||||
editableSwitch.getAttribute('class').then(function (check) {
|
||||
if (check === 'mat-slide-toggle mat-primary mat-checked') {
|
||||
editableSwitch.click();
|
||||
expect(editableSwitch.getAttribute('class')).toEqual('mat-slide-toggle mat-primary');
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
}
|
||||
module.exports = CardViewComponentPage;
|
||||
module.exports = CardViewComponentPage;
|
||||
|
Reference in New Issue
Block a user