mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
Convert all page objects to be ES6 classes and rely on PageObjects module instead of support.
This commit is contained in:
parent
0f397f2bc4
commit
91e919d1c5
8 changed files with 1317 additions and 1349 deletions
|
@ -1,3 +1,4 @@
|
|||
|
||||
import bluebird, {
|
||||
promisify
|
||||
} from 'bluebird';
|
||||
|
|
|
@ -1,38 +1,33 @@
|
|||
import { remote, defaultFindTimeout } from '../';
|
||||
|
||||
// in test/support/pages/shield_page.js
|
||||
export default (function (require) {
|
||||
// the page object is created as a constructor
|
||||
// so we can provide the remote Command object
|
||||
// at runtime
|
||||
var thisTime;
|
||||
import {
|
||||
defaultFindTimeout,
|
||||
} from '../';
|
||||
|
||||
function ConsolePage() {
|
||||
export default class ConsolePage {
|
||||
|
||||
constructor() {
|
||||
}
|
||||
|
||||
ConsolePage.prototype = {
|
||||
constructor: ConsolePage,
|
||||
|
||||
init(remote) {
|
||||
this.remote = remote;
|
||||
thisTime = this.remote.setFindTimeout(defaultFindTimeout);
|
||||
},
|
||||
this.findTimeout = this.remote.setFindTimeout(defaultFindTimeout);
|
||||
}
|
||||
|
||||
getServer: function getServer() {
|
||||
return thisTime
|
||||
getServer() {
|
||||
return this.findTimeout
|
||||
.findByCssSelector('#kibana-body > div.content > div > div')
|
||||
.getVisibleText();
|
||||
},
|
||||
}
|
||||
|
||||
setServer: function setServer(server) {
|
||||
return thisTime
|
||||
setServer(server) {
|
||||
return this.findTimeout
|
||||
.findByCssSelector('input[aria-label="Server Name"]')
|
||||
.clearValue()
|
||||
.type(server);
|
||||
},
|
||||
}
|
||||
|
||||
getRequest: function getRequest() {
|
||||
return thisTime
|
||||
getRequest() {
|
||||
return this.findTimeout
|
||||
.findAllByCssSelector('div.ace_line_group')
|
||||
.then(function (editorData) {
|
||||
|
||||
|
@ -43,29 +38,25 @@ export default (function (require) {
|
|||
var getEditorDataPromises = editorData.map(getEditorData);
|
||||
return Promise.all(getEditorDataPromises);
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
getResponse: function getResponse() {
|
||||
return thisTime
|
||||
getResponse() {
|
||||
return this.findTimeout
|
||||
.findByCssSelector('#output > div.ace_scroller > div')
|
||||
.getVisibleText();
|
||||
},
|
||||
}
|
||||
|
||||
clickPlay: function clickPlay() {
|
||||
return thisTime
|
||||
clickPlay() {
|
||||
return this.findTimeout
|
||||
.findByCssSelector('#editor_actions > span.ng-scope > a > i')
|
||||
.click();
|
||||
},
|
||||
}
|
||||
|
||||
collapseHelp: function collapseHelp() {
|
||||
return thisTime
|
||||
collapseHelp() {
|
||||
return this.findTimeout
|
||||
.findByCssSelector('div.config-close.remove > i')
|
||||
.click();
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
return ConsolePage;
|
||||
}());
|
||||
}
|
||||
|
|
|
@ -1,163 +1,161 @@
|
|||
import { remote, common, defaultFindTimeout, headerPage } from '../';
|
||||
|
||||
export default (function () {
|
||||
var thisTime;
|
||||
import {
|
||||
defaultFindTimeout,
|
||||
} from '../';
|
||||
|
||||
function DashboardPage() {
|
||||
import PageObjects from './';
|
||||
|
||||
export default class DashboardPage {
|
||||
|
||||
constructor() {
|
||||
}
|
||||
|
||||
DashboardPage.prototype = {
|
||||
constructor: DashboardPage,
|
||||
|
||||
init(remote) {
|
||||
this.remote = remote;
|
||||
thisTime = this.remote.setFindTimeout(defaultFindTimeout);
|
||||
},
|
||||
this.findTimeout = this.remote.setFindTimeout(defaultFindTimeout);
|
||||
}
|
||||
|
||||
clickNewDashboard: function clickNewDashboard() {
|
||||
return thisTime
|
||||
clickNewDashboard() {
|
||||
return this.findTimeout
|
||||
.findByCssSelector('button.ng-scope[aria-label="New Dashboard"]')
|
||||
.click();
|
||||
},
|
||||
}
|
||||
|
||||
clickAddVisualization: function clickAddVisualization() {
|
||||
return thisTime
|
||||
clickAddVisualization() {
|
||||
return this.findTimeout
|
||||
.findByCssSelector('button.ng-scope[aria-label="Add a panel to the dashboard"]')
|
||||
.click();
|
||||
},
|
||||
}
|
||||
|
||||
filterVizNames: function filterVizNames(vizName) {
|
||||
return thisTime
|
||||
filterVizNames(vizName) {
|
||||
return this.findTimeout
|
||||
.findByCssSelector('input[placeholder="Visualizations Filter..."]')
|
||||
.click()
|
||||
.pressKeys(vizName);
|
||||
},
|
||||
}
|
||||
|
||||
clickVizNameLink: function clickVizNameLink(vizName) {
|
||||
return thisTime
|
||||
clickVizNameLink(vizName) {
|
||||
return this.findTimeout
|
||||
.findByLinkText(vizName)
|
||||
.click();
|
||||
},
|
||||
}
|
||||
|
||||
closeAddVizualizationPanel: function closeAddVizualizationPanel() {
|
||||
common.debug('-------------close panel');
|
||||
return thisTime
|
||||
closeAddVizualizationPanel() {
|
||||
PageObjects.common.debug('-------------close panel');
|
||||
return this.findTimeout
|
||||
.findByCssSelector('i.fa fa-chevron-up')
|
||||
.click();
|
||||
},
|
||||
}
|
||||
|
||||
addVisualization: function addVisualization(vizName) {
|
||||
var self = this;
|
||||
addVisualization(vizName) {
|
||||
return this.clickAddVisualization()
|
||||
.then(function () {
|
||||
common.debug('filter visualization (' + vizName + ')');
|
||||
return self.filterVizNames(vizName);
|
||||
.then(() => {
|
||||
PageObjects.common.debug('filter visualization (' + vizName + ')');
|
||||
return this.filterVizNames(vizName);
|
||||
})
|
||||
// this second wait is usually enough to avoid the
|
||||
// 'stale element reference: element is not attached to the page document'
|
||||
// on the next step
|
||||
.then(function () {
|
||||
return common.sleep(1000);
|
||||
.then(() => {
|
||||
return PageObjects.common.sleep(1000);
|
||||
})
|
||||
.then(function () {
|
||||
.then(() => {
|
||||
// but wrap in a try loop since it can still happen
|
||||
return common.try(function () {
|
||||
common.debug('click visualization (' + vizName + ')');
|
||||
return self.clickVizNameLink(vizName);
|
||||
return PageObjects.common.try(() => {
|
||||
PageObjects.common.debug('click visualization (' + vizName + ')');
|
||||
return this.clickVizNameLink(vizName);
|
||||
});
|
||||
})
|
||||
// this second click of 'Add' collapses the Add Visualization pane
|
||||
.then(function () {
|
||||
return self.clickAddVisualization();
|
||||
.then(() => {
|
||||
return this.clickAddVisualization();
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
saveDashboard: function saveDashboard(dashName) {
|
||||
var self = this;
|
||||
return thisTime
|
||||
saveDashboard(dashName) {
|
||||
return this.findTimeout
|
||||
.findByCssSelector('button.ng-scope[aria-label="Save Dashboard"]')
|
||||
.click()
|
||||
.then(function () {
|
||||
return headerPage.getSpinnerDone();
|
||||
.then(() => {
|
||||
return PageObjects.header.getSpinnerDone();
|
||||
})
|
||||
.then(function () {
|
||||
return common.sleep(1000);
|
||||
.then(() => {
|
||||
return PageObjects.common.sleep(1000);
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('saveButton button clicked');
|
||||
return thisTime
|
||||
.then(() => {
|
||||
PageObjects.common.debug('saveButton button clicked');
|
||||
return this.findTimeout
|
||||
.findById('dashboardTitle')
|
||||
.type(dashName);
|
||||
})
|
||||
.then(function () {
|
||||
return headerPage.getSpinnerDone();
|
||||
.then(() => {
|
||||
return PageObjects.header.getSpinnerDone();
|
||||
})
|
||||
.then(function () {
|
||||
return common.sleep(1000);
|
||||
.then(() => {
|
||||
return PageObjects.common.sleep(1000);
|
||||
})
|
||||
// click save button
|
||||
.then(function () {
|
||||
return common.try(function () {
|
||||
common.debug('clicking final Save button for named dashboard');
|
||||
return thisTime
|
||||
.then(() => {
|
||||
return PageObjects.common.try(() => {
|
||||
PageObjects.common.debug('clicking final Save button for named dashboard');
|
||||
return this.findTimeout
|
||||
.findByCssSelector('.btn-primary')
|
||||
.click();
|
||||
});
|
||||
})
|
||||
.then(function () {
|
||||
return headerPage.getSpinnerDone();
|
||||
.then(() => {
|
||||
return PageObjects.header.getSpinnerDone();
|
||||
})
|
||||
// verify that green message at the top of the page.
|
||||
// it's only there for about 5 seconds
|
||||
.then(function () {
|
||||
return common.try(function () {
|
||||
common.debug('verify toast-message for saved dashboard');
|
||||
return thisTime
|
||||
.then(() => {
|
||||
return PageObjects.common.try(() => {
|
||||
PageObjects.common.debug('verify toast-message for saved dashboard');
|
||||
return this.findTimeout
|
||||
.findByCssSelector('kbn-truncated.toast-message.ng-isolate-scope')
|
||||
.getVisibleText();
|
||||
});
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
clickDashboardByLinkText: function clickDashboardByLinkText(dashName) {
|
||||
return thisTime
|
||||
clickDashboardByLinkText(dashName) {
|
||||
return this.findTimeout
|
||||
.findByLinkText(dashName)
|
||||
.click();
|
||||
},
|
||||
}
|
||||
|
||||
// use the search filter box to narrow the results down to a single
|
||||
// entry, or at least to a single page of results
|
||||
loadSavedDashboard: function loadSavedDashboard(dashName) {
|
||||
loadSavedDashboard(dashName) {
|
||||
var self = this;
|
||||
return thisTime
|
||||
return this.findTimeout
|
||||
.findByCssSelector('button.ng-scope[aria-label="Load Saved Dashboard"]')
|
||||
.click()
|
||||
.then(function filterDashboard() {
|
||||
common.debug('Load Saved Dashboard button clicked');
|
||||
PageObjects.common.debug('Load Saved Dashboard button clicked');
|
||||
return self.remote
|
||||
.findByCssSelector('input[name="filter"]')
|
||||
.click()
|
||||
.type(dashName.replace('-',' '));
|
||||
})
|
||||
.then(function () {
|
||||
return headerPage.getSpinnerDone();
|
||||
.then(() => {
|
||||
return PageObjects.header.getSpinnerDone();
|
||||
})
|
||||
.then(function () {
|
||||
return common.sleep(1000);
|
||||
.then(() => {
|
||||
return PageObjects.common.sleep(1000);
|
||||
})
|
||||
.then(function clickDashboardByLinkedText() {
|
||||
return self
|
||||
.clickDashboardByLinkText(dashName);
|
||||
})
|
||||
.then(function () {
|
||||
return headerPage.getSpinnerDone();
|
||||
.then(() => {
|
||||
return PageObjects.header.getSpinnerDone();
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
getPanelTitles: function getPanelTitles() {
|
||||
common.debug('in getPanelTitles');
|
||||
return thisTime
|
||||
getPanelTitles() {
|
||||
PageObjects.common.debug('in getPanelTitles');
|
||||
return this.findTimeout
|
||||
.findAllByCssSelector('span.panel-title')
|
||||
.then(function (titleObjects) {
|
||||
|
||||
|
@ -168,48 +166,48 @@ export default (function () {
|
|||
var getTitlePromises = titleObjects.map(getTitles);
|
||||
return Promise.all(getTitlePromises);
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
getPanelData: function getPanelData() {
|
||||
common.debug('in getPanelData');
|
||||
return thisTime
|
||||
getPanelData() {
|
||||
PageObjects.common.debug('in getPanelData');
|
||||
return this.findTimeout
|
||||
.findAllByCssSelector('li.gs-w')
|
||||
.then(function (titleObjects) {
|
||||
|
||||
function getTitles(chart) {
|
||||
var obj = {};
|
||||
return chart.getAttribute('data-col')
|
||||
.then(function (theData) {
|
||||
.then(theData => {
|
||||
obj = {dataCol:theData};
|
||||
return chart;
|
||||
})
|
||||
.then(function (chart) {
|
||||
.then(chart => {
|
||||
return chart.getAttribute('data-row')
|
||||
.then(function (theData) {
|
||||
.then(theData => {
|
||||
obj.dataRow = theData;
|
||||
return chart;
|
||||
});
|
||||
})
|
||||
.then(function (chart) {
|
||||
.then(chart => {
|
||||
return chart.getAttribute('data-sizex')
|
||||
.then(function (theData) {
|
||||
.then(theData => {
|
||||
obj.dataSizeX = theData;
|
||||
return chart;
|
||||
});
|
||||
})
|
||||
.then(function (chart) {
|
||||
.then(chart => {
|
||||
return chart.getAttribute('data-sizey')
|
||||
.then(function (theData) {
|
||||
.then(theData => {
|
||||
obj.dataSizeY = theData;
|
||||
return chart;
|
||||
});
|
||||
})
|
||||
.then(function (chart) {
|
||||
.then(chart => {
|
||||
return chart.findByCssSelector('span.panel-title')
|
||||
.then(function (titleElement) {
|
||||
return titleElement.getAttribute('title');
|
||||
})
|
||||
.then(function (theData) {
|
||||
.then(theData => {
|
||||
obj.title = theData;
|
||||
return obj;
|
||||
});
|
||||
|
@ -221,7 +219,4 @@ export default (function () {
|
|||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
return DashboardPage;
|
||||
}());
|
||||
}
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
|
||||
import Common from './common.js';
|
||||
import { defaultFindTimeout } from '../';
|
||||
import {
|
||||
defaultFindTimeout
|
||||
} from '../';
|
||||
|
||||
let thisTime;
|
||||
import PageObjects from './';
|
||||
|
||||
export default class DiscoverPage extends Common {
|
||||
export default class DiscoverPage {
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
init(remote) {
|
||||
super.init(remote);
|
||||
thisTime = this.remote.setFindTimeout(defaultFindTimeout);
|
||||
this.remote = remote;
|
||||
this.findTimeout = this.remote.setFindTimeout(defaultFindTimeout);
|
||||
}
|
||||
|
||||
getQueryField() {
|
||||
return thisTime
|
||||
return this.findTimeout
|
||||
.findByCssSelector('input[ng-model=\'state.query\']');
|
||||
}
|
||||
|
||||
getQuerySearchButton() {
|
||||
return thisTime
|
||||
return this.findTimeout
|
||||
.findByCssSelector('button[aria-label=\'Search\']');
|
||||
}
|
||||
|
||||
getTimespanText() {
|
||||
return thisTime
|
||||
return this.findTimeout
|
||||
.findByCssSelector('.kibana-nav-options .navbar-timepicker-time-desc pretty-duration')
|
||||
.getVisibleText();
|
||||
}
|
||||
|
||||
getChartTimespan() {
|
||||
return thisTime
|
||||
return this.findTimeout
|
||||
.findByCssSelector('center.small > span:nth-child(1)')
|
||||
.getVisibleText();
|
||||
}
|
||||
|
@ -40,50 +40,49 @@ export default class DiscoverPage extends Common {
|
|||
saveSearch(searchName) {
|
||||
return this.clickSaveSearchButton()
|
||||
.then(() => {
|
||||
this.debug('--saveSearch button clicked');
|
||||
return thisTime.findDisplayedById('SaveSearch')
|
||||
PageObjects.common.debug('--saveSearch button clicked');
|
||||
return this.findTimeout.findDisplayedById('SaveSearch')
|
||||
.pressKeys(searchName);
|
||||
})
|
||||
.then(() => {
|
||||
this.debug('--find save button');
|
||||
return this.findTestSubject('discover-save-search-btn').click();
|
||||
PageObjects.common.debug('--find save button');
|
||||
return PageObjects.common.findTestSubject('discover-save-search-btn').click();
|
||||
});
|
||||
}
|
||||
|
||||
loadSavedSearch(searchName) {
|
||||
var self = this;
|
||||
return self.clickLoadSavedSearchButton()
|
||||
.then(function () {
|
||||
thisTime.findByLinkText(searchName).click();
|
||||
return this.clickLoadSavedSearchButton()
|
||||
.then(() => {
|
||||
this.findTimeout.findByLinkText(searchName).click();
|
||||
});
|
||||
}
|
||||
|
||||
clickNewSearchButton() {
|
||||
return thisTime
|
||||
return this.findTimeout
|
||||
.findByCssSelector('button[aria-label="New Search"]')
|
||||
.click();
|
||||
}
|
||||
|
||||
clickSaveSearchButton() {
|
||||
return thisTime
|
||||
return this.findTimeout
|
||||
.findByCssSelector('button[aria-label="Save Search"]')
|
||||
.click();
|
||||
}
|
||||
|
||||
clickLoadSavedSearchButton() {
|
||||
return thisTime
|
||||
return this.findTimeout
|
||||
.findDisplayedByCssSelector('button[aria-label="Load Saved Search"]')
|
||||
.click();
|
||||
}
|
||||
|
||||
getCurrentQueryName() {
|
||||
return thisTime
|
||||
return this.findTimeout
|
||||
.findByCssSelector('span.kibana-nav-info-title span')
|
||||
.getVisibleText();
|
||||
}
|
||||
|
||||
getBarChartData() {
|
||||
return thisTime
|
||||
return this.findTimeout
|
||||
.findAllByCssSelector('rect[data-label="Count"]')
|
||||
.then(function (chartData) {
|
||||
|
||||
|
@ -101,18 +100,18 @@ export default class DiscoverPage extends Common {
|
|||
}
|
||||
|
||||
getChartInterval() {
|
||||
return thisTime
|
||||
return this.findTimeout
|
||||
.findByCssSelector('a[ng-click="toggleInterval()"]')
|
||||
.getVisibleText()
|
||||
.then(function (intervalText) {
|
||||
.then(intervalText => {
|
||||
if (intervalText.length > 0) {
|
||||
return intervalText;
|
||||
} else {
|
||||
return thisTime
|
||||
return this.findTimeout
|
||||
.findByCssSelector('select[ng-model="state.interval"]')
|
||||
.getProperty('value') // this gets 'string:d' for Daily
|
||||
.then(function (selectedValue) {
|
||||
return thisTime
|
||||
.then(selectedValue => {
|
||||
return this.findTimeout
|
||||
.findByCssSelector('option[value="' + selectedValue + '"]')
|
||||
.getVisibleText();
|
||||
});
|
||||
|
@ -124,121 +123,120 @@ export default class DiscoverPage extends Common {
|
|||
return this.remote.setFindTimeout(5000)
|
||||
.findByCssSelector('a[ng-click="toggleInterval()"]')
|
||||
.click()
|
||||
.catch(function () {
|
||||
.catch(() => {
|
||||
// in some cases we have the link above, but after we've made a
|
||||
// selection we just have a select list.
|
||||
})
|
||||
.then(function () {
|
||||
return thisTime
|
||||
.then(() => {
|
||||
return this.findTimeout
|
||||
.findByCssSelector('option[label="' + interval + '"]')
|
||||
.click();
|
||||
});
|
||||
}
|
||||
|
||||
getHitCount() {
|
||||
return thisTime
|
||||
return this.findTimeout
|
||||
.findByCssSelector('strong.discover-info-hits')
|
||||
.getVisibleText();
|
||||
}
|
||||
|
||||
query(queryString) {
|
||||
return thisTime
|
||||
return this.findTimeout
|
||||
.findByCssSelector('input[aria-label="Search input"]')
|
||||
.clearValue()
|
||||
.type(queryString)
|
||||
.then(function () {
|
||||
return thisTime
|
||||
.then(() => {
|
||||
return this.findTimeout
|
||||
.findByCssSelector('button[aria-label="Search"]')
|
||||
.click();
|
||||
});
|
||||
}
|
||||
|
||||
getDocHeader() {
|
||||
return thisTime
|
||||
return this.findTimeout
|
||||
.findByCssSelector('thead.ng-isolate-scope > tr:nth-child(1)')
|
||||
.getVisibleText();
|
||||
}
|
||||
|
||||
getDocTableIndex(index) {
|
||||
return thisTime
|
||||
return this.findTimeout
|
||||
.findByCssSelector('tr.discover-table-row:nth-child(' + (index) + ')')
|
||||
.getVisibleText();
|
||||
}
|
||||
|
||||
clickDocSortDown() {
|
||||
return thisTime
|
||||
return this.findTimeout
|
||||
.findByCssSelector('.fa-sort-down')
|
||||
.click();
|
||||
}
|
||||
|
||||
clickDocSortUp() {
|
||||
return thisTime
|
||||
return this.findTimeout
|
||||
.findByCssSelector('.fa-sort-up')
|
||||
.click();
|
||||
}
|
||||
|
||||
getMarks() {
|
||||
return thisTime
|
||||
return this.findTimeout
|
||||
.findAllByCssSelector('mark')
|
||||
.getVisibleText();
|
||||
}
|
||||
|
||||
clickShare() {
|
||||
return thisTime
|
||||
return this.findTimeout
|
||||
.findByCssSelector('button[aria-label="Share Search"]')
|
||||
.click();
|
||||
}
|
||||
|
||||
clickShortenUrl() {
|
||||
return thisTime
|
||||
return this.findTimeout
|
||||
.findByCssSelector('button.shorten-button')
|
||||
.click();
|
||||
}
|
||||
|
||||
clickCopyToClipboard() {
|
||||
return thisTime
|
||||
return this.findTimeout
|
||||
.findDisplayedByCssSelector('button.clipboard-button')
|
||||
.click();
|
||||
}
|
||||
|
||||
getShareCaption() {
|
||||
return thisTime
|
||||
return this.findTimeout
|
||||
.findByCssSelector('.vis-share label')
|
||||
.getVisibleText();
|
||||
}
|
||||
|
||||
getSharedUrl() {
|
||||
return thisTime
|
||||
return this.findTimeout
|
||||
.findByCssSelector('.url')
|
||||
.getProperty('value');
|
||||
}
|
||||
|
||||
getShortenedUrl() {
|
||||
return thisTime
|
||||
return this.findTimeout
|
||||
.findByCssSelector('.url')
|
||||
.getProperty('value');
|
||||
}
|
||||
|
||||
toggleSidebarCollapse() {
|
||||
return thisTime.findDisplayedByCssSelector('.sidebar-collapser .chevron-cont')
|
||||
return this.findTimeout.findDisplayedByCssSelector('.sidebar-collapser .chevron-cont')
|
||||
.click();
|
||||
}
|
||||
|
||||
getSidebarWidth() {
|
||||
return thisTime
|
||||
return this.findTimeout
|
||||
.findByClassName('sidebar-list')
|
||||
.getProperty('clientWidth');
|
||||
}
|
||||
|
||||
hasNoResults() {
|
||||
return this
|
||||
.findTestSubject('discoverNoResults')
|
||||
return PageObjects.common.findTestSubject('discoverNoResults')
|
||||
.then(() => true)
|
||||
.catch(() => false);
|
||||
}
|
||||
|
||||
getNoResultsTimepicker() {
|
||||
return this.findTestSubject('discoverNoResultsTimefilter');
|
||||
return PageObjects.common.findTestSubject('discoverNoResultsTimefilter');
|
||||
}
|
||||
|
||||
hasNoResultsTimepicker() {
|
||||
|
|
|
@ -1,50 +1,50 @@
|
|||
|
||||
import Common from './common.js';
|
||||
import { defaultFindTimeout } from '../';
|
||||
import {
|
||||
defaultFindTimeout
|
||||
} from '../';
|
||||
|
||||
export default class HeaderPage extends Common {
|
||||
import PageObjects from './';
|
||||
|
||||
export default class HeaderPage {
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
init(remote) {
|
||||
super.init(remote);
|
||||
this.remote = remote;
|
||||
}
|
||||
|
||||
clickSelector(selector) {
|
||||
var self = this;
|
||||
return this.try(function () {
|
||||
return self.remote.setFindTimeout(defaultFindTimeout)
|
||||
return this.try(() => {
|
||||
return this.remote.setFindTimeout(defaultFindTimeout)
|
||||
.findByCssSelector(selector)
|
||||
.then(function (tab) {
|
||||
.then(tab => {
|
||||
return tab.click();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
clickDiscover() {
|
||||
this.debug('click Discover tab');
|
||||
PageObjects.common.debug('click Discover tab');
|
||||
this.clickSelector('a[href*=\'discover\']');
|
||||
}
|
||||
|
||||
clickVisualize() {
|
||||
this.debug('click Visualize tab');
|
||||
PageObjects.common.debug('click Visualize tab');
|
||||
this.clickSelector('a[href*=\'visualize\']');
|
||||
}
|
||||
|
||||
clickDashboard() {
|
||||
this.debug('click Dashboard tab');
|
||||
PageObjects.common.debug('click Dashboard tab');
|
||||
this.clickSelector('a[href*=\'dashboard\']');
|
||||
}
|
||||
|
||||
clickSettings() {
|
||||
this.debug('click Settings tab');
|
||||
PageObjects.common.debug('click Settings tab');
|
||||
this.clickSelector('a[href*=\'settings\']');
|
||||
}
|
||||
|
||||
clickTimepicker() {
|
||||
var self = this;
|
||||
return this.remote.setFindTimeout(defaultFindTimeout)
|
||||
.findDisplayedByClassName('navbar-timepicker-time-desc').click();
|
||||
}
|
||||
|
@ -57,7 +57,6 @@ export default class HeaderPage extends Common {
|
|||
}
|
||||
|
||||
clickAbsoluteButton() {
|
||||
var self = this;
|
||||
return this.remote.setFindTimeout(defaultFindTimeout)
|
||||
.findByLinkText('Absolute').click();
|
||||
}
|
||||
|
@ -86,20 +85,19 @@ export default class HeaderPage extends Common {
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
setAbsoluteRange(fromTime, toTime) {
|
||||
this.debug('clickTimepicker');
|
||||
PageObjects.common.debug('clickTimepicker');
|
||||
return this.clickTimepicker()
|
||||
.then(() => {
|
||||
this.debug('--Clicking Absolute button');
|
||||
PageObjects.common.debug('--Clicking Absolute button');
|
||||
return this.clickAbsoluteButton();
|
||||
})
|
||||
.then(() => {
|
||||
this.debug('--Setting From Time : ' + fromTime);
|
||||
PageObjects.common.debug('--Setting From Time : ' + fromTime);
|
||||
return this.setFromTime(fromTime);
|
||||
})
|
||||
.then(() => {
|
||||
this.debug('--Setting To Time : ' + toTime);
|
||||
PageObjects.common.debug('--Setting To Time : ' + toTime);
|
||||
return this.setToTime(toTime);
|
||||
})
|
||||
.then(() => {
|
||||
|
@ -114,7 +112,6 @@ export default class HeaderPage extends Common {
|
|||
}
|
||||
|
||||
collapseTimepicker() {
|
||||
var self = this;
|
||||
return this.remote.setFindTimeout(defaultFindTimeout)
|
||||
.findByCssSelector('.fa.fa-chevron-circle-up')
|
||||
.click();
|
||||
|
@ -127,22 +124,18 @@ export default class HeaderPage extends Common {
|
|||
}
|
||||
|
||||
waitForToastMessageGone() {
|
||||
var self = this;
|
||||
return self.remote.setFindTimeout(defaultFindTimeout)
|
||||
return this.remote.setFindTimeout(defaultFindTimeout)
|
||||
.waitForDeletedByCssSelector('kbn-truncated.toast-message');
|
||||
}
|
||||
|
||||
clickToastOK() {
|
||||
return this.remote
|
||||
.setFindTimeout(defaultFindTimeout)
|
||||
return this.remote.setFindTimeout(defaultFindTimeout)
|
||||
.findByCssSelector('button[ng-if="notif.accept"]')
|
||||
.click();
|
||||
}
|
||||
|
||||
getSpinnerDone() {
|
||||
var self = this;
|
||||
return this.remote
|
||||
.setFindTimeout(defaultFindTimeout * 10)
|
||||
return this.remote.setFindTimeout(defaultFindTimeout * 10)
|
||||
.findByCssSelector('.spinner.ng-hide');
|
||||
}
|
||||
|
||||
|
|
|
@ -1,168 +1,170 @@
|
|||
|
||||
import Bluebird from 'bluebird';
|
||||
import { common, remote, defaultFindTimeout, headerPage } from '../';
|
||||
|
||||
export default (function () {
|
||||
function SettingsPage() {
|
||||
import {
|
||||
defaultFindTimeout,
|
||||
} from '../';
|
||||
|
||||
import PageObjects from './';
|
||||
|
||||
export default class SettingsPage {
|
||||
|
||||
constructor() {
|
||||
}
|
||||
|
||||
SettingsPage.prototype = {
|
||||
constructor: SettingsPage,
|
||||
|
||||
init(remote) {
|
||||
this.remote = remote;
|
||||
},
|
||||
}
|
||||
|
||||
clickNavigation: function () {
|
||||
clickNavigation() {
|
||||
// TODO: find better way to target the element
|
||||
return this.remote.findDisplayedByCssSelector('.app-link:nth-child(5) a').click();
|
||||
},
|
||||
}
|
||||
|
||||
clickLinkText: function (text) {
|
||||
clickLinkText(text) {
|
||||
return this.remote.findDisplayedByLinkText(text).click();
|
||||
},
|
||||
}
|
||||
|
||||
clickKibanaSettings: function () {
|
||||
clickKibanaSettings() {
|
||||
return this.clickLinkText('Advanced Settings');
|
||||
},
|
||||
}
|
||||
|
||||
clickKibanaIndicies: function () {
|
||||
clickKibanaIndicies() {
|
||||
return this.clickLinkText('Index Patterns');
|
||||
},
|
||||
}
|
||||
|
||||
clickExistingData: function () {
|
||||
clickExistingData() {
|
||||
return this.clickLinkText('Existing Data');
|
||||
},
|
||||
}
|
||||
|
||||
getAdvancedSettings: function getAdvancedSettings(propertyName) {
|
||||
common.debug('in setAdvancedSettings');
|
||||
return common.findTestSubject('advancedSetting&' + propertyName + ' currentValue')
|
||||
getAdvancedSettings(propertyName) {
|
||||
PageObjects.common.debug('in setAdvancedSettings');
|
||||
return PageObjects.common.findTestSubject('advancedSetting&' + propertyName + ' currentValue')
|
||||
.getVisibleText();
|
||||
},
|
||||
}
|
||||
|
||||
setAdvancedSettings: function setAdvancedSettings(propertyName, propertyValue) {
|
||||
setAdvancedSettings(propertyName, propertyValue) {
|
||||
var self = this;
|
||||
|
||||
return common.findTestSubject('advancedSetting&' + propertyName + ' editButton')
|
||||
return PageObjects.common.findTestSubject('advancedSetting&' + propertyName + ' editButton')
|
||||
.click()
|
||||
.then(function () {
|
||||
return headerPage.getSpinnerDone();
|
||||
.then(() => {
|
||||
return PageObjects.header.getSpinnerDone();
|
||||
})
|
||||
.then(function () {
|
||||
return common.sleep(1000);
|
||||
.then(() => {
|
||||
return PageObjects.common.sleep(1000);
|
||||
})
|
||||
.then(function setAdvancedSettingsClickPropertyValue(selectList) {
|
||||
return self.remote.setFindTimeout(defaultFindTimeout)
|
||||
.findByCssSelector('option[label="' + propertyValue + '"]')
|
||||
.click();
|
||||
})
|
||||
.then(function () {
|
||||
return headerPage.getSpinnerDone();
|
||||
.then(() => {
|
||||
return PageObjects.header.getSpinnerDone();
|
||||
})
|
||||
.then(function setAdvancedSettingsClickSaveButton() {
|
||||
return common.findTestSubject('advancedSetting&' + propertyName + ' saveButton')
|
||||
return PageObjects.common.findTestSubject('advancedSetting&' + propertyName + ' saveButton')
|
||||
.click();
|
||||
})
|
||||
.then(function () {
|
||||
return headerPage.getSpinnerDone();
|
||||
.then(() => {
|
||||
return PageObjects.header.getSpinnerDone();
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
getAdvancedSettings: function getAdvancedSettings(propertyName) {
|
||||
getAdvancedSettings(propertyName) {
|
||||
var self = this;
|
||||
common.debug('in setAdvancedSettings');
|
||||
return common.findTestSubject('advancedSetting&' + propertyName + ' currentValue')
|
||||
PageObjects.common.debug('in setAdvancedSettings');
|
||||
return PageObjects.common.findTestSubject('advancedSetting&' + propertyName + ' currentValue')
|
||||
.getVisibleText();
|
||||
},
|
||||
}
|
||||
|
||||
navigateTo: function () {
|
||||
return common.navigateToApp('settings');
|
||||
},
|
||||
navigateTo() {
|
||||
return PageObjects.common.navigateToApp('settings');
|
||||
}
|
||||
|
||||
getTimeBasedEventsCheckbox: function () {
|
||||
getTimeBasedEventsCheckbox() {
|
||||
return this.remote.setFindTimeout(defaultFindTimeout)
|
||||
.findByCssSelector('input[ng-model="index.isTimeBased"]');
|
||||
},
|
||||
}
|
||||
|
||||
getTimeBasedIndexPatternCheckbox: function (timeout) {
|
||||
getTimeBasedIndexPatternCheckbox(timeout) {
|
||||
timeout = timeout || defaultFindTimeout;
|
||||
// fail faster since we're sometimes checking that it doesn't exist
|
||||
return this.remote.setFindTimeout(timeout)
|
||||
.findByCssSelector('input[ng-model="index.nameIsPattern"]');
|
||||
},
|
||||
}
|
||||
|
||||
getIndexPatternField: function () {
|
||||
getIndexPatternField() {
|
||||
return this.remote.setFindTimeout(defaultFindTimeout)
|
||||
.findByCssSelector('[ng-model="index.name"]');
|
||||
},
|
||||
}
|
||||
|
||||
getTimeFieldNameField: function () {
|
||||
getTimeFieldNameField() {
|
||||
return this.remote.setFindTimeout(defaultFindTimeout)
|
||||
.findDisplayedByCssSelector('select[ng-model="index.timeField"]');
|
||||
},
|
||||
|
||||
selectTimeFieldOption: function (selection) {
|
||||
var self = this;
|
||||
}
|
||||
|
||||
selectTimeFieldOption(selection) {
|
||||
// open dropdown
|
||||
return self.getTimeFieldNameField().click()
|
||||
.then(function () {
|
||||
return this.getTimeFieldNameField().click()
|
||||
.then(() => {
|
||||
// close dropdown, keep focus
|
||||
return self.getTimeFieldNameField().click();
|
||||
return this.getTimeFieldNameField().click();
|
||||
})
|
||||
.then(function () {
|
||||
return headerPage.getSpinnerDone();
|
||||
.then(() => {
|
||||
return PageObjects.header.getSpinnerDone();
|
||||
})
|
||||
.then(function () {
|
||||
return common.try(function () {
|
||||
return self.getTimeFieldOption(selection).click()
|
||||
.then(function () {
|
||||
return self.getTimeFieldOption(selection).isSelected();
|
||||
.then(() => {
|
||||
return PageObjects.common.try(() => {
|
||||
return this.getTimeFieldOption(selection).click()
|
||||
.then(() => {
|
||||
return this.getTimeFieldOption(selection).isSelected();
|
||||
})
|
||||
.then(function (selected) {
|
||||
.then(selected => {
|
||||
if (!selected) throw new Error('option not selected: ' + selected);
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
getTimeFieldOption: function (selection) {
|
||||
getTimeFieldOption(selection) {
|
||||
return this.remote.setFindTimeout(defaultFindTimeout)
|
||||
.findDisplayedByCssSelector('option[label="' + selection + '"]').click();
|
||||
},
|
||||
}
|
||||
|
||||
getCreateButton: function () {
|
||||
getCreateButton() {
|
||||
return this.remote.setFindTimeout(defaultFindTimeout)
|
||||
.findDisplayedByCssSelector('[type="submit"]');
|
||||
},
|
||||
}
|
||||
|
||||
clickDefaultIndexButton: function () {
|
||||
clickDefaultIndexButton() {
|
||||
return this.remote.setFindTimeout(defaultFindTimeout)
|
||||
.findByCssSelector('button.btn.btn-warning.ng-scope').click()
|
||||
.then(function () {
|
||||
return headerPage.getSpinnerDone();
|
||||
.then(() => {
|
||||
return PageObjects.header.getSpinnerDone();
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
clickDeletePattern: function () {
|
||||
clickDeletePattern() {
|
||||
return this.remote.setFindTimeout(defaultFindTimeout)
|
||||
.findByCssSelector('button.btn.btn-danger.ng-scope').click();
|
||||
},
|
||||
}
|
||||
|
||||
getIndexPageHeading: function () {
|
||||
getIndexPageHeading() {
|
||||
return this.remote.setFindTimeout(defaultFindTimeout)
|
||||
.findByCssSelector('h1.title.ng-binding.ng-isolate-scope');
|
||||
},
|
||||
}
|
||||
|
||||
getConfigureHeader: function () {
|
||||
getConfigureHeader() {
|
||||
return this.remote.setFindTimeout(defaultFindTimeout)
|
||||
.findByCssSelector('h1');
|
||||
},
|
||||
getTableHeader: function () {
|
||||
}
|
||||
getTableHeader() {
|
||||
return this.remote.setFindTimeout(defaultFindTimeout)
|
||||
.findAllByCssSelector('table.table.table-condensed thead tr th');
|
||||
},
|
||||
}
|
||||
|
||||
sortBy: function (columnName) {
|
||||
sortBy(columnName) {
|
||||
return this.remote.setFindTimeout(defaultFindTimeout)
|
||||
.findAllByCssSelector('table.table.table-condensed thead tr th span')
|
||||
.then(function (chartTypes) {
|
||||
|
@ -172,7 +174,7 @@ export default (function () {
|
|||
if (chartString === columnName) {
|
||||
return chart.click()
|
||||
.then(function () {
|
||||
return headerPage.getSpinnerDone();
|
||||
return PageObjects.header.getSpinnerDone();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -181,22 +183,22 @@ export default (function () {
|
|||
var getChartTypesPromises = chartTypes.map(getChartType);
|
||||
return Bluebird.all(getChartTypesPromises);
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
getTableRow: function (rowNumber, colNumber) {
|
||||
getTableRow(rowNumber, colNumber) {
|
||||
return this.remote.setFindTimeout(defaultFindTimeout)
|
||||
// passing in zero-based index, but adding 1 for css 1-based indexes
|
||||
.findByCssSelector('div.agg-table-paginated table.table.table-condensed tbody tr:nth-child(' +
|
||||
(rowNumber + 1) + ') td.ng-scope:nth-child(' +
|
||||
(colNumber + 1) + ') span.ng-binding'
|
||||
);
|
||||
},
|
||||
}
|
||||
|
||||
getFieldsTabCount: function () {
|
||||
getFieldsTabCount() {
|
||||
var self = this;
|
||||
var selector = 'li.kbn-management-tab.active a small';
|
||||
|
||||
return common.try(function () {
|
||||
return PageObjects.common.try(function () {
|
||||
return self.remote.setFindTimeout(defaultFindTimeout / 10)
|
||||
.findByCssSelector(selector).getVisibleText()
|
||||
.then(function (theText) {
|
||||
|
@ -204,9 +206,9 @@ export default (function () {
|
|||
return theText.replace(/\((.*)\)/, '$1');
|
||||
});
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
getPageSize: function () {
|
||||
getPageSize() {
|
||||
var selectedItemLabel = '';
|
||||
return this.remote.setFindTimeout(defaultFindTimeout)
|
||||
.findAllByCssSelector('select.ng-pristine.ng-valid.ng-untouched option')
|
||||
|
@ -227,149 +229,146 @@ export default (function () {
|
|||
var getChartTypesPromises = chartTypes.map(getChartType);
|
||||
return Bluebird.all(getChartTypesPromises);
|
||||
})
|
||||
.then(function () {
|
||||
.then(() => {
|
||||
return selectedItemLabel;
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
getPageFieldCount: function () {
|
||||
getPageFieldCount() {
|
||||
return this.remote.setFindTimeout(defaultFindTimeout)
|
||||
.findAllByCssSelector('div.agg-table-paginated table.table.table-condensed tbody tr td.ng-scope:nth-child(1) span.ng-binding');
|
||||
},
|
||||
}
|
||||
|
||||
goToPage: function (pageNum) {
|
||||
goToPage(pageNum) {
|
||||
return this.remote.setFindTimeout(defaultFindTimeout)
|
||||
.findByCssSelector('ul.pagination-other-pages-list.pagination-sm.ng-scope li.ng-scope:nth-child(' +
|
||||
(pageNum + 1) + ') a.ng-binding'
|
||||
)
|
||||
.then(function (page) {
|
||||
.then(page => {
|
||||
return page.click();
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
openControlsRow: function (row) {
|
||||
openControlsRow(row) {
|
||||
return this.remote.setFindTimeout(defaultFindTimeout)
|
||||
.findByCssSelector('table.table.table-condensed tbody tr:nth-child(' +
|
||||
(row + 1) + ') td.ng-scope div.actions a.btn.btn-xs.btn-default i.fa.fa-pencil'
|
||||
)
|
||||
.then(function (page) {
|
||||
.then(page => {
|
||||
return page.click();
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
openControlsByName: function (name) {
|
||||
openControlsByName(name) {
|
||||
return this.remote.setFindTimeout(defaultFindTimeout)
|
||||
.findByCssSelector('div.actions a.btn.btn-xs.btn-default[href$="/' + name + '"]')
|
||||
.then(function (button) {
|
||||
.then(button => {
|
||||
return button.click();
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
increasePopularity: function () {
|
||||
increasePopularity() {
|
||||
return this.remote.setFindTimeout(defaultFindTimeout)
|
||||
.findByCssSelector('button.btn.btn-default[aria-label="Plus"]')
|
||||
.then(function (button) {
|
||||
.then(button => {
|
||||
return button.click();
|
||||
})
|
||||
.then(function () {
|
||||
return headerPage.getSpinnerDone();
|
||||
.then(() => {
|
||||
return PageObjects.header.getSpinnerDone();
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
getPopularity: function () {
|
||||
getPopularity() {
|
||||
return this.remote.setFindTimeout(defaultFindTimeout)
|
||||
.findByCssSelector('input[ng-model="editor.field.count"]')
|
||||
.then(function (input) {
|
||||
.then(input => {
|
||||
return input.getProperty('value');
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
controlChangeCancel: function () {
|
||||
controlChangeCancel() {
|
||||
return this.remote.setFindTimeout(defaultFindTimeout)
|
||||
.findByCssSelector('button.btn.btn-primary[aria-label="Cancel"]')
|
||||
.then(function (button) {
|
||||
.then(button => {
|
||||
return button.click();
|
||||
})
|
||||
.then(function () {
|
||||
return headerPage.getSpinnerDone();
|
||||
.then(() => {
|
||||
return PageObjects.header.getSpinnerDone();
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
controlChangeSave: function () {
|
||||
controlChangeSave() {
|
||||
return this.remote.setFindTimeout(defaultFindTimeout)
|
||||
.findByCssSelector('button.btn.btn-success.ng-binding[aria-label="Update Field"]')
|
||||
.then(function (button) {
|
||||
.then(button => {
|
||||
return button.click();
|
||||
})
|
||||
.then(function () {
|
||||
return headerPage.getSpinnerDone();
|
||||
.then(() => {
|
||||
return PageObjects.header.getSpinnerDone();
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
setPageSize: function (size) {
|
||||
setPageSize(size) {
|
||||
return this.remote.setFindTimeout(defaultFindTimeout)
|
||||
.findByCssSelector('form.form-inline.pagination-size.ng-scope.ng-pristine.ng-valid div.form-group option[label="' + size + '"]')
|
||||
.then(function (button) {
|
||||
.then(button => {
|
||||
return button.click();
|
||||
})
|
||||
.then(function () {
|
||||
return headerPage.getSpinnerDone();
|
||||
.then(() => {
|
||||
return PageObjects.header.getSpinnerDone();
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
createIndexPattern: function () {
|
||||
var self = this;
|
||||
|
||||
return common.try(function () {
|
||||
return self.navigateTo()
|
||||
.then(function () {
|
||||
return self.clickExistingData();
|
||||
createIndexPattern() {
|
||||
return PageObjects.common.try(() => {
|
||||
return this.navigateTo()
|
||||
.then(() => {
|
||||
return this.clickExistingData();
|
||||
})
|
||||
.then(function () {
|
||||
return self.selectTimeFieldOption('@timestamp');
|
||||
.then(() => {
|
||||
return this.selectTimeFieldOption('@timestamp');
|
||||
})
|
||||
.then(function () {
|
||||
return self.getCreateButton().click();
|
||||
.then(() => {
|
||||
return this.getCreateButton().click();
|
||||
});
|
||||
})
|
||||
.then(function () {
|
||||
return headerPage.getSpinnerDone();
|
||||
.then(() => {
|
||||
return PageObjects.header.getSpinnerDone();
|
||||
})
|
||||
.then(function () {
|
||||
return common.try(function () {
|
||||
return self.remote.getCurrentUrl()
|
||||
.then(() => {
|
||||
return PageObjects.common.try(() => {
|
||||
return this.remote.getCurrentUrl()
|
||||
.then(function (currentUrl) {
|
||||
common.log('currentUrl', currentUrl);
|
||||
PageObjects.common.log('currentUrl', currentUrl);
|
||||
|
||||
if (!currentUrl.match(/indices\/.+\?/)) {
|
||||
throw new Error('Index pattern not created');
|
||||
} else {
|
||||
common.debug('Index pattern created: ' + currentUrl);
|
||||
PageObjects.common.debug('Index pattern created: ' + currentUrl);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
removeIndexPattern: function () {
|
||||
var self = this;
|
||||
removeIndexPattern() {
|
||||
var alertText;
|
||||
|
||||
return common.try(function () {
|
||||
return self.clickDeletePattern()
|
||||
.then(function () {
|
||||
return self.remote.getAlertText();
|
||||
return PageObjects.common.try(() => {
|
||||
return this.clickDeletePattern()
|
||||
.then(() => {
|
||||
return this.remote.getAlertText();
|
||||
})
|
||||
.then(function (text) {
|
||||
alertText = text;
|
||||
})
|
||||
.then(function () {
|
||||
return self.remote.acceptAlert();
|
||||
.then(() => {
|
||||
return this.remote.acceptAlert();
|
||||
});
|
||||
})
|
||||
.then(function () {
|
||||
return common.try(function () {
|
||||
return self.remote.getCurrentUrl()
|
||||
.then(() => {
|
||||
return PageObjects.common.try(() => {
|
||||
return this.remote.getCurrentUrl()
|
||||
.then(function (currentUrl) {
|
||||
if (currentUrl.match(/indices\/.+\?/)) {
|
||||
throw new Error('Index pattern not removed');
|
||||
|
@ -377,11 +376,9 @@ export default (function () {
|
|||
});
|
||||
});
|
||||
})
|
||||
.then(function () {
|
||||
.then(() => {
|
||||
return alertText;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return SettingsPage;
|
||||
}());
|
||||
}
|
||||
|
|
|
@ -1,21 +1,18 @@
|
|||
import { remote, defaultFindTimeout } from '../';
|
||||
|
||||
// in test/support/pages/shield_page.js
|
||||
export default (function (require) {
|
||||
// the page object is created as a constructor
|
||||
// so we can provide the remote Command object
|
||||
// at runtime
|
||||
function ShieldPage() {
|
||||
import {
|
||||
defaultFindTimeout,
|
||||
} from '../';
|
||||
|
||||
export default class ShieldPage {
|
||||
|
||||
constructor() {
|
||||
}
|
||||
|
||||
ShieldPage.prototype = {
|
||||
constructor: ShieldPage,
|
||||
|
||||
init(remote) {
|
||||
this.remote = remote;
|
||||
},
|
||||
}
|
||||
|
||||
login: function login(user, pwd) {
|
||||
login(user, pwd) {
|
||||
var remote = this.remote;
|
||||
return remote.setFindTimeout(defaultFindTimeout)
|
||||
.findById('username')
|
||||
|
@ -30,8 +27,4 @@ export default (function (require) {
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
return ShieldPage;
|
||||
}());
|
||||
}
|
||||
|
|
|
@ -1,80 +1,83 @@
|
|||
import { common, defaultFindTimeout, remote } from '../';
|
||||
|
||||
export default (function () {
|
||||
function VisualizePage() {
|
||||
import {
|
||||
defaultFindTimeout,
|
||||
} from '../';
|
||||
|
||||
import PageObjects from './';
|
||||
|
||||
export default class VisualizePage {
|
||||
|
||||
constructor() {
|
||||
}
|
||||
|
||||
VisualizePage.prototype = {
|
||||
constructor: VisualizePage,
|
||||
|
||||
init(remote) {
|
||||
this.remote = remote;
|
||||
},
|
||||
}
|
||||
|
||||
clickAreaChart: function clickAreaChart() {
|
||||
clickAreaChart() {
|
||||
return this.remote
|
||||
.setFindTimeout(defaultFindTimeout)
|
||||
.findByPartialLinkText('Area chart')
|
||||
.click();
|
||||
},
|
||||
}
|
||||
|
||||
clickDataTable: function clickDataTable() {
|
||||
clickDataTable() {
|
||||
return this.remote
|
||||
.setFindTimeout(defaultFindTimeout)
|
||||
.findByPartialLinkText('Data table')
|
||||
.click();
|
||||
},
|
||||
}
|
||||
|
||||
clickLineChart: function clickLineChart() {
|
||||
clickLineChart() {
|
||||
return this.remote
|
||||
.setFindTimeout(defaultFindTimeout)
|
||||
.findByPartialLinkText('Line chart')
|
||||
.click();
|
||||
},
|
||||
}
|
||||
|
||||
clickMarkdownWidget: function clickMarkdownWidget() {
|
||||
clickMarkdownWidget() {
|
||||
return this.remote
|
||||
.setFindTimeout(defaultFindTimeout)
|
||||
.findByPartialLinkText('Markdown widget')
|
||||
.click();
|
||||
},
|
||||
}
|
||||
|
||||
clickMetric: function clickMetric() {
|
||||
clickMetric() {
|
||||
return this.remote
|
||||
.setFindTimeout(defaultFindTimeout)
|
||||
.findByPartialLinkText('Metric')
|
||||
.click();
|
||||
},
|
||||
}
|
||||
|
||||
clickPieChart: function clickPieChart() {
|
||||
clickPieChart() {
|
||||
return this.remote
|
||||
.setFindTimeout(defaultFindTimeout)
|
||||
.findByPartialLinkText('Pie chart')
|
||||
.click();
|
||||
},
|
||||
}
|
||||
|
||||
clickTileMap: function clickTileMap() {
|
||||
clickTileMap() {
|
||||
return this.remote
|
||||
.setFindTimeout(defaultFindTimeout)
|
||||
.findByPartialLinkText('Tile map')
|
||||
.click();
|
||||
},
|
||||
}
|
||||
|
||||
clickVerticalBarChart: function clickVerticalBarChart() {
|
||||
clickVerticalBarChart() {
|
||||
return this.remote
|
||||
.setFindTimeout(defaultFindTimeout)
|
||||
.findByPartialLinkText('Vertical bar chart')
|
||||
.click();
|
||||
},
|
||||
}
|
||||
|
||||
getChartTypeCount: function getChartTypeCount() {
|
||||
getChartTypeCount() {
|
||||
return this.remote
|
||||
.setFindTimeout(defaultFindTimeout)
|
||||
.findAllByCssSelector('a.wizard-vis-type.ng-scope')
|
||||
.length;
|
||||
},
|
||||
}
|
||||
|
||||
getChartTypes: function getChartTypes() {
|
||||
getChartTypes() {
|
||||
var types = [];
|
||||
return this.remote
|
||||
.setFindTimeout(defaultFindTimeout)
|
||||
|
@ -89,67 +92,67 @@ export default (function () {
|
|||
.then(function (texts) {
|
||||
return texts;
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
clickAbsoluteButton: function clickAbsoluteButton() {
|
||||
clickAbsoluteButton() {
|
||||
return this.remote
|
||||
.setFindTimeout(defaultFindTimeout * 2)
|
||||
.findByCssSelector('ul.nav.nav-pills.nav-stacked.kbn-timepicker-modes:contains("absolute")')
|
||||
.click();
|
||||
},
|
||||
}
|
||||
|
||||
setFromTime: function setFromTime(timeString) {
|
||||
setFromTime(timeString) {
|
||||
return this.remote
|
||||
.setFindTimeout(defaultFindTimeout * 2)
|
||||
.findByCssSelector('input[ng-model="absolute.from"]')
|
||||
.clearValue()
|
||||
.type(timeString);
|
||||
},
|
||||
}
|
||||
|
||||
setToTime: function setToTime(timeString) {
|
||||
setToTime(timeString) {
|
||||
return this.remote
|
||||
.setFindTimeout(defaultFindTimeout * 2)
|
||||
.findByCssSelector('input[ng-model="absolute.to"]')
|
||||
.clearValue()
|
||||
.type(timeString);
|
||||
},
|
||||
}
|
||||
|
||||
clickGoButton: function clickGoButton() {
|
||||
clickGoButton() {
|
||||
return this.remote
|
||||
.setFindTimeout(defaultFindTimeout * 2)
|
||||
.findByClassName('kbn-timepicker-go')
|
||||
.click();
|
||||
},
|
||||
}
|
||||
|
||||
collapseChart: function collapseChart() {
|
||||
collapseChart() {
|
||||
return this.remote
|
||||
.setFindTimeout(defaultFindTimeout)
|
||||
.findByCssSelector('div.visualize-show-spy > div > i')
|
||||
.click();
|
||||
},
|
||||
}
|
||||
|
||||
getMetric: function getMetric() {
|
||||
getMetric() {
|
||||
return this.remote
|
||||
.setFindTimeout(2000)
|
||||
.findByCssSelector('div[ng-controller="KbnMetricVisController"]')
|
||||
.getVisibleText();
|
||||
},
|
||||
}
|
||||
|
||||
clickMetricEditor: function clickMetricEditor() {
|
||||
clickMetricEditor() {
|
||||
return this.remote
|
||||
.setFindTimeout(defaultFindTimeout)
|
||||
.findByCssSelector('button[aria-label="Open Editor"]')
|
||||
.click();
|
||||
},
|
||||
}
|
||||
|
||||
clickNewSearch: function clickNewSearch() {
|
||||
clickNewSearch() {
|
||||
return this.remote
|
||||
.setFindTimeout(defaultFindTimeout)
|
||||
.findByCssSelector('.list-group-item a')
|
||||
.click();
|
||||
},
|
||||
}
|
||||
|
||||
setValue: function setValue(newValue) {
|
||||
setValue(newValue) {
|
||||
var self = this.remote;
|
||||
return this.remote
|
||||
.setFindTimeout(defaultFindTimeout * 2)
|
||||
|
@ -167,43 +170,43 @@ export default (function () {
|
|||
.findByCssSelector('input[ng-model="numberListCntr.getList()[$index]"]')
|
||||
.type(newValue);
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
clickSavedSearch: function clickSavedSearch() {
|
||||
clickSavedSearch() {
|
||||
return this.remote
|
||||
.setFindTimeout(defaultFindTimeout)
|
||||
.findByCssSelector('li[ng-click="stepTwoMode=\'saved\'"]')
|
||||
.click();
|
||||
},
|
||||
}
|
||||
|
||||
selectSearch: function selectSearch(searchName) {
|
||||
selectSearch(searchName) {
|
||||
return this.remote
|
||||
.setFindTimeout(defaultFindTimeout)
|
||||
.findByLinkText(searchName)
|
||||
.click();
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
getErrorMessage: function getErrorMessage() {
|
||||
getErrorMessage() {
|
||||
return this.remote
|
||||
.setFindTimeout(defaultFindTimeout)
|
||||
.findByCssSelector('.item>h4')
|
||||
.getVisibleText();
|
||||
},
|
||||
}
|
||||
|
||||
// clickBucket(bucketType) 'X-Axis', 'Split Area', 'Split Chart'
|
||||
clickBucket: function clickBucket(bucketName) {
|
||||
clickBucket(bucketName) {
|
||||
return this.remote
|
||||
.setFindTimeout(defaultFindTimeout)
|
||||
.findAllByCssSelector('li.list-group-item.list-group-menu-item.ng-binding.ng-scope')
|
||||
.then(function (chartTypes) {
|
||||
common.debug('found bucket types ' + chartTypes.length);
|
||||
PageObjects.common.debug('found bucket types ' + chartTypes.length);
|
||||
|
||||
function getChartType(chart) {
|
||||
return chart
|
||||
.getVisibleText()
|
||||
.then(function (chartString) {
|
||||
//common.debug(chartString);
|
||||
//PageObjects.common.debug(chartString);
|
||||
if (chartString === bucketName) {
|
||||
chart.click();
|
||||
}
|
||||
|
@ -212,43 +215,43 @@ export default (function () {
|
|||
var getChartTypesPromises = chartTypes.map(getChartType);
|
||||
return Promise.all(getChartTypesPromises);
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
selectAggregation: function selectAggregation(myString) {
|
||||
selectAggregation(myString) {
|
||||
return this.remote
|
||||
.setFindTimeout(defaultFindTimeout)
|
||||
.findByCssSelector('option[label="' + myString + '"]')
|
||||
.click();
|
||||
},
|
||||
}
|
||||
|
||||
getField: function getField() {
|
||||
getField() {
|
||||
return this.remote
|
||||
.setFindTimeout(defaultFindTimeout)
|
||||
.findByCssSelector('.ng-valid-required[name="field"] option[selected="selected"]')
|
||||
.getVisibleText();
|
||||
},
|
||||
}
|
||||
|
||||
selectField: function selectField(fieldValue) {
|
||||
selectField(fieldValue) {
|
||||
var self = this;
|
||||
return common.try(function tryingForTime() {
|
||||
return PageObjects.common.try(function tryingForTime() {
|
||||
return self.remote
|
||||
.setFindTimeout(defaultFindTimeout)
|
||||
// the css below should be more selective
|
||||
.findByCssSelector('option[label="' + fieldValue + '"]')
|
||||
.click();
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
orderBy: function orderBy(fieldValue) {
|
||||
orderBy(fieldValue) {
|
||||
return this.remote
|
||||
.setFindTimeout(defaultFindTimeout)
|
||||
.findByCssSelector('select.form-control.ng-pristine.ng-valid.ng-untouched.ng-valid-required[ng-model="agg.params.orderBy"] ' +
|
||||
'option.ng-binding.ng-scope:contains("' + fieldValue + '")'
|
||||
)
|
||||
.click();
|
||||
},
|
||||
}
|
||||
|
||||
getInterval: function getInterval() {
|
||||
getInterval() {
|
||||
var self = this;
|
||||
return this.remote
|
||||
.setFindTimeout(defaultFindTimeout)
|
||||
|
@ -260,49 +263,49 @@ export default (function () {
|
|||
.findByCssSelector('select[ng-model="agg.params.interval"] option:nth-child(' + (selectedIndex + 1) + ')')
|
||||
.getProperty('label');
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
setInterval: function setInterval(newValue) {
|
||||
setInterval(newValue) {
|
||||
return this.remote
|
||||
.setFindTimeout(defaultFindTimeout)
|
||||
.findByCssSelector('select[ng-model="agg.params.interval"]')
|
||||
.type(newValue);
|
||||
},
|
||||
}
|
||||
|
||||
setNumericInterval: function setNumericInterval(newValue) {
|
||||
setNumericInterval(newValue) {
|
||||
return this.remote
|
||||
.setFindTimeout(defaultFindTimeout)
|
||||
.findByCssSelector('input[name="interval"]')
|
||||
.type(newValue);
|
||||
},
|
||||
}
|
||||
|
||||
clickGo: function clickGo() {
|
||||
clickGo() {
|
||||
return this.remote
|
||||
.setFindTimeout(defaultFindTimeout)
|
||||
.findByCssSelector('.btn-success')
|
||||
.click();
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
clickNewVisualization: function clickNewVisualization() {
|
||||
clickNewVisualization() {
|
||||
return this.remote
|
||||
.setFindTimeout(defaultFindTimeout)
|
||||
.findByCssSelector('button[aria-label="New Visualization"]')
|
||||
.click();
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
saveVisualization: function saveVisualization(vizName) {
|
||||
saveVisualization(vizName) {
|
||||
var self = this;
|
||||
return this.remote
|
||||
.setFindTimeout(defaultFindTimeout)
|
||||
.findByCssSelector('button[aria-label="Save Visualization"]')
|
||||
.click()
|
||||
.then(function () {
|
||||
return common.sleep(1000);
|
||||
return PageObjects.common.sleep(1000);
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('saveButton button clicked');
|
||||
PageObjects.common.debug('saveButton button clicked');
|
||||
return self.remote
|
||||
.setFindTimeout(defaultFindTimeout)
|
||||
.findByName('visTitle')
|
||||
|
@ -310,7 +313,7 @@ export default (function () {
|
|||
})
|
||||
// // click save button
|
||||
.then(function () {
|
||||
common.debug('click submit button');
|
||||
PageObjects.common.debug('click submit button');
|
||||
return self.remote
|
||||
.setFindTimeout(defaultFindTimeout)
|
||||
.findByCssSelector('.config button[type="submit"]')
|
||||
|
@ -319,23 +322,23 @@ export default (function () {
|
|||
// verify that green message at the top of the page.
|
||||
// it's only there for about 5 seconds
|
||||
.then(function () {
|
||||
return common.try(function tryingForTime() {
|
||||
return PageObjects.common.try(function tryingForTime() {
|
||||
return self.remote
|
||||
.setFindTimeout(defaultFindTimeout)
|
||||
.findByCssSelector('kbn-truncated.toast-message.ng-isolate-scope')
|
||||
.getVisibleText();
|
||||
});
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
clickLoadSavedVisButton: function clickLoadSavedVisButton() {
|
||||
clickLoadSavedVisButton() {
|
||||
return this.remote
|
||||
.setFindTimeout(defaultFindTimeout)
|
||||
.findDisplayedByCssSelector('button[aria-label="Load Saved Visualization"]')
|
||||
.click();
|
||||
},
|
||||
}
|
||||
|
||||
filterVisByName: function filterVisByName(vizName) {
|
||||
filterVisByName(vizName) {
|
||||
return this.remote
|
||||
.findByCssSelector('input[name="filter"]')
|
||||
.click()
|
||||
|
@ -343,44 +346,44 @@ export default (function () {
|
|||
// or extended character sets
|
||||
// https://github.com/elastic/kibana/issues/6300
|
||||
.type(vizName.replace('-',' '));
|
||||
},
|
||||
}
|
||||
|
||||
clickVisualizationByLinkText: function clickVisualizationByLinkText(vizName) {
|
||||
clickVisualizationByLinkText(vizName) {
|
||||
var self = this;
|
||||
common.debug('clickVisualizationByLinkText(' + vizName + ')');
|
||||
PageObjects.common.debug('clickVisualizationByLinkText(' + vizName + ')');
|
||||
|
||||
return common.try(function tryingForTime() {
|
||||
return PageObjects.common.try(function tryingForTime() {
|
||||
return self.remote
|
||||
.setFindTimeout(defaultFindTimeout)
|
||||
.findByLinkText(vizName)
|
||||
.click();
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
// this starts by clicking the Load Saved Viz button, not from the
|
||||
// bottom half of the "Create a new visualization Step 1" page
|
||||
loadSavedVisualization: function loadSavedVisualization(vizName) {
|
||||
loadSavedVisualization(vizName) {
|
||||
var self = this;
|
||||
return this.clickLoadSavedVisButton()
|
||||
.then(function filterVisualization() {
|
||||
return self.openSavedVisualization(vizName);
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
// this is for starting on the
|
||||
// bottom half of the "Create a new visualization Step 1" page
|
||||
openSavedVisualization: function openSavedVisualization(vizName) {
|
||||
openSavedVisualization(vizName) {
|
||||
var self = this;
|
||||
return self.filterVisByName(vizName)
|
||||
.then(function () {
|
||||
return common.sleep(1000);
|
||||
return PageObjects.common.sleep(1000);
|
||||
})
|
||||
.then(function clickDashboardByLinkedText() {
|
||||
return self.clickVisualizationByLinkText(vizName);
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
getXAxisLabels: function getXAxisLabels() {
|
||||
getXAxisLabels() {
|
||||
return this.remote
|
||||
.setFindTimeout(defaultFindTimeout)
|
||||
.findAllByCssSelector('.x > g')
|
||||
|
@ -393,13 +396,13 @@ export default (function () {
|
|||
return Promise.all(getChartTypesPromises);
|
||||
})
|
||||
.then(function (texts) {
|
||||
// common.debug('returning types array ' + texts + ' array length =' + texts.length);
|
||||
// PageObjects.common.debug('returning types array ' + texts + ' array length =' + texts.length);
|
||||
return texts;
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
getYAxisLabels: function getYAxisLabels() {
|
||||
getYAxisLabels() {
|
||||
return this.remote
|
||||
.setFindTimeout(defaultFindTimeout)
|
||||
.findAllByCssSelector('.y > g')
|
||||
|
@ -412,17 +415,17 @@ export default (function () {
|
|||
return Promise.all(getChartTypesPromises);
|
||||
})
|
||||
.then(function (texts) {
|
||||
// common.debug('returning types array ' + texts + ' array length =' + texts.length);
|
||||
// PageObjects.common.debug('returning types array ' + texts + ' array length =' + texts.length);
|
||||
return texts;
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** This method gets the chart data and scales it based on chart height and label.
|
||||
** Returns an array of height values
|
||||
*/
|
||||
getAreaChartData: function getAreaChartData(aggregateName) {
|
||||
getAreaChartData(aggregateName) {
|
||||
|
||||
var self = this.remote;
|
||||
var chartData = [];
|
||||
|
@ -442,7 +445,7 @@ export default (function () {
|
|||
// since we're going to use the y-axis 'last' (top) label as a number to
|
||||
// scale the chart pixel data, we need to clean out commas and % marks.
|
||||
yAxisLabel = yLabel.replace(/(%|,)/g, '');
|
||||
common.debug('yAxisLabel = ' + yAxisLabel);
|
||||
PageObjects.common.debug('yAxisLabel = ' + yAxisLabel);
|
||||
return yLabel;
|
||||
})
|
||||
// 2). find and save the y-axis pixel size (the chart height)
|
||||
|
@ -454,7 +457,7 @@ export default (function () {
|
|||
})
|
||||
.then(function (chartH) {
|
||||
yAxisHeight = chartH;
|
||||
common.debug('height --------- ' + yAxisHeight);
|
||||
PageObjects.common.debug('height --------- ' + yAxisHeight);
|
||||
})
|
||||
.then(function () {
|
||||
return self.setFindTimeout(defaultFindTimeout * 2)
|
||||
|
@ -462,25 +465,25 @@ export default (function () {
|
|||
.getAttribute('d');
|
||||
})
|
||||
.then(function (data) {
|
||||
common.debug(data);
|
||||
PageObjects.common.debug(data);
|
||||
// This area chart data starts with a 'M'ove to a x,y location, followed
|
||||
// by a bunch of 'L'ines from that point to the next. Those points are
|
||||
// the values we're going to use to calculate the data values we're testing.
|
||||
// So git rid of the one 'M' and split the rest on the 'L's.
|
||||
tempArray = data.replace('M','').split('L');
|
||||
chartSections = tempArray.length / 2;
|
||||
common.debug('chartSections = ' + chartSections + ' height = ' + yAxisHeight + ' yAxisLabel = ' + yAxisLabel);
|
||||
PageObjects.common.debug('chartSections = ' + chartSections + ' height = ' + yAxisHeight + ' yAxisLabel = ' + yAxisLabel);
|
||||
for (var i = 0; i < chartSections; i++) {
|
||||
chartData[i] = Math.round((yAxisHeight - tempArray[i].split(',')[1]) / yAxisHeight * yAxisLabel);
|
||||
common.debug('chartData[i] =' + chartData[i]);
|
||||
PageObjects.common.debug('chartData[i] =' + chartData[i]);
|
||||
}
|
||||
return chartData;
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
// The current test shows dots, not a line. This function gets the dots and normalizes their height.
|
||||
getLineChartData: function getLineChartData(cssPart) {
|
||||
getLineChartData(cssPart) {
|
||||
var self = this.remote;
|
||||
var yAxisLabel = 0;
|
||||
var yAxisHeight;
|
||||
|
@ -492,7 +495,7 @@ export default (function () {
|
|||
.getVisibleText()
|
||||
.then(function (yLabel) {
|
||||
yAxisLabel = yLabel.replace(',', '');
|
||||
common.debug('yAxisLabel = ' + yAxisLabel);
|
||||
PageObjects.common.debug('yAxisLabel = ' + yAxisLabel);
|
||||
return yLabel;
|
||||
})
|
||||
// 2). find and save the y-axis pixel size (the chart height)
|
||||
|
@ -503,7 +506,7 @@ export default (function () {
|
|||
.getAttribute('height')
|
||||
.then(function (theHeight) {
|
||||
yAxisHeight = theHeight - 5; // MAGIC NUMBER - clipPath extends a bit above the top of the y-axis and below x-axis
|
||||
common.debug('theHeight = ' + theHeight);
|
||||
PageObjects.common.debug('theHeight = ' + theHeight);
|
||||
return theHeight;
|
||||
});
|
||||
})
|
||||
|
@ -519,12 +522,12 @@ export default (function () {
|
|||
return chart
|
||||
.findByCssSelector('circle[fill="#6eadc1"]')
|
||||
.then(function (circleObject) {
|
||||
// common.debug('circleObject = ' + circleObject + ' yAxisHeight= ' + yAxisHeight + ' yAxisLabel= ' + yAxisLabel);
|
||||
// PageObjects.common.debug('circleObject = ' + circleObject + ' yAxisHeight= ' + yAxisHeight + ' yAxisLabel= ' + yAxisLabel);
|
||||
return circleObject
|
||||
.getAttribute('cy');
|
||||
})
|
||||
.then(function (cy) {
|
||||
// common.debug(' yAxisHeight=' + yAxisHeight + ' yAxisLabel=' + yAxisLabel + ' cy=' + cy +
|
||||
// PageObjects.common.debug(' yAxisHeight=' + yAxisHeight + ' yAxisLabel=' + yAxisLabel + ' cy=' + cy +
|
||||
// ' ((yAxisHeight - cy)/yAxisHeight * yAxisLabel)=' + ((yAxisHeight - cy) / yAxisHeight * yAxisLabel));
|
||||
return Math.round((yAxisHeight - cy) / yAxisHeight * yAxisLabel);
|
||||
});
|
||||
|
@ -539,11 +542,11 @@ export default (function () {
|
|||
.then(function (yCoords) {
|
||||
return yCoords;
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
// this is ALMOST identical to DiscoverPage.getBarChartData
|
||||
getBarChartData: function getBarChartData() {
|
||||
getBarChartData() {
|
||||
var self = this.remote;
|
||||
var yAxisLabel = 0;
|
||||
var yAxisHeight;
|
||||
|
@ -557,7 +560,7 @@ export default (function () {
|
|||
.getVisibleText()
|
||||
.then(function (yLabel) {
|
||||
yAxisLabel = yLabel.replace(',', '');
|
||||
common.debug('yAxisLabel = ' + yAxisLabel);
|
||||
PageObjects.common.debug('yAxisLabel = ' + yAxisLabel);
|
||||
return yLabel;
|
||||
});
|
||||
})
|
||||
|
@ -571,7 +574,7 @@ export default (function () {
|
|||
.getAttribute('height')
|
||||
.then(function (theHeight) {
|
||||
yAxisHeight = theHeight; // - 5; // MAGIC NUMBER - clipPath extends a bit above the top of the y-axis and below x-axis
|
||||
common.debug('theHeight = ' + theHeight);
|
||||
PageObjects.common.debug('theHeight = ' + theHeight);
|
||||
return theHeight;
|
||||
});
|
||||
});
|
||||
|
@ -604,9 +607,9 @@ export default (function () {
|
|||
return bars;
|
||||
});
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
getPieChartData: function getPieChartData() {
|
||||
getPieChartData() {
|
||||
var self = this.remote;
|
||||
|
||||
// 1). get the maximim chart Y-Axis marker value
|
||||
|
@ -626,48 +629,48 @@ export default (function () {
|
|||
return Promise.all(getChartTypesPromises);
|
||||
})
|
||||
.then(function (slices) {
|
||||
common.debug('slices=' + slices);
|
||||
PageObjects.common.debug('slices=' + slices);
|
||||
return slices;
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
getChartAreaWidth: function getChartAreaWidth() {
|
||||
getChartAreaWidth() {
|
||||
return this.remote
|
||||
.setFindTimeout(defaultFindTimeout)
|
||||
.findByCssSelector('clipPath rect')
|
||||
.getAttribute('width');
|
||||
},
|
||||
getChartAreaHeight: function getChartAreaHeight() {
|
||||
}
|
||||
getChartAreaHeight() {
|
||||
return this.remote
|
||||
.setFindTimeout(defaultFindTimeout)
|
||||
.findByCssSelector('clipPath rect')
|
||||
.getAttribute('height');
|
||||
},
|
||||
}
|
||||
|
||||
getDataTableData: function getDataTableData() {
|
||||
getDataTableData() {
|
||||
return this.remote
|
||||
.setFindTimeout(defaultFindTimeout * 2)
|
||||
.findByCssSelector('table.table.table-condensed tbody')
|
||||
.getVisibleText();
|
||||
},
|
||||
}
|
||||
|
||||
getMarkdownData: function getMarkdownData() {
|
||||
getMarkdownData() {
|
||||
return this.remote
|
||||
.setFindTimeout(defaultFindTimeout)
|
||||
.findByCssSelector('visualize.ng-isolate-scope')
|
||||
.getVisibleText();
|
||||
},
|
||||
}
|
||||
|
||||
clickColumns: function clickColumns() {
|
||||
clickColumns() {
|
||||
return this.remote
|
||||
.setFindTimeout(defaultFindTimeout)
|
||||
.findByCssSelector('div.schemaEditors.ng-scope > div > div > button:nth-child(2)')
|
||||
.click();
|
||||
},
|
||||
}
|
||||
|
||||
waitForToastMessageGone: function waitForToastMessageGone() {
|
||||
waitForToastMessageGone() {
|
||||
var self = this;
|
||||
return common.try(function tryingForTime() {
|
||||
return PageObjects.common.try(function tryingForTime() {
|
||||
return self.remote
|
||||
.setFindTimeout(100)
|
||||
.findAllByCssSelector('kbn-truncated.toast-message.ng-isolate-scope')
|
||||
|
@ -675,20 +678,17 @@ export default (function () {
|
|||
if (messages.length > 0) {
|
||||
throw new Error('waiting for toast message to clear');
|
||||
} else {
|
||||
common.debug('now messages = 0 "' + messages + '"');
|
||||
PageObjects.common.debug('now messages = 0 "' + messages + '"');
|
||||
return messages;
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
waitForVisualization: function waitForVisualization() {
|
||||
waitForVisualization() {
|
||||
return this.remote
|
||||
.setFindTimeout(defaultFindTimeout)
|
||||
.findByCssSelector('visualize-legend');
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
return VisualizePage;
|
||||
}());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue