[ADF-3569] Add tests for task list demo page: (#3810)

* [ADF-3438] Add tests for task list demo page:

* Fixing some tests

* Added new tests

* Add more tests

* Fix the name of the test for bamboo

* Fix test name to work on bamboo

* no message

* Added new tests

* Modified the error message.

* no message

* fix lint issues

* Fix lint issues

* Changing taskListSinglePage from js to ts

* Uncomment a test

* Fixing lint issues

* Solve lint error

* Refactored taskListDemoPage

* Commented two tests that are failing because of a bug in APS

* Fix lint error

* Resolved comments
This commit is contained in:
cristinaj
2018-11-19 14:20:42 +02:00
committed by Eugenio Romano
parent 002998b10e
commit 2e8d998853
16 changed files with 1031 additions and 29 deletions

View File

@@ -38,13 +38,40 @@ var DataTablePage = function (rootElement = element(by.css("adf-datatable"))) {
var pageLoaded = element(by.css("div[data-automation-id='auto_id_id']"));
var tableBody = element.all(by.css("div[class='adf-datatable-body']")).first();
var spinner = element(by.css('mat-progress-spinner'));
var rows = by.css("adf-datatable div[class*='adf-datatable-body'] div[class*='adf-datatable-row']");
var nameColumn = by.css("adf-datatable div[class*='adf-datatable-body'] div[class*='adf-datatable-row'] div[title='Name'] span");
this.goToDatatable = function () {
browser.driver.get(dataTableURL);
Util.waitUntilElementIsVisible(pageLoaded);
};
this.getAllDisplayedRows = function () {
return element.all(rows).count();
};
this.getAllRowsNameColumn = function () {
return this.getAllRowsColumnValues(nameColumn);
};
this.getAllRowsColumnValues = function (locator) {
var deferred = protractor.promise.defer();
Util.waitUntilElementIsVisible(element.all(locator).first());
var initialList = [];
element.all(locator).each(function (element) {
element.getText().then(function (text) {
if (text !== '') {
initialList.push(text);
}
});
}).then(function () {
deferred.fulfill(initialList);
});
return deferred.promise;
};
/**
* Retrieve row by row number
*
@@ -298,5 +325,18 @@ var DataTablePage = function (rootElement = element(by.css("adf-datatable"))) {
Util.waitUntilElementIsPresent(spinner);
};
this.checkRowIsDisplayedByName = function (name) {
Util.waitUntilElementIsVisible(element(by.css("div[filename='"+name+"']")));
};
this.checkRowIsNotDisplayedByName = function (taskName) {
Util.waitUntilElementIsNotOnPage(element(by.css("div[filename='"+taskName+"']")));
};
this.getNumberOfRowsDisplayedWithSameName = function (taskName) {
Util.waitUntilElementIsVisible(element(by.css("div[filename='"+taskName+"']")));
return element.all(by.css("div[title='Name'][filename='"+taskName+"']")).count();
};
};
module.exports = DataTablePage;