UNPKG

kong-dashboard

Version:
52 lines (45 loc) 1.56 kB
var Page = { clickAddButton: () => { element(by.cssContainingText('a', 'Add Service')).click(); }, /** * Returns a promise which will resolve with the rows displayed in the "list servicess" page */ getRows: () => { return element.all(by.repeater('resource in vm.resources')); }, /** * Returns a promise which will resolve with the row at the position <index> */ getRow: function(index) { return this.getRows().get(index); }, /** * Returns a promise which will resolve with edit button being clicked for the row whose index is * <rowIndex> */ clickEdit: function(rowIndex) { return this.getRow(rowIndex).element(by.cssContainingText('td a', 'mode_edit')).click(); }, /** * Returns a promise which will resolve with delete button being clicked for the row whose index is * <rowIndex> */ clickDelete: function(rowIndex) { return this.getRow(rowIndex).element(by.cssContainingText('td a', 'delete')).click(); }, /** * Returns a promise which will resolve with the "yes" button being clicked in the delete modal. */ confirmDeletion: () => { return element(by.cssContainingText('.modal a', 'Yes')).click().then((response) => { return new Promise((resolve, reject) => { // takes a while for the modal to fade out. setTimeout(function() { resolve(response); }, 300); }); }); } }; module.exports = Page;