UNPKG

6.03 kBJavaScriptView Raw
1!function(){"use strict";module.exports=new function(){require("./TestHelper"),require("./TestHelperPO");var e,t,n=require("./Logger.js");protractor.ExpectedConditions;return{initialize:function(n){t=(e=n).element(by.css("div.flex.px-data-table"))},setContainer:function(e){t=e,n.info("container set "+e)},getContainer:function(){return t},getColumnCount:function(){var e=protractor.promise.defer(),n=0;return t.all(by.css("div.flex.header--container")).then(function(t,r){return t.forEach(function(e,t){n++}),e.fulfill(n),e.promise})},getRowCount:function(){var e=protractor.promise.defer(),n=0;return t.all(by.css("div.tr.rows.aha-table")).then(function(t,r){return t.forEach(function(e,t){n++}),e.fulfill(n),e.promise})},getCurrentPage:function(){var e,n=protractor.promise.defer();return t.all(by.css("px-pagination#pagination span.pager span.btn--pagination--number")).then(function(t,r){return t.forEach(function(t,r){t.getText().then(function(t){e=t,n.fulfill(e)})}),n.promise})},goToPage:function(e){var n=protractor.promise.defer(),r=[];return t.all(by.css("px-pagination#pagination span.pager span")).then(function(t,o){return t.forEach(function(e,t){r.push(e)}),r[e-1].click().then(function(e,t){return n.fulfill(e),n.promise})})},goToNextPage:function(){var e=protractor.promise.defer(),n=[];return t.all(by.css("px-pagination#pagination span.paging button i.fa-angle-right")).then(function(t,r){return t.forEach(function(e,t){n.push(e)}),n[0].click().then(function(t,n){return e.fulfill(t),e.promise})})},goToPreviousPage:function(){var e=protractor.promise.defer(),n=[];return t.all(by.css("px-pagination#pagination span.paging button i.fa-angle-left")).then(function(t,r){return t.forEach(function(e,t){n.push(e)}),n[0].click().then(function(t,n){return e.fulfill(t),e.promise})})},getRowPerPageValue:function(){var e,n=protractor.promise.defer();return t.all(by.css("select#pageSizeSelect option[selected]")).getText().then(function(t){return e=t,n.fulfill(e),n.promise})},setRowPerPageValue:function(e){return t.element(by.css("select#pageSizeSelect option[value='"+e+"']")).click()},setFilter:function(e,t){return this.getFilter(e).then(function(e){return e.sendKeys(t)})},clearFilter:function(e){return this.getFilter(e).then(function(e){return e.clear()})},getFilter:function(e){var n,r=protractor.promise.defer(),o=[];return this.getColumnindex(e).then(function(e){return n=e,t.all(by.css("span.td.style-scope:not([style]) input")).then(function(e,t){return e.forEach(function(e,t){o.push(e)}),r.fulfill(o[n]),r.promise})})},sortColumn:function(e){var t=[],n=this;return this.getColumnHeaderElements().then(function(r){return t=r,console.log("in sorting getColumnHeaderElements columnSortElements "+t),n.getColumnindex(e).then(function(e){return(r=t[e]).element(by.css("span.column-head.u-m--")).click()})})},getColumnindex:function(e){var t,n=protractor.promise.defer(),r=[];return this.getColumnNames().then(function(o){return o.forEach(function(e,t){r.push(e)}),t=r.indexOf(e),n.fulfill(t),n.promise})},getColumnNames:function(){var e=protractor.promise.defer(),n=[];return t.all(by.css("span.th.style-scope:not([style]) div.flex.header--container")).then(function(t,r){return t.forEach(function(e,t){e.getText().then(function(e){n.push(e)})}),e.fulfill(n),e.promise})},getColumnHeaderElements:function(){var e=protractor.promise.defer(),n=[];return t.all(by.css("span.th.style-scope:not([style]) div.flex.header--container")).then(function(t,r){return t.forEach(function(e,t){n.push(e)}),e.fulfill(n),e.promise})},getCellText:function(e,t){return this.getCellElement(e,t).then(function(e){return e.element(by.css("span.cell--value")).getText()})},getCellElementText:function(e){return this.getCellElement(row,column).then(function(e){return e.element(by.css("span.cell--value")).getText()})},getCellHtml:function(e,t){var n=protractor.promise.defer();return this.getCellElement(e,t).then(function(e){var t=e.element(by.css("aha-html-echo.px-data-table-cell"));return n.fulfill(t),n.promise})},getColumnTextValues:function(e){var t=protractor.promise.defer(),n=[],r=this;return this.getColumnindex(e).then(function(e){return r.getRowCount().then(function(o){for(var i=0;i<o;i++)r.getCellText(i,e).then(function(e){n.push(e)});return t.fulfill(n),t.promise})})},getColumnHtmlValues:function(e){var t=protractor.promise.defer(),n=[],r=this;return this.getColumnindex(e).then(function(e){return r.getRowCount().then(function(o){for(var i=0;i<o;i++)r.getCellHtml(i,e).then(function(e){n.push(e)});return t.fulfill(n),t.promise})})},getColumnElementValues:function(e){var t=protractor.promise.defer(),n=[],r=this;return this.getColumnindex(e).then(function(e){return r.getRowCount().then(function(o){for(var i=0;i<o;i++)r.getCellElement(i,e).then(function(e){n.push(e)});return t.fulfill(n),t.promise})})},getRowTextValues:function(e){var t=protractor.promise.defer(),n=[],r=this;return this.getColumnCount().then(function(o){for(var i=0;i<o;i++)r.getCellText(e,i).then(function(e){n.push(e)});return t.fulfill(n),t.promise})},getRowHtmlValues:function(e){var t=protractor.promise.defer(),n=[],r=this;return this.getColumnCount().then(function(o){for(var i=0;i<o;i++)r.getCellHtml(e,i).then(function(e){n.push(e)});t.fulfill(n)}),t.promise},getRowElementValues:function(e){var t=protractor.promise.defer(),n=[],r=this;return this.getColumnCount().then(function(o){for(var i=0;i<o;i++)r.getCellElement(e,i).then(function(e){n.push(e)});return t.fulfill(n),t.promise})},getCellElements:function(){var e=protractor.promise.defer(),n=[],r=[];return this.getColumnCount().then(function(o){return this.getRowCount().then(function(i){return t.all(by.css("div.tr.rows.aha-table px-data-table-cell")).then(function(t,u){t.forEach(function(e,t){n.push(e)});for(var l=0,f=0;f<i;f++){for(var s=[],c=0;c<o;c++)s.push(n[l]),l++;r.push(s)}return e.fulfill(r),e.promise})})})},getCellElement:function(e,t){var n=protractor.promise.defer();this.getCellElements().then(function(r){return n.fulfill(r[e][t]),n.promise})}}}}();
\No newline at end of file