Convert all page objects to be ES6 classes and rely on PageObjects module instead of support.

This commit is contained in:
CJ Cenizal 2016-06-27 17:22:47 -07:00
parent 0f397f2bc4
commit 91e919d1c5
8 changed files with 1317 additions and 1349 deletions

View file

@ -1,3 +1,4 @@
import bluebird, { import bluebird, {
promisify promisify
} from 'bluebird'; } from 'bluebird';

View file

@ -1,38 +1,33 @@
import { remote, defaultFindTimeout } from '../';
// in test/support/pages/shield_page.js import {
export default (function (require) { defaultFindTimeout,
// the page object is created as a constructor } from '../';
// so we can provide the remote Command object
// at runtime
var thisTime;
function ConsolePage() { export default class ConsolePage {
constructor() {
} }
ConsolePage.prototype = {
constructor: ConsolePage,
init(remote) { init(remote) {
this.remote = remote; this.remote = remote;
thisTime = this.remote.setFindTimeout(defaultFindTimeout); this.findTimeout = this.remote.setFindTimeout(defaultFindTimeout);
}, }
getServer: function getServer() { getServer() {
return thisTime return this.findTimeout
.findByCssSelector('#kibana-body > div.content > div > div') .findByCssSelector('#kibana-body > div.content > div > div')
.getVisibleText(); .getVisibleText();
}, }
setServer: function setServer(server) { setServer(server) {
return thisTime return this.findTimeout
.findByCssSelector('input[aria-label="Server Name"]') .findByCssSelector('input[aria-label="Server Name"]')
.clearValue() .clearValue()
.type(server); .type(server);
}, }
getRequest: function getRequest() { getRequest() {
return thisTime return this.findTimeout
.findAllByCssSelector('div.ace_line_group') .findAllByCssSelector('div.ace_line_group')
.then(function (editorData) { .then(function (editorData) {
@ -43,29 +38,25 @@ export default (function (require) {
var getEditorDataPromises = editorData.map(getEditorData); var getEditorDataPromises = editorData.map(getEditorData);
return Promise.all(getEditorDataPromises); return Promise.all(getEditorDataPromises);
}); });
}, }
getResponse: function getResponse() { getResponse() {
return thisTime return this.findTimeout
.findByCssSelector('#output > div.ace_scroller > div') .findByCssSelector('#output > div.ace_scroller > div')
.getVisibleText(); .getVisibleText();
}, }
clickPlay: function clickPlay() { clickPlay() {
return thisTime return this.findTimeout
.findByCssSelector('#editor_actions > span.ng-scope > a > i') .findByCssSelector('#editor_actions > span.ng-scope > a > i')
.click(); .click();
}, }
collapseHelp: function collapseHelp() { collapseHelp() {
return thisTime return this.findTimeout
.findByCssSelector('div.config-close.remove > i') .findByCssSelector('div.config-close.remove > i')
.click(); .click();
} }
}
};
return ConsolePage;
}());

View file

@ -1,163 +1,161 @@
import { remote, common, defaultFindTimeout, headerPage } from '../';
export default (function () { import {
var thisTime; defaultFindTimeout,
} from '../';
function DashboardPage() { import PageObjects from './';
export default class DashboardPage {
constructor() {
} }
DashboardPage.prototype = {
constructor: DashboardPage,
init(remote) { init(remote) {
this.remote = remote; this.remote = remote;
thisTime = this.remote.setFindTimeout(defaultFindTimeout); this.findTimeout = this.remote.setFindTimeout(defaultFindTimeout);
}, }
clickNewDashboard: function clickNewDashboard() { clickNewDashboard() {
return thisTime return this.findTimeout
.findByCssSelector('button.ng-scope[aria-label="New Dashboard"]') .findByCssSelector('button.ng-scope[aria-label="New Dashboard"]')
.click(); .click();
}, }
clickAddVisualization: function clickAddVisualization() { clickAddVisualization() {
return thisTime return this.findTimeout
.findByCssSelector('button.ng-scope[aria-label="Add a panel to the dashboard"]') .findByCssSelector('button.ng-scope[aria-label="Add a panel to the dashboard"]')
.click(); .click();
}, }
filterVizNames: function filterVizNames(vizName) { filterVizNames(vizName) {
return thisTime return this.findTimeout
.findByCssSelector('input[placeholder="Visualizations Filter..."]') .findByCssSelector('input[placeholder="Visualizations Filter..."]')
.click() .click()
.pressKeys(vizName); .pressKeys(vizName);
}, }
clickVizNameLink: function clickVizNameLink(vizName) { clickVizNameLink(vizName) {
return thisTime return this.findTimeout
.findByLinkText(vizName) .findByLinkText(vizName)
.click(); .click();
}, }
closeAddVizualizationPanel: function closeAddVizualizationPanel() { closeAddVizualizationPanel() {
common.debug('-------------close panel'); PageObjects.common.debug('-------------close panel');
return thisTime return this.findTimeout
.findByCssSelector('i.fa fa-chevron-up') .findByCssSelector('i.fa fa-chevron-up')
.click(); .click();
}, }
addVisualization: function addVisualization(vizName) { addVisualization(vizName) {
var self = this;
return this.clickAddVisualization() return this.clickAddVisualization()
.then(function () { .then(() => {
common.debug('filter visualization (' + vizName + ')'); PageObjects.common.debug('filter visualization (' + vizName + ')');
return self.filterVizNames(vizName); return this.filterVizNames(vizName);
}) })
// this second wait is usually enough to avoid the // this second wait is usually enough to avoid the
// 'stale element reference: element is not attached to the page document' // 'stale element reference: element is not attached to the page document'
// on the next step // on the next step
.then(function () { .then(() => {
return common.sleep(1000); return PageObjects.common.sleep(1000);
}) })
.then(function () { .then(() => {
// but wrap in a try loop since it can still happen // but wrap in a try loop since it can still happen
return common.try(function () { return PageObjects.common.try(() => {
common.debug('click visualization (' + vizName + ')'); PageObjects.common.debug('click visualization (' + vizName + ')');
return self.clickVizNameLink(vizName); return this.clickVizNameLink(vizName);
}); });
}) })
// this second click of 'Add' collapses the Add Visualization pane // this second click of 'Add' collapses the Add Visualization pane
.then(function () { .then(() => {
return self.clickAddVisualization(); return this.clickAddVisualization();
}); });
}, }
saveDashboard: function saveDashboard(dashName) { saveDashboard(dashName) {
var self = this; return this.findTimeout
return thisTime
.findByCssSelector('button.ng-scope[aria-label="Save Dashboard"]') .findByCssSelector('button.ng-scope[aria-label="Save Dashboard"]')
.click() .click()
.then(function () { .then(() => {
return headerPage.getSpinnerDone(); return PageObjects.header.getSpinnerDone();
}) })
.then(function () { .then(() => {
return common.sleep(1000); return PageObjects.common.sleep(1000);
}) })
.then(function () { .then(() => {
common.debug('saveButton button clicked'); PageObjects.common.debug('saveButton button clicked');
return thisTime return this.findTimeout
.findById('dashboardTitle') .findById('dashboardTitle')
.type(dashName); .type(dashName);
}) })
.then(function () { .then(() => {
return headerPage.getSpinnerDone(); return PageObjects.header.getSpinnerDone();
}) })
.then(function () { .then(() => {
return common.sleep(1000); return PageObjects.common.sleep(1000);
}) })
// click save button // click save button
.then(function () { .then(() => {
return common.try(function () { return PageObjects.common.try(() => {
common.debug('clicking final Save button for named dashboard'); PageObjects.common.debug('clicking final Save button for named dashboard');
return thisTime return this.findTimeout
.findByCssSelector('.btn-primary') .findByCssSelector('.btn-primary')
.click(); .click();
}); });
}) })
.then(function () { .then(() => {
return headerPage.getSpinnerDone(); return PageObjects.header.getSpinnerDone();
}) })
// verify that green message at the top of the page. // verify that green message at the top of the page.
// it's only there for about 5 seconds // it's only there for about 5 seconds
.then(function () { .then(() => {
return common.try(function () { return PageObjects.common.try(() => {
common.debug('verify toast-message for saved dashboard'); PageObjects.common.debug('verify toast-message for saved dashboard');
return thisTime return this.findTimeout
.findByCssSelector('kbn-truncated.toast-message.ng-isolate-scope') .findByCssSelector('kbn-truncated.toast-message.ng-isolate-scope')
.getVisibleText(); .getVisibleText();
}); });
}); });
}, }
clickDashboardByLinkText: function clickDashboardByLinkText(dashName) { clickDashboardByLinkText(dashName) {
return thisTime return this.findTimeout
.findByLinkText(dashName) .findByLinkText(dashName)
.click(); .click();
}, }
// use the search filter box to narrow the results down to a single // use the search filter box to narrow the results down to a single
// entry, or at least to a single page of results // entry, or at least to a single page of results
loadSavedDashboard: function loadSavedDashboard(dashName) { loadSavedDashboard(dashName) {
var self = this; var self = this;
return thisTime return this.findTimeout
.findByCssSelector('button.ng-scope[aria-label="Load Saved Dashboard"]') .findByCssSelector('button.ng-scope[aria-label="Load Saved Dashboard"]')
.click() .click()
.then(function filterDashboard() { .then(function filterDashboard() {
common.debug('Load Saved Dashboard button clicked'); PageObjects.common.debug('Load Saved Dashboard button clicked');
return self.remote return self.remote
.findByCssSelector('input[name="filter"]') .findByCssSelector('input[name="filter"]')
.click() .click()
.type(dashName.replace('-',' ')); .type(dashName.replace('-',' '));
}) })
.then(function () { .then(() => {
return headerPage.getSpinnerDone(); return PageObjects.header.getSpinnerDone();
}) })
.then(function () { .then(() => {
return common.sleep(1000); return PageObjects.common.sleep(1000);
}) })
.then(function clickDashboardByLinkedText() { .then(function clickDashboardByLinkedText() {
return self return self
.clickDashboardByLinkText(dashName); .clickDashboardByLinkText(dashName);
}) })
.then(function () { .then(() => {
return headerPage.getSpinnerDone(); return PageObjects.header.getSpinnerDone();
}); });
}, }
getPanelTitles() {
getPanelTitles: function getPanelTitles() { PageObjects.common.debug('in getPanelTitles');
common.debug('in getPanelTitles'); return this.findTimeout
return thisTime
.findAllByCssSelector('span.panel-title') .findAllByCssSelector('span.panel-title')
.then(function (titleObjects) { .then(function (titleObjects) {
@ -168,48 +166,48 @@ export default (function () {
var getTitlePromises = titleObjects.map(getTitles); var getTitlePromises = titleObjects.map(getTitles);
return Promise.all(getTitlePromises); return Promise.all(getTitlePromises);
}); });
}, }
getPanelData: function getPanelData() { getPanelData() {
common.debug('in getPanelData'); PageObjects.common.debug('in getPanelData');
return thisTime return this.findTimeout
.findAllByCssSelector('li.gs-w') .findAllByCssSelector('li.gs-w')
.then(function (titleObjects) { .then(function (titleObjects) {
function getTitles(chart) { function getTitles(chart) {
var obj = {}; var obj = {};
return chart.getAttribute('data-col') return chart.getAttribute('data-col')
.then(function (theData) { .then(theData => {
obj = {dataCol:theData}; obj = {dataCol:theData};
return chart; return chart;
}) })
.then(function (chart) { .then(chart => {
return chart.getAttribute('data-row') return chart.getAttribute('data-row')
.then(function (theData) { .then(theData => {
obj.dataRow = theData; obj.dataRow = theData;
return chart; return chart;
}); });
}) })
.then(function (chart) { .then(chart => {
return chart.getAttribute('data-sizex') return chart.getAttribute('data-sizex')
.then(function (theData) { .then(theData => {
obj.dataSizeX = theData; obj.dataSizeX = theData;
return chart; return chart;
}); });
}) })
.then(function (chart) { .then(chart => {
return chart.getAttribute('data-sizey') return chart.getAttribute('data-sizey')
.then(function (theData) { .then(theData => {
obj.dataSizeY = theData; obj.dataSizeY = theData;
return chart; return chart;
}); });
}) })
.then(function (chart) { .then(chart => {
return chart.findByCssSelector('span.panel-title') return chart.findByCssSelector('span.panel-title')
.then(function (titleElement) { .then(function (titleElement) {
return titleElement.getAttribute('title'); return titleElement.getAttribute('title');
}) })
.then(function (theData) { .then(theData => {
obj.title = theData; obj.title = theData;
return obj; return obj;
}); });
@ -221,7 +219,4 @@ export default (function () {
}); });
} }
}; }
return DashboardPage;
}());

View file

@ -1,38 +1,38 @@
import Common from './common.js'; import {
import { defaultFindTimeout } from '../'; defaultFindTimeout
} from '../';
let thisTime; import PageObjects from './';
export default class DiscoverPage extends Common { export default class DiscoverPage {
constructor() { constructor() {
super();
} }
init(remote) { init(remote) {
super.init(remote); this.remote = remote;
thisTime = this.remote.setFindTimeout(defaultFindTimeout); this.findTimeout = this.remote.setFindTimeout(defaultFindTimeout);
} }
getQueryField() { getQueryField() {
return thisTime return this.findTimeout
.findByCssSelector('input[ng-model=\'state.query\']'); .findByCssSelector('input[ng-model=\'state.query\']');
} }
getQuerySearchButton() { getQuerySearchButton() {
return thisTime return this.findTimeout
.findByCssSelector('button[aria-label=\'Search\']'); .findByCssSelector('button[aria-label=\'Search\']');
} }
getTimespanText() { getTimespanText() {
return thisTime return this.findTimeout
.findByCssSelector('.kibana-nav-options .navbar-timepicker-time-desc pretty-duration') .findByCssSelector('.kibana-nav-options .navbar-timepicker-time-desc pretty-duration')
.getVisibleText(); .getVisibleText();
} }
getChartTimespan() { getChartTimespan() {
return thisTime return this.findTimeout
.findByCssSelector('center.small > span:nth-child(1)') .findByCssSelector('center.small > span:nth-child(1)')
.getVisibleText(); .getVisibleText();
} }
@ -40,50 +40,49 @@ export default class DiscoverPage extends Common {
saveSearch(searchName) { saveSearch(searchName) {
return this.clickSaveSearchButton() return this.clickSaveSearchButton()
.then(() => { .then(() => {
this.debug('--saveSearch button clicked'); PageObjects.common.debug('--saveSearch button clicked');
return thisTime.findDisplayedById('SaveSearch') return this.findTimeout.findDisplayedById('SaveSearch')
.pressKeys(searchName); .pressKeys(searchName);
}) })
.then(() => { .then(() => {
this.debug('--find save button'); PageObjects.common.debug('--find save button');
return this.findTestSubject('discover-save-search-btn').click(); return PageObjects.common.findTestSubject('discover-save-search-btn').click();
}); });
} }
loadSavedSearch(searchName) { loadSavedSearch(searchName) {
var self = this; return this.clickLoadSavedSearchButton()
return self.clickLoadSavedSearchButton() .then(() => {
.then(function () { this.findTimeout.findByLinkText(searchName).click();
thisTime.findByLinkText(searchName).click();
}); });
} }
clickNewSearchButton() { clickNewSearchButton() {
return thisTime return this.findTimeout
.findByCssSelector('button[aria-label="New Search"]') .findByCssSelector('button[aria-label="New Search"]')
.click(); .click();
} }
clickSaveSearchButton() { clickSaveSearchButton() {
return thisTime return this.findTimeout
.findByCssSelector('button[aria-label="Save Search"]') .findByCssSelector('button[aria-label="Save Search"]')
.click(); .click();
} }
clickLoadSavedSearchButton() { clickLoadSavedSearchButton() {
return thisTime return this.findTimeout
.findDisplayedByCssSelector('button[aria-label="Load Saved Search"]') .findDisplayedByCssSelector('button[aria-label="Load Saved Search"]')
.click(); .click();
} }
getCurrentQueryName() { getCurrentQueryName() {
return thisTime return this.findTimeout
.findByCssSelector('span.kibana-nav-info-title span') .findByCssSelector('span.kibana-nav-info-title span')
.getVisibleText(); .getVisibleText();
} }
getBarChartData() { getBarChartData() {
return thisTime return this.findTimeout
.findAllByCssSelector('rect[data-label="Count"]') .findAllByCssSelector('rect[data-label="Count"]')
.then(function (chartData) { .then(function (chartData) {
@ -101,18 +100,18 @@ export default class DiscoverPage extends Common {
} }
getChartInterval() { getChartInterval() {
return thisTime return this.findTimeout
.findByCssSelector('a[ng-click="toggleInterval()"]') .findByCssSelector('a[ng-click="toggleInterval()"]')
.getVisibleText() .getVisibleText()
.then(function (intervalText) { .then(intervalText => {
if (intervalText.length > 0) { if (intervalText.length > 0) {
return intervalText; return intervalText;
} else { } else {
return thisTime return this.findTimeout
.findByCssSelector('select[ng-model="state.interval"]') .findByCssSelector('select[ng-model="state.interval"]')
.getProperty('value') // this gets 'string:d' for Daily .getProperty('value') // this gets 'string:d' for Daily
.then(function (selectedValue) { .then(selectedValue => {
return thisTime return this.findTimeout
.findByCssSelector('option[value="' + selectedValue + '"]') .findByCssSelector('option[value="' + selectedValue + '"]')
.getVisibleText(); .getVisibleText();
}); });
@ -124,121 +123,120 @@ export default class DiscoverPage extends Common {
return this.remote.setFindTimeout(5000) return this.remote.setFindTimeout(5000)
.findByCssSelector('a[ng-click="toggleInterval()"]') .findByCssSelector('a[ng-click="toggleInterval()"]')
.click() .click()
.catch(function () { .catch(() => {
// in some cases we have the link above, but after we've made a // in some cases we have the link above, but after we've made a
// selection we just have a select list. // selection we just have a select list.
}) })
.then(function () { .then(() => {
return thisTime return this.findTimeout
.findByCssSelector('option[label="' + interval + '"]') .findByCssSelector('option[label="' + interval + '"]')
.click(); .click();
}); });
} }
getHitCount() { getHitCount() {
return thisTime return this.findTimeout
.findByCssSelector('strong.discover-info-hits') .findByCssSelector('strong.discover-info-hits')
.getVisibleText(); .getVisibleText();
} }
query(queryString) { query(queryString) {
return thisTime return this.findTimeout
.findByCssSelector('input[aria-label="Search input"]') .findByCssSelector('input[aria-label="Search input"]')
.clearValue() .clearValue()
.type(queryString) .type(queryString)
.then(function () { .then(() => {
return thisTime return this.findTimeout
.findByCssSelector('button[aria-label="Search"]') .findByCssSelector('button[aria-label="Search"]')
.click(); .click();
}); });
} }
getDocHeader() { getDocHeader() {
return thisTime return this.findTimeout
.findByCssSelector('thead.ng-isolate-scope > tr:nth-child(1)') .findByCssSelector('thead.ng-isolate-scope > tr:nth-child(1)')
.getVisibleText(); .getVisibleText();
} }
getDocTableIndex(index) { getDocTableIndex(index) {
return thisTime return this.findTimeout
.findByCssSelector('tr.discover-table-row:nth-child(' + (index) + ')') .findByCssSelector('tr.discover-table-row:nth-child(' + (index) + ')')
.getVisibleText(); .getVisibleText();
} }
clickDocSortDown() { clickDocSortDown() {
return thisTime return this.findTimeout
.findByCssSelector('.fa-sort-down') .findByCssSelector('.fa-sort-down')
.click(); .click();
} }
clickDocSortUp() { clickDocSortUp() {
return thisTime return this.findTimeout
.findByCssSelector('.fa-sort-up') .findByCssSelector('.fa-sort-up')
.click(); .click();
} }
getMarks() { getMarks() {
return thisTime return this.findTimeout
.findAllByCssSelector('mark') .findAllByCssSelector('mark')
.getVisibleText(); .getVisibleText();
} }
clickShare() { clickShare() {
return thisTime return this.findTimeout
.findByCssSelector('button[aria-label="Share Search"]') .findByCssSelector('button[aria-label="Share Search"]')
.click(); .click();
} }
clickShortenUrl() { clickShortenUrl() {
return thisTime return this.findTimeout
.findByCssSelector('button.shorten-button') .findByCssSelector('button.shorten-button')
.click(); .click();
} }
clickCopyToClipboard() { clickCopyToClipboard() {
return thisTime return this.findTimeout
.findDisplayedByCssSelector('button.clipboard-button') .findDisplayedByCssSelector('button.clipboard-button')
.click(); .click();
} }
getShareCaption() { getShareCaption() {
return thisTime return this.findTimeout
.findByCssSelector('.vis-share label') .findByCssSelector('.vis-share label')
.getVisibleText(); .getVisibleText();
} }
getSharedUrl() { getSharedUrl() {
return thisTime return this.findTimeout
.findByCssSelector('.url') .findByCssSelector('.url')
.getProperty('value'); .getProperty('value');
} }
getShortenedUrl() { getShortenedUrl() {
return thisTime return this.findTimeout
.findByCssSelector('.url') .findByCssSelector('.url')
.getProperty('value'); .getProperty('value');
} }
toggleSidebarCollapse() { toggleSidebarCollapse() {
return thisTime.findDisplayedByCssSelector('.sidebar-collapser .chevron-cont') return this.findTimeout.findDisplayedByCssSelector('.sidebar-collapser .chevron-cont')
.click(); .click();
} }
getSidebarWidth() { getSidebarWidth() {
return thisTime return this.findTimeout
.findByClassName('sidebar-list') .findByClassName('sidebar-list')
.getProperty('clientWidth'); .getProperty('clientWidth');
} }
hasNoResults() { hasNoResults() {
return this return PageObjects.common.findTestSubject('discoverNoResults')
.findTestSubject('discoverNoResults')
.then(() => true) .then(() => true)
.catch(() => false); .catch(() => false);
} }
getNoResultsTimepicker() { getNoResultsTimepicker() {
return this.findTestSubject('discoverNoResultsTimefilter'); return PageObjects.common.findTestSubject('discoverNoResultsTimefilter');
} }
hasNoResultsTimepicker() { hasNoResultsTimepicker() {

View file

@ -1,50 +1,50 @@
import Common from './common.js'; import {
import { defaultFindTimeout } from '../'; defaultFindTimeout
} from '../';
export default class HeaderPage extends Common { import PageObjects from './';
export default class HeaderPage {
constructor() { constructor() {
super();
} }
init(remote) { init(remote) {
super.init(remote); this.remote = remote;
} }
clickSelector(selector) { clickSelector(selector) {
var self = this; return this.try(() => {
return this.try(function () { return this.remote.setFindTimeout(defaultFindTimeout)
return self.remote.setFindTimeout(defaultFindTimeout)
.findByCssSelector(selector) .findByCssSelector(selector)
.then(function (tab) { .then(tab => {
return tab.click(); return tab.click();
}); });
}); });
} }
clickDiscover() { clickDiscover() {
this.debug('click Discover tab'); PageObjects.common.debug('click Discover tab');
this.clickSelector('a[href*=\'discover\']'); this.clickSelector('a[href*=\'discover\']');
} }
clickVisualize() { clickVisualize() {
this.debug('click Visualize tab'); PageObjects.common.debug('click Visualize tab');
this.clickSelector('a[href*=\'visualize\']'); this.clickSelector('a[href*=\'visualize\']');
} }
clickDashboard() { clickDashboard() {
this.debug('click Dashboard tab'); PageObjects.common.debug('click Dashboard tab');
this.clickSelector('a[href*=\'dashboard\']'); this.clickSelector('a[href*=\'dashboard\']');
} }
clickSettings() { clickSettings() {
this.debug('click Settings tab'); PageObjects.common.debug('click Settings tab');
this.clickSelector('a[href*=\'settings\']'); this.clickSelector('a[href*=\'settings\']');
} }
clickTimepicker() { clickTimepicker() {
var self = this;
return this.remote.setFindTimeout(defaultFindTimeout) return this.remote.setFindTimeout(defaultFindTimeout)
.findDisplayedByClassName('navbar-timepicker-time-desc').click(); .findDisplayedByClassName('navbar-timepicker-time-desc').click();
} }
@ -57,7 +57,6 @@ export default class HeaderPage extends Common {
} }
clickAbsoluteButton() { clickAbsoluteButton() {
var self = this;
return this.remote.setFindTimeout(defaultFindTimeout) return this.remote.setFindTimeout(defaultFindTimeout)
.findByLinkText('Absolute').click(); .findByLinkText('Absolute').click();
} }
@ -86,20 +85,19 @@ export default class HeaderPage extends Common {
}); });
} }
setAbsoluteRange(fromTime, toTime) { setAbsoluteRange(fromTime, toTime) {
this.debug('clickTimepicker'); PageObjects.common.debug('clickTimepicker');
return this.clickTimepicker() return this.clickTimepicker()
.then(() => { .then(() => {
this.debug('--Clicking Absolute button'); PageObjects.common.debug('--Clicking Absolute button');
return this.clickAbsoluteButton(); return this.clickAbsoluteButton();
}) })
.then(() => { .then(() => {
this.debug('--Setting From Time : ' + fromTime); PageObjects.common.debug('--Setting From Time : ' + fromTime);
return this.setFromTime(fromTime); return this.setFromTime(fromTime);
}) })
.then(() => { .then(() => {
this.debug('--Setting To Time : ' + toTime); PageObjects.common.debug('--Setting To Time : ' + toTime);
return this.setToTime(toTime); return this.setToTime(toTime);
}) })
.then(() => { .then(() => {
@ -114,7 +112,6 @@ export default class HeaderPage extends Common {
} }
collapseTimepicker() { collapseTimepicker() {
var self = this;
return this.remote.setFindTimeout(defaultFindTimeout) return this.remote.setFindTimeout(defaultFindTimeout)
.findByCssSelector('.fa.fa-chevron-circle-up') .findByCssSelector('.fa.fa-chevron-circle-up')
.click(); .click();
@ -127,22 +124,18 @@ export default class HeaderPage extends Common {
} }
waitForToastMessageGone() { waitForToastMessageGone() {
var self = this; return this.remote.setFindTimeout(defaultFindTimeout)
return self.remote.setFindTimeout(defaultFindTimeout)
.waitForDeletedByCssSelector('kbn-truncated.toast-message'); .waitForDeletedByCssSelector('kbn-truncated.toast-message');
} }
clickToastOK() { clickToastOK() {
return this.remote return this.remote.setFindTimeout(defaultFindTimeout)
.setFindTimeout(defaultFindTimeout)
.findByCssSelector('button[ng-if="notif.accept"]') .findByCssSelector('button[ng-if="notif.accept"]')
.click(); .click();
} }
getSpinnerDone() { getSpinnerDone() {
var self = this; return this.remote.setFindTimeout(defaultFindTimeout * 10)
return this.remote
.setFindTimeout(defaultFindTimeout * 10)
.findByCssSelector('.spinner.ng-hide'); .findByCssSelector('.spinner.ng-hide');
} }

View file

@ -1,168 +1,170 @@
import Bluebird from 'bluebird'; import Bluebird from 'bluebird';
import { common, remote, defaultFindTimeout, headerPage } from '../';
export default (function () { import {
function SettingsPage() { defaultFindTimeout,
} from '../';
import PageObjects from './';
export default class SettingsPage {
constructor() {
} }
SettingsPage.prototype = {
constructor: SettingsPage,
init(remote) { init(remote) {
this.remote = remote; this.remote = remote;
}, }
clickNavigation: function () { clickNavigation() {
// TODO: find better way to target the element // TODO: find better way to target the element
return this.remote.findDisplayedByCssSelector('.app-link:nth-child(5) a').click(); return this.remote.findDisplayedByCssSelector('.app-link:nth-child(5) a').click();
}, }
clickLinkText: function (text) { clickLinkText(text) {
return this.remote.findDisplayedByLinkText(text).click(); return this.remote.findDisplayedByLinkText(text).click();
}, }
clickKibanaSettings: function () { clickKibanaSettings() {
return this.clickLinkText('Advanced Settings'); return this.clickLinkText('Advanced Settings');
}, }
clickKibanaIndicies: function () { clickKibanaIndicies() {
return this.clickLinkText('Index Patterns'); return this.clickLinkText('Index Patterns');
}, }
clickExistingData: function () { clickExistingData() {
return this.clickLinkText('Existing Data'); return this.clickLinkText('Existing Data');
}, }
getAdvancedSettings: function getAdvancedSettings(propertyName) { getAdvancedSettings(propertyName) {
common.debug('in setAdvancedSettings'); PageObjects.common.debug('in setAdvancedSettings');
return common.findTestSubject('advancedSetting&' + propertyName + ' currentValue') return PageObjects.common.findTestSubject('advancedSetting&' + propertyName + ' currentValue')
.getVisibleText(); .getVisibleText();
}, }
setAdvancedSettings: function setAdvancedSettings(propertyName, propertyValue) { setAdvancedSettings(propertyName, propertyValue) {
var self = this; var self = this;
return common.findTestSubject('advancedSetting&' + propertyName + ' editButton') return PageObjects.common.findTestSubject('advancedSetting&' + propertyName + ' editButton')
.click() .click()
.then(function () { .then(() => {
return headerPage.getSpinnerDone(); return PageObjects.header.getSpinnerDone();
}) })
.then(function () { .then(() => {
return common.sleep(1000); return PageObjects.common.sleep(1000);
}) })
.then(function setAdvancedSettingsClickPropertyValue(selectList) { .then(function setAdvancedSettingsClickPropertyValue(selectList) {
return self.remote.setFindTimeout(defaultFindTimeout) return self.remote.setFindTimeout(defaultFindTimeout)
.findByCssSelector('option[label="' + propertyValue + '"]') .findByCssSelector('option[label="' + propertyValue + '"]')
.click(); .click();
}) })
.then(function () { .then(() => {
return headerPage.getSpinnerDone(); return PageObjects.header.getSpinnerDone();
}) })
.then(function setAdvancedSettingsClickSaveButton() { .then(function setAdvancedSettingsClickSaveButton() {
return common.findTestSubject('advancedSetting&' + propertyName + ' saveButton') return PageObjects.common.findTestSubject('advancedSetting&' + propertyName + ' saveButton')
.click(); .click();
}) })
.then(function () { .then(() => {
return headerPage.getSpinnerDone(); return PageObjects.header.getSpinnerDone();
}); });
}, }
getAdvancedSettings: function getAdvancedSettings(propertyName) { getAdvancedSettings(propertyName) {
var self = this; var self = this;
common.debug('in setAdvancedSettings'); PageObjects.common.debug('in setAdvancedSettings');
return common.findTestSubject('advancedSetting&' + propertyName + ' currentValue') return PageObjects.common.findTestSubject('advancedSetting&' + propertyName + ' currentValue')
.getVisibleText(); .getVisibleText();
}, }
navigateTo: function () { navigateTo() {
return common.navigateToApp('settings'); return PageObjects.common.navigateToApp('settings');
}, }
getTimeBasedEventsCheckbox: function () { getTimeBasedEventsCheckbox() {
return this.remote.setFindTimeout(defaultFindTimeout) return this.remote.setFindTimeout(defaultFindTimeout)
.findByCssSelector('input[ng-model="index.isTimeBased"]'); .findByCssSelector('input[ng-model="index.isTimeBased"]');
}, }
getTimeBasedIndexPatternCheckbox: function (timeout) { getTimeBasedIndexPatternCheckbox(timeout) {
timeout = timeout || defaultFindTimeout; timeout = timeout || defaultFindTimeout;
// fail faster since we're sometimes checking that it doesn't exist // fail faster since we're sometimes checking that it doesn't exist
return this.remote.setFindTimeout(timeout) return this.remote.setFindTimeout(timeout)
.findByCssSelector('input[ng-model="index.nameIsPattern"]'); .findByCssSelector('input[ng-model="index.nameIsPattern"]');
}, }
getIndexPatternField: function () { getIndexPatternField() {
return this.remote.setFindTimeout(defaultFindTimeout) return this.remote.setFindTimeout(defaultFindTimeout)
.findByCssSelector('[ng-model="index.name"]'); .findByCssSelector('[ng-model="index.name"]');
}, }
getTimeFieldNameField: function () { getTimeFieldNameField() {
return this.remote.setFindTimeout(defaultFindTimeout) return this.remote.setFindTimeout(defaultFindTimeout)
.findDisplayedByCssSelector('select[ng-model="index.timeField"]'); .findDisplayedByCssSelector('select[ng-model="index.timeField"]');
}, }
selectTimeFieldOption: function (selection) {
var self = this;
selectTimeFieldOption(selection) {
// open dropdown // open dropdown
return self.getTimeFieldNameField().click() return this.getTimeFieldNameField().click()
.then(function () { .then(() => {
// close dropdown, keep focus // close dropdown, keep focus
return self.getTimeFieldNameField().click(); return this.getTimeFieldNameField().click();
}) })
.then(function () { .then(() => {
return headerPage.getSpinnerDone(); return PageObjects.header.getSpinnerDone();
}) })
.then(function () { .then(() => {
return common.try(function () { return PageObjects.common.try(() => {
return self.getTimeFieldOption(selection).click() return this.getTimeFieldOption(selection).click()
.then(function () { .then(() => {
return self.getTimeFieldOption(selection).isSelected(); return this.getTimeFieldOption(selection).isSelected();
}) })
.then(function (selected) { .then(selected => {
if (!selected) throw new Error('option not selected: ' + selected); if (!selected) throw new Error('option not selected: ' + selected);
}); });
}); });
}); });
}, }
getTimeFieldOption: function (selection) { getTimeFieldOption(selection) {
return this.remote.setFindTimeout(defaultFindTimeout) return this.remote.setFindTimeout(defaultFindTimeout)
.findDisplayedByCssSelector('option[label="' + selection + '"]').click(); .findDisplayedByCssSelector('option[label="' + selection + '"]').click();
}, }
getCreateButton: function () { getCreateButton() {
return this.remote.setFindTimeout(defaultFindTimeout) return this.remote.setFindTimeout(defaultFindTimeout)
.findDisplayedByCssSelector('[type="submit"]'); .findDisplayedByCssSelector('[type="submit"]');
}, }
clickDefaultIndexButton: function () { clickDefaultIndexButton() {
return this.remote.setFindTimeout(defaultFindTimeout) return this.remote.setFindTimeout(defaultFindTimeout)
.findByCssSelector('button.btn.btn-warning.ng-scope').click() .findByCssSelector('button.btn.btn-warning.ng-scope').click()
.then(function () { .then(() => {
return headerPage.getSpinnerDone(); return PageObjects.header.getSpinnerDone();
}); });
}, }
clickDeletePattern: function () { clickDeletePattern() {
return this.remote.setFindTimeout(defaultFindTimeout) return this.remote.setFindTimeout(defaultFindTimeout)
.findByCssSelector('button.btn.btn-danger.ng-scope').click(); .findByCssSelector('button.btn.btn-danger.ng-scope').click();
}, }
getIndexPageHeading: function () { getIndexPageHeading() {
return this.remote.setFindTimeout(defaultFindTimeout) return this.remote.setFindTimeout(defaultFindTimeout)
.findByCssSelector('h1.title.ng-binding.ng-isolate-scope'); .findByCssSelector('h1.title.ng-binding.ng-isolate-scope');
}, }
getConfigureHeader: function () { getConfigureHeader() {
return this.remote.setFindTimeout(defaultFindTimeout) return this.remote.setFindTimeout(defaultFindTimeout)
.findByCssSelector('h1'); .findByCssSelector('h1');
}, }
getTableHeader: function () { getTableHeader() {
return this.remote.setFindTimeout(defaultFindTimeout) return this.remote.setFindTimeout(defaultFindTimeout)
.findAllByCssSelector('table.table.table-condensed thead tr th'); .findAllByCssSelector('table.table.table-condensed thead tr th');
}, }
sortBy: function (columnName) { sortBy(columnName) {
return this.remote.setFindTimeout(defaultFindTimeout) return this.remote.setFindTimeout(defaultFindTimeout)
.findAllByCssSelector('table.table.table-condensed thead tr th span') .findAllByCssSelector('table.table.table-condensed thead tr th span')
.then(function (chartTypes) { .then(function (chartTypes) {
@ -172,7 +174,7 @@ export default (function () {
if (chartString === columnName) { if (chartString === columnName) {
return chart.click() return chart.click()
.then(function () { .then(function () {
return headerPage.getSpinnerDone(); return PageObjects.header.getSpinnerDone();
}); });
} }
}); });
@ -181,22 +183,22 @@ export default (function () {
var getChartTypesPromises = chartTypes.map(getChartType); var getChartTypesPromises = chartTypes.map(getChartType);
return Bluebird.all(getChartTypesPromises); return Bluebird.all(getChartTypesPromises);
}); });
}, }
getTableRow: function (rowNumber, colNumber) { getTableRow(rowNumber, colNumber) {
return this.remote.setFindTimeout(defaultFindTimeout) return this.remote.setFindTimeout(defaultFindTimeout)
// passing in zero-based index, but adding 1 for css 1-based indexes // 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(' + .findByCssSelector('div.agg-table-paginated table.table.table-condensed tbody tr:nth-child(' +
(rowNumber + 1) + ') td.ng-scope:nth-child(' + (rowNumber + 1) + ') td.ng-scope:nth-child(' +
(colNumber + 1) + ') span.ng-binding' (colNumber + 1) + ') span.ng-binding'
); );
}, }
getFieldsTabCount: function () { getFieldsTabCount() {
var self = this; var self = this;
var selector = 'li.kbn-management-tab.active a small'; var selector = 'li.kbn-management-tab.active a small';
return common.try(function () { return PageObjects.common.try(function () {
return self.remote.setFindTimeout(defaultFindTimeout / 10) return self.remote.setFindTimeout(defaultFindTimeout / 10)
.findByCssSelector(selector).getVisibleText() .findByCssSelector(selector).getVisibleText()
.then(function (theText) { .then(function (theText) {
@ -204,9 +206,9 @@ export default (function () {
return theText.replace(/\((.*)\)/, '$1'); return theText.replace(/\((.*)\)/, '$1');
}); });
}); });
}, }
getPageSize: function () { getPageSize() {
var selectedItemLabel = ''; var selectedItemLabel = '';
return this.remote.setFindTimeout(defaultFindTimeout) return this.remote.setFindTimeout(defaultFindTimeout)
.findAllByCssSelector('select.ng-pristine.ng-valid.ng-untouched option') .findAllByCssSelector('select.ng-pristine.ng-valid.ng-untouched option')
@ -227,149 +229,146 @@ export default (function () {
var getChartTypesPromises = chartTypes.map(getChartType); var getChartTypesPromises = chartTypes.map(getChartType);
return Bluebird.all(getChartTypesPromises); return Bluebird.all(getChartTypesPromises);
}) })
.then(function () { .then(() => {
return selectedItemLabel; return selectedItemLabel;
}); });
}, }
getPageFieldCount: function () { getPageFieldCount() {
return this.remote.setFindTimeout(defaultFindTimeout) 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'); .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) return this.remote.setFindTimeout(defaultFindTimeout)
.findByCssSelector('ul.pagination-other-pages-list.pagination-sm.ng-scope li.ng-scope:nth-child(' + .findByCssSelector('ul.pagination-other-pages-list.pagination-sm.ng-scope li.ng-scope:nth-child(' +
(pageNum + 1) + ') a.ng-binding' (pageNum + 1) + ') a.ng-binding'
) )
.then(function (page) { .then(page => {
return page.click(); return page.click();
}); });
}, }
openControlsRow: function (row) { openControlsRow(row) {
return this.remote.setFindTimeout(defaultFindTimeout) return this.remote.setFindTimeout(defaultFindTimeout)
.findByCssSelector('table.table.table-condensed tbody tr:nth-child(' + .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' (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(); return page.click();
}); });
}, }
openControlsByName: function (name) { openControlsByName(name) {
return this.remote.setFindTimeout(defaultFindTimeout) return this.remote.setFindTimeout(defaultFindTimeout)
.findByCssSelector('div.actions a.btn.btn-xs.btn-default[href$="/' + name + '"]') .findByCssSelector('div.actions a.btn.btn-xs.btn-default[href$="/' + name + '"]')
.then(function (button) { .then(button => {
return button.click(); return button.click();
}); });
}, }
increasePopularity: function () { increasePopularity() {
return this.remote.setFindTimeout(defaultFindTimeout) return this.remote.setFindTimeout(defaultFindTimeout)
.findByCssSelector('button.btn.btn-default[aria-label="Plus"]') .findByCssSelector('button.btn.btn-default[aria-label="Plus"]')
.then(function (button) { .then(button => {
return button.click(); return button.click();
}) })
.then(function () { .then(() => {
return headerPage.getSpinnerDone(); return PageObjects.header.getSpinnerDone();
}); });
}, }
getPopularity: function () { getPopularity() {
return this.remote.setFindTimeout(defaultFindTimeout) return this.remote.setFindTimeout(defaultFindTimeout)
.findByCssSelector('input[ng-model="editor.field.count"]') .findByCssSelector('input[ng-model="editor.field.count"]')
.then(function (input) { .then(input => {
return input.getProperty('value'); return input.getProperty('value');
}); });
}, }
controlChangeCancel: function () { controlChangeCancel() {
return this.remote.setFindTimeout(defaultFindTimeout) return this.remote.setFindTimeout(defaultFindTimeout)
.findByCssSelector('button.btn.btn-primary[aria-label="Cancel"]') .findByCssSelector('button.btn.btn-primary[aria-label="Cancel"]')
.then(function (button) { .then(button => {
return button.click(); return button.click();
}) })
.then(function () { .then(() => {
return headerPage.getSpinnerDone(); return PageObjects.header.getSpinnerDone();
}); });
}, }
controlChangeSave: function () { controlChangeSave() {
return this.remote.setFindTimeout(defaultFindTimeout) return this.remote.setFindTimeout(defaultFindTimeout)
.findByCssSelector('button.btn.btn-success.ng-binding[aria-label="Update Field"]') .findByCssSelector('button.btn.btn-success.ng-binding[aria-label="Update Field"]')
.then(function (button) { .then(button => {
return button.click(); return button.click();
}) })
.then(function () { .then(() => {
return headerPage.getSpinnerDone(); return PageObjects.header.getSpinnerDone();
}); });
}, }
setPageSize: function (size) { setPageSize(size) {
return this.remote.setFindTimeout(defaultFindTimeout) return this.remote.setFindTimeout(defaultFindTimeout)
.findByCssSelector('form.form-inline.pagination-size.ng-scope.ng-pristine.ng-valid div.form-group option[label="' + size + '"]') .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(); return button.click();
}) })
.then(function () { .then(() => {
return headerPage.getSpinnerDone(); return PageObjects.header.getSpinnerDone();
}); });
}, }
createIndexPattern: function () { createIndexPattern() {
var self = this; return PageObjects.common.try(() => {
return this.navigateTo()
return common.try(function () { .then(() => {
return self.navigateTo() return this.clickExistingData();
.then(function () {
return self.clickExistingData();
}) })
.then(function () { .then(() => {
return self.selectTimeFieldOption('@timestamp'); return this.selectTimeFieldOption('@timestamp');
}) })
.then(function () { .then(() => {
return self.getCreateButton().click(); return this.getCreateButton().click();
}); });
}) })
.then(function () { .then(() => {
return headerPage.getSpinnerDone(); return PageObjects.header.getSpinnerDone();
}) })
.then(function () { .then(() => {
return common.try(function () { return PageObjects.common.try(() => {
return self.remote.getCurrentUrl() return this.remote.getCurrentUrl()
.then(function (currentUrl) { .then(function (currentUrl) {
common.log('currentUrl', currentUrl); PageObjects.common.log('currentUrl', currentUrl);
if (!currentUrl.match(/indices\/.+\?/)) { if (!currentUrl.match(/indices\/.+\?/)) {
throw new Error('Index pattern not created'); throw new Error('Index pattern not created');
} else { } else {
common.debug('Index pattern created: ' + currentUrl); PageObjects.common.debug('Index pattern created: ' + currentUrl);
} }
}); });
}); });
}); });
}, }
removeIndexPattern: function () { removeIndexPattern() {
var self = this;
var alertText; var alertText;
return common.try(function () { return PageObjects.common.try(() => {
return self.clickDeletePattern() return this.clickDeletePattern()
.then(function () { .then(() => {
return self.remote.getAlertText(); return this.remote.getAlertText();
}) })
.then(function (text) { .then(function (text) {
alertText = text; alertText = text;
}) })
.then(function () { .then(() => {
return self.remote.acceptAlert(); return this.remote.acceptAlert();
}); });
}) })
.then(function () { .then(() => {
return common.try(function () { return PageObjects.common.try(() => {
return self.remote.getCurrentUrl() return this.remote.getCurrentUrl()
.then(function (currentUrl) { .then(function (currentUrl) {
if (currentUrl.match(/indices\/.+\?/)) { if (currentUrl.match(/indices\/.+\?/)) {
throw new Error('Index pattern not removed'); throw new Error('Index pattern not removed');
@ -377,11 +376,9 @@ export default (function () {
}); });
}); });
}) })
.then(function () { .then(() => {
return alertText; return alertText;
}); });
} }
};
return SettingsPage; }
}());

View file

@ -1,21 +1,18 @@
import { remote, defaultFindTimeout } from '../';
// in test/support/pages/shield_page.js import {
export default (function (require) { defaultFindTimeout,
// the page object is created as a constructor } from '../';
// so we can provide the remote Command object
// at runtime export default class ShieldPage {
function ShieldPage() {
constructor() {
} }
ShieldPage.prototype = {
constructor: ShieldPage,
init(remote) { init(remote) {
this.remote = remote; this.remote = remote;
}, }
login: function login(user, pwd) { login(user, pwd) {
var remote = this.remote; var remote = this.remote;
return remote.setFindTimeout(defaultFindTimeout) return remote.setFindTimeout(defaultFindTimeout)
.findById('username') .findById('username')
@ -30,8 +27,4 @@ export default (function (require) {
}); });
} }
}
};
return ShieldPage;
}());

View file

@ -1,80 +1,83 @@
import { common, defaultFindTimeout, remote } from '../';
export default (function () { import {
function VisualizePage() { defaultFindTimeout,
} from '../';
import PageObjects from './';
export default class VisualizePage {
constructor() {
} }
VisualizePage.prototype = {
constructor: VisualizePage,
init(remote) { init(remote) {
this.remote = remote; this.remote = remote;
}, }
clickAreaChart: function clickAreaChart() { clickAreaChart() {
return this.remote return this.remote
.setFindTimeout(defaultFindTimeout) .setFindTimeout(defaultFindTimeout)
.findByPartialLinkText('Area chart') .findByPartialLinkText('Area chart')
.click(); .click();
}, }
clickDataTable: function clickDataTable() { clickDataTable() {
return this.remote return this.remote
.setFindTimeout(defaultFindTimeout) .setFindTimeout(defaultFindTimeout)
.findByPartialLinkText('Data table') .findByPartialLinkText('Data table')
.click(); .click();
}, }
clickLineChart: function clickLineChart() { clickLineChart() {
return this.remote return this.remote
.setFindTimeout(defaultFindTimeout) .setFindTimeout(defaultFindTimeout)
.findByPartialLinkText('Line chart') .findByPartialLinkText('Line chart')
.click(); .click();
}, }
clickMarkdownWidget: function clickMarkdownWidget() { clickMarkdownWidget() {
return this.remote return this.remote
.setFindTimeout(defaultFindTimeout) .setFindTimeout(defaultFindTimeout)
.findByPartialLinkText('Markdown widget') .findByPartialLinkText('Markdown widget')
.click(); .click();
}, }
clickMetric: function clickMetric() { clickMetric() {
return this.remote return this.remote
.setFindTimeout(defaultFindTimeout) .setFindTimeout(defaultFindTimeout)
.findByPartialLinkText('Metric') .findByPartialLinkText('Metric')
.click(); .click();
}, }
clickPieChart: function clickPieChart() { clickPieChart() {
return this.remote return this.remote
.setFindTimeout(defaultFindTimeout) .setFindTimeout(defaultFindTimeout)
.findByPartialLinkText('Pie chart') .findByPartialLinkText('Pie chart')
.click(); .click();
}, }
clickTileMap: function clickTileMap() { clickTileMap() {
return this.remote return this.remote
.setFindTimeout(defaultFindTimeout) .setFindTimeout(defaultFindTimeout)
.findByPartialLinkText('Tile map') .findByPartialLinkText('Tile map')
.click(); .click();
}, }
clickVerticalBarChart: function clickVerticalBarChart() { clickVerticalBarChart() {
return this.remote return this.remote
.setFindTimeout(defaultFindTimeout) .setFindTimeout(defaultFindTimeout)
.findByPartialLinkText('Vertical bar chart') .findByPartialLinkText('Vertical bar chart')
.click(); .click();
}, }
getChartTypeCount: function getChartTypeCount() { getChartTypeCount() {
return this.remote return this.remote
.setFindTimeout(defaultFindTimeout) .setFindTimeout(defaultFindTimeout)
.findAllByCssSelector('a.wizard-vis-type.ng-scope') .findAllByCssSelector('a.wizard-vis-type.ng-scope')
.length; .length;
}, }
getChartTypes: function getChartTypes() { getChartTypes() {
var types = []; var types = [];
return this.remote return this.remote
.setFindTimeout(defaultFindTimeout) .setFindTimeout(defaultFindTimeout)
@ -89,67 +92,67 @@ export default (function () {
.then(function (texts) { .then(function (texts) {
return texts; return texts;
}); });
}, }
clickAbsoluteButton: function clickAbsoluteButton() { clickAbsoluteButton() {
return this.remote return this.remote
.setFindTimeout(defaultFindTimeout * 2) .setFindTimeout(defaultFindTimeout * 2)
.findByCssSelector('ul.nav.nav-pills.nav-stacked.kbn-timepicker-modes:contains("absolute")') .findByCssSelector('ul.nav.nav-pills.nav-stacked.kbn-timepicker-modes:contains("absolute")')
.click(); .click();
}, }
setFromTime: function setFromTime(timeString) { setFromTime(timeString) {
return this.remote return this.remote
.setFindTimeout(defaultFindTimeout * 2) .setFindTimeout(defaultFindTimeout * 2)
.findByCssSelector('input[ng-model="absolute.from"]') .findByCssSelector('input[ng-model="absolute.from"]')
.clearValue() .clearValue()
.type(timeString); .type(timeString);
}, }
setToTime: function setToTime(timeString) { setToTime(timeString) {
return this.remote return this.remote
.setFindTimeout(defaultFindTimeout * 2) .setFindTimeout(defaultFindTimeout * 2)
.findByCssSelector('input[ng-model="absolute.to"]') .findByCssSelector('input[ng-model="absolute.to"]')
.clearValue() .clearValue()
.type(timeString); .type(timeString);
}, }
clickGoButton: function clickGoButton() { clickGoButton() {
return this.remote return this.remote
.setFindTimeout(defaultFindTimeout * 2) .setFindTimeout(defaultFindTimeout * 2)
.findByClassName('kbn-timepicker-go') .findByClassName('kbn-timepicker-go')
.click(); .click();
}, }
collapseChart: function collapseChart() { collapseChart() {
return this.remote return this.remote
.setFindTimeout(defaultFindTimeout) .setFindTimeout(defaultFindTimeout)
.findByCssSelector('div.visualize-show-spy > div > i') .findByCssSelector('div.visualize-show-spy > div > i')
.click(); .click();
}, }
getMetric: function getMetric() { getMetric() {
return this.remote return this.remote
.setFindTimeout(2000) .setFindTimeout(2000)
.findByCssSelector('div[ng-controller="KbnMetricVisController"]') .findByCssSelector('div[ng-controller="KbnMetricVisController"]')
.getVisibleText(); .getVisibleText();
}, }
clickMetricEditor: function clickMetricEditor() { clickMetricEditor() {
return this.remote return this.remote
.setFindTimeout(defaultFindTimeout) .setFindTimeout(defaultFindTimeout)
.findByCssSelector('button[aria-label="Open Editor"]') .findByCssSelector('button[aria-label="Open Editor"]')
.click(); .click();
}, }
clickNewSearch: function clickNewSearch() { clickNewSearch() {
return this.remote return this.remote
.setFindTimeout(defaultFindTimeout) .setFindTimeout(defaultFindTimeout)
.findByCssSelector('.list-group-item a') .findByCssSelector('.list-group-item a')
.click(); .click();
}, }
setValue: function setValue(newValue) { setValue(newValue) {
var self = this.remote; var self = this.remote;
return this.remote return this.remote
.setFindTimeout(defaultFindTimeout * 2) .setFindTimeout(defaultFindTimeout * 2)
@ -167,43 +170,43 @@ export default (function () {
.findByCssSelector('input[ng-model="numberListCntr.getList()[$index]"]') .findByCssSelector('input[ng-model="numberListCntr.getList()[$index]"]')
.type(newValue); .type(newValue);
}); });
}, }
clickSavedSearch: function clickSavedSearch() { clickSavedSearch() {
return this.remote return this.remote
.setFindTimeout(defaultFindTimeout) .setFindTimeout(defaultFindTimeout)
.findByCssSelector('li[ng-click="stepTwoMode=\'saved\'"]') .findByCssSelector('li[ng-click="stepTwoMode=\'saved\'"]')
.click(); .click();
}, }
selectSearch: function selectSearch(searchName) { selectSearch(searchName) {
return this.remote return this.remote
.setFindTimeout(defaultFindTimeout) .setFindTimeout(defaultFindTimeout)
.findByLinkText(searchName) .findByLinkText(searchName)
.click(); .click();
}, }
getErrorMessage: function getErrorMessage() { getErrorMessage() {
return this.remote return this.remote
.setFindTimeout(defaultFindTimeout) .setFindTimeout(defaultFindTimeout)
.findByCssSelector('.item>h4') .findByCssSelector('.item>h4')
.getVisibleText(); .getVisibleText();
}, }
// clickBucket(bucketType) 'X-Axis', 'Split Area', 'Split Chart' // clickBucket(bucketType) 'X-Axis', 'Split Area', 'Split Chart'
clickBucket: function clickBucket(bucketName) { clickBucket(bucketName) {
return this.remote return this.remote
.setFindTimeout(defaultFindTimeout) .setFindTimeout(defaultFindTimeout)
.findAllByCssSelector('li.list-group-item.list-group-menu-item.ng-binding.ng-scope') .findAllByCssSelector('li.list-group-item.list-group-menu-item.ng-binding.ng-scope')
.then(function (chartTypes) { .then(function (chartTypes) {
common.debug('found bucket types ' + chartTypes.length); PageObjects.common.debug('found bucket types ' + chartTypes.length);
function getChartType(chart) { function getChartType(chart) {
return chart return chart
.getVisibleText() .getVisibleText()
.then(function (chartString) { .then(function (chartString) {
//common.debug(chartString); //PageObjects.common.debug(chartString);
if (chartString === bucketName) { if (chartString === bucketName) {
chart.click(); chart.click();
} }
@ -212,43 +215,43 @@ export default (function () {
var getChartTypesPromises = chartTypes.map(getChartType); var getChartTypesPromises = chartTypes.map(getChartType);
return Promise.all(getChartTypesPromises); return Promise.all(getChartTypesPromises);
}); });
}, }
selectAggregation: function selectAggregation(myString) { selectAggregation(myString) {
return this.remote return this.remote
.setFindTimeout(defaultFindTimeout) .setFindTimeout(defaultFindTimeout)
.findByCssSelector('option[label="' + myString + '"]') .findByCssSelector('option[label="' + myString + '"]')
.click(); .click();
}, }
getField: function getField() { getField() {
return this.remote return this.remote
.setFindTimeout(defaultFindTimeout) .setFindTimeout(defaultFindTimeout)
.findByCssSelector('.ng-valid-required[name="field"] option[selected="selected"]') .findByCssSelector('.ng-valid-required[name="field"] option[selected="selected"]')
.getVisibleText(); .getVisibleText();
}, }
selectField: function selectField(fieldValue) { selectField(fieldValue) {
var self = this; var self = this;
return common.try(function tryingForTime() { return PageObjects.common.try(function tryingForTime() {
return self.remote return self.remote
.setFindTimeout(defaultFindTimeout) .setFindTimeout(defaultFindTimeout)
// the css below should be more selective // the css below should be more selective
.findByCssSelector('option[label="' + fieldValue + '"]') .findByCssSelector('option[label="' + fieldValue + '"]')
.click(); .click();
}); });
}, }
orderBy: function orderBy(fieldValue) { orderBy(fieldValue) {
return this.remote return this.remote
.setFindTimeout(defaultFindTimeout) .setFindTimeout(defaultFindTimeout)
.findByCssSelector('select.form-control.ng-pristine.ng-valid.ng-untouched.ng-valid-required[ng-model="agg.params.orderBy"] ' + .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 + '")' 'option.ng-binding.ng-scope:contains("' + fieldValue + '")'
) )
.click(); .click();
}, }
getInterval: function getInterval() { getInterval() {
var self = this; var self = this;
return this.remote return this.remote
.setFindTimeout(defaultFindTimeout) .setFindTimeout(defaultFindTimeout)
@ -260,49 +263,49 @@ export default (function () {
.findByCssSelector('select[ng-model="agg.params.interval"] option:nth-child(' + (selectedIndex + 1) + ')') .findByCssSelector('select[ng-model="agg.params.interval"] option:nth-child(' + (selectedIndex + 1) + ')')
.getProperty('label'); .getProperty('label');
}); });
}, }
setInterval: function setInterval(newValue) { setInterval(newValue) {
return this.remote return this.remote
.setFindTimeout(defaultFindTimeout) .setFindTimeout(defaultFindTimeout)
.findByCssSelector('select[ng-model="agg.params.interval"]') .findByCssSelector('select[ng-model="agg.params.interval"]')
.type(newValue); .type(newValue);
}, }
setNumericInterval: function setNumericInterval(newValue) { setNumericInterval(newValue) {
return this.remote return this.remote
.setFindTimeout(defaultFindTimeout) .setFindTimeout(defaultFindTimeout)
.findByCssSelector('input[name="interval"]') .findByCssSelector('input[name="interval"]')
.type(newValue); .type(newValue);
}, }
clickGo: function clickGo() { clickGo() {
return this.remote return this.remote
.setFindTimeout(defaultFindTimeout) .setFindTimeout(defaultFindTimeout)
.findByCssSelector('.btn-success') .findByCssSelector('.btn-success')
.click(); .click();
}, }
clickNewVisualization: function clickNewVisualization() { clickNewVisualization() {
return this.remote return this.remote
.setFindTimeout(defaultFindTimeout) .setFindTimeout(defaultFindTimeout)
.findByCssSelector('button[aria-label="New Visualization"]') .findByCssSelector('button[aria-label="New Visualization"]')
.click(); .click();
}, }
saveVisualization: function saveVisualization(vizName) { saveVisualization(vizName) {
var self = this; var self = this;
return this.remote return this.remote
.setFindTimeout(defaultFindTimeout) .setFindTimeout(defaultFindTimeout)
.findByCssSelector('button[aria-label="Save Visualization"]') .findByCssSelector('button[aria-label="Save Visualization"]')
.click() .click()
.then(function () { .then(function () {
return common.sleep(1000); return PageObjects.common.sleep(1000);
}) })
.then(function () { .then(function () {
common.debug('saveButton button clicked'); PageObjects.common.debug('saveButton button clicked');
return self.remote return self.remote
.setFindTimeout(defaultFindTimeout) .setFindTimeout(defaultFindTimeout)
.findByName('visTitle') .findByName('visTitle')
@ -310,7 +313,7 @@ export default (function () {
}) })
// // click save button // // click save button
.then(function () { .then(function () {
common.debug('click submit button'); PageObjects.common.debug('click submit button');
return self.remote return self.remote
.setFindTimeout(defaultFindTimeout) .setFindTimeout(defaultFindTimeout)
.findByCssSelector('.config button[type="submit"]') .findByCssSelector('.config button[type="submit"]')
@ -319,23 +322,23 @@ export default (function () {
// verify that green message at the top of the page. // verify that green message at the top of the page.
// it's only there for about 5 seconds // it's only there for about 5 seconds
.then(function () { .then(function () {
return common.try(function tryingForTime() { return PageObjects.common.try(function tryingForTime() {
return self.remote return self.remote
.setFindTimeout(defaultFindTimeout) .setFindTimeout(defaultFindTimeout)
.findByCssSelector('kbn-truncated.toast-message.ng-isolate-scope') .findByCssSelector('kbn-truncated.toast-message.ng-isolate-scope')
.getVisibleText(); .getVisibleText();
}); });
}); });
}, }
clickLoadSavedVisButton: function clickLoadSavedVisButton() { clickLoadSavedVisButton() {
return this.remote return this.remote
.setFindTimeout(defaultFindTimeout) .setFindTimeout(defaultFindTimeout)
.findDisplayedByCssSelector('button[aria-label="Load Saved Visualization"]') .findDisplayedByCssSelector('button[aria-label="Load Saved Visualization"]')
.click(); .click();
}, }
filterVisByName: function filterVisByName(vizName) { filterVisByName(vizName) {
return this.remote return this.remote
.findByCssSelector('input[name="filter"]') .findByCssSelector('input[name="filter"]')
.click() .click()
@ -343,44 +346,44 @@ export default (function () {
// or extended character sets // or extended character sets
// https://github.com/elastic/kibana/issues/6300 // https://github.com/elastic/kibana/issues/6300
.type(vizName.replace('-',' ')); .type(vizName.replace('-',' '));
}, }
clickVisualizationByLinkText: function clickVisualizationByLinkText(vizName) { clickVisualizationByLinkText(vizName) {
var self = this; 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 return self.remote
.setFindTimeout(defaultFindTimeout) .setFindTimeout(defaultFindTimeout)
.findByLinkText(vizName) .findByLinkText(vizName)
.click(); .click();
}); });
}, }
// this starts by clicking the Load Saved Viz button, not from the // this starts by clicking the Load Saved Viz button, not from the
// bottom half of the "Create a new visualization Step 1" page // bottom half of the "Create a new visualization Step 1" page
loadSavedVisualization: function loadSavedVisualization(vizName) { loadSavedVisualization(vizName) {
var self = this; var self = this;
return this.clickLoadSavedVisButton() return this.clickLoadSavedVisButton()
.then(function filterVisualization() { .then(function filterVisualization() {
return self.openSavedVisualization(vizName); return self.openSavedVisualization(vizName);
}); });
}, }
// this is for starting on the // this is for starting on the
// bottom half of the "Create a new visualization Step 1" page // bottom half of the "Create a new visualization Step 1" page
openSavedVisualization: function openSavedVisualization(vizName) { openSavedVisualization(vizName) {
var self = this; var self = this;
return self.filterVisByName(vizName) return self.filterVisByName(vizName)
.then(function () { .then(function () {
return common.sleep(1000); return PageObjects.common.sleep(1000);
}) })
.then(function clickDashboardByLinkedText() { .then(function clickDashboardByLinkedText() {
return self.clickVisualizationByLinkText(vizName); return self.clickVisualizationByLinkText(vizName);
}); });
}, }
getXAxisLabels: function getXAxisLabels() { getXAxisLabels() {
return this.remote return this.remote
.setFindTimeout(defaultFindTimeout) .setFindTimeout(defaultFindTimeout)
.findAllByCssSelector('.x > g') .findAllByCssSelector('.x > g')
@ -393,13 +396,13 @@ export default (function () {
return Promise.all(getChartTypesPromises); return Promise.all(getChartTypesPromises);
}) })
.then(function (texts) { .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; return texts;
}); });
}, }
getYAxisLabels: function getYAxisLabels() { getYAxisLabels() {
return this.remote return this.remote
.setFindTimeout(defaultFindTimeout) .setFindTimeout(defaultFindTimeout)
.findAllByCssSelector('.y > g') .findAllByCssSelector('.y > g')
@ -412,17 +415,17 @@ export default (function () {
return Promise.all(getChartTypesPromises); return Promise.all(getChartTypesPromises);
}) })
.then(function (texts) { .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; return texts;
}); });
}, }
/* /*
** This method gets the chart data and scales it based on chart height and label. ** This method gets the chart data and scales it based on chart height and label.
** Returns an array of height values ** Returns an array of height values
*/ */
getAreaChartData: function getAreaChartData(aggregateName) { getAreaChartData(aggregateName) {
var self = this.remote; var self = this.remote;
var chartData = []; 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 // 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. // scale the chart pixel data, we need to clean out commas and % marks.
yAxisLabel = yLabel.replace(/(%|,)/g, ''); yAxisLabel = yLabel.replace(/(%|,)/g, '');
common.debug('yAxisLabel = ' + yAxisLabel); PageObjects.common.debug('yAxisLabel = ' + yAxisLabel);
return yLabel; return yLabel;
}) })
// 2). find and save the y-axis pixel size (the chart height) // 2). find and save the y-axis pixel size (the chart height)
@ -454,7 +457,7 @@ export default (function () {
}) })
.then(function (chartH) { .then(function (chartH) {
yAxisHeight = chartH; yAxisHeight = chartH;
common.debug('height --------- ' + yAxisHeight); PageObjects.common.debug('height --------- ' + yAxisHeight);
}) })
.then(function () { .then(function () {
return self.setFindTimeout(defaultFindTimeout * 2) return self.setFindTimeout(defaultFindTimeout * 2)
@ -462,25 +465,25 @@ export default (function () {
.getAttribute('d'); .getAttribute('d');
}) })
.then(function (data) { .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 // 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 // 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. // 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. // So git rid of the one 'M' and split the rest on the 'L's.
tempArray = data.replace('M','').split('L'); tempArray = data.replace('M','').split('L');
chartSections = tempArray.length / 2; 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++) { for (var i = 0; i < chartSections; i++) {
chartData[i] = Math.round((yAxisHeight - tempArray[i].split(',')[1]) / yAxisHeight * yAxisLabel); 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; return chartData;
}); });
}, }
// The current test shows dots, not a line. This function gets the dots and normalizes their height. // 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 self = this.remote;
var yAxisLabel = 0; var yAxisLabel = 0;
var yAxisHeight; var yAxisHeight;
@ -492,7 +495,7 @@ export default (function () {
.getVisibleText() .getVisibleText()
.then(function (yLabel) { .then(function (yLabel) {
yAxisLabel = yLabel.replace(',', ''); yAxisLabel = yLabel.replace(',', '');
common.debug('yAxisLabel = ' + yAxisLabel); PageObjects.common.debug('yAxisLabel = ' + yAxisLabel);
return yLabel; return yLabel;
}) })
// 2). find and save the y-axis pixel size (the chart height) // 2). find and save the y-axis pixel size (the chart height)
@ -503,7 +506,7 @@ export default (function () {
.getAttribute('height') .getAttribute('height')
.then(function (theHeight) { .then(function (theHeight) {
yAxisHeight = theHeight - 5; // MAGIC NUMBER - clipPath extends a bit above the top of the y-axis and below x-axis 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; return theHeight;
}); });
}) })
@ -519,12 +522,12 @@ export default (function () {
return chart return chart
.findByCssSelector('circle[fill="#6eadc1"]') .findByCssSelector('circle[fill="#6eadc1"]')
.then(function (circleObject) { .then(function (circleObject) {
// common.debug('circleObject = ' + circleObject + ' yAxisHeight= ' + yAxisHeight + ' yAxisLabel= ' + yAxisLabel); // PageObjects.common.debug('circleObject = ' + circleObject + ' yAxisHeight= ' + yAxisHeight + ' yAxisLabel= ' + yAxisLabel);
return circleObject return circleObject
.getAttribute('cy'); .getAttribute('cy');
}) })
.then(function (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)); // ' ((yAxisHeight - cy)/yAxisHeight * yAxisLabel)=' + ((yAxisHeight - cy) / yAxisHeight * yAxisLabel));
return Math.round((yAxisHeight - cy) / yAxisHeight * yAxisLabel); return Math.round((yAxisHeight - cy) / yAxisHeight * yAxisLabel);
}); });
@ -539,11 +542,11 @@ export default (function () {
.then(function (yCoords) { .then(function (yCoords) {
return yCoords; return yCoords;
}); });
}, }
// this is ALMOST identical to DiscoverPage.getBarChartData // this is ALMOST identical to DiscoverPage.getBarChartData
getBarChartData: function getBarChartData() { getBarChartData() {
var self = this.remote; var self = this.remote;
var yAxisLabel = 0; var yAxisLabel = 0;
var yAxisHeight; var yAxisHeight;
@ -557,7 +560,7 @@ export default (function () {
.getVisibleText() .getVisibleText()
.then(function (yLabel) { .then(function (yLabel) {
yAxisLabel = yLabel.replace(',', ''); yAxisLabel = yLabel.replace(',', '');
common.debug('yAxisLabel = ' + yAxisLabel); PageObjects.common.debug('yAxisLabel = ' + yAxisLabel);
return yLabel; return yLabel;
}); });
}) })
@ -571,7 +574,7 @@ export default (function () {
.getAttribute('height') .getAttribute('height')
.then(function (theHeight) { .then(function (theHeight) {
yAxisHeight = theHeight; // - 5; // MAGIC NUMBER - clipPath extends a bit above the top of the y-axis and below x-axis 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; return theHeight;
}); });
}); });
@ -604,9 +607,9 @@ export default (function () {
return bars; return bars;
}); });
}); });
}, }
getPieChartData: function getPieChartData() { getPieChartData() {
var self = this.remote; var self = this.remote;
// 1). get the maximim chart Y-Axis marker value // 1). get the maximim chart Y-Axis marker value
@ -626,48 +629,48 @@ export default (function () {
return Promise.all(getChartTypesPromises); return Promise.all(getChartTypesPromises);
}) })
.then(function (slices) { .then(function (slices) {
common.debug('slices=' + slices); PageObjects.common.debug('slices=' + slices);
return slices; return slices;
}); });
}, }
getChartAreaWidth: function getChartAreaWidth() { getChartAreaWidth() {
return this.remote return this.remote
.setFindTimeout(defaultFindTimeout) .setFindTimeout(defaultFindTimeout)
.findByCssSelector('clipPath rect') .findByCssSelector('clipPath rect')
.getAttribute('width'); .getAttribute('width');
}, }
getChartAreaHeight: function getChartAreaHeight() { getChartAreaHeight() {
return this.remote return this.remote
.setFindTimeout(defaultFindTimeout) .setFindTimeout(defaultFindTimeout)
.findByCssSelector('clipPath rect') .findByCssSelector('clipPath rect')
.getAttribute('height'); .getAttribute('height');
}, }
getDataTableData: function getDataTableData() { getDataTableData() {
return this.remote return this.remote
.setFindTimeout(defaultFindTimeout * 2) .setFindTimeout(defaultFindTimeout * 2)
.findByCssSelector('table.table.table-condensed tbody') .findByCssSelector('table.table.table-condensed tbody')
.getVisibleText(); .getVisibleText();
}, }
getMarkdownData: function getMarkdownData() { getMarkdownData() {
return this.remote return this.remote
.setFindTimeout(defaultFindTimeout) .setFindTimeout(defaultFindTimeout)
.findByCssSelector('visualize.ng-isolate-scope') .findByCssSelector('visualize.ng-isolate-scope')
.getVisibleText(); .getVisibleText();
}, }
clickColumns: function clickColumns() { clickColumns() {
return this.remote return this.remote
.setFindTimeout(defaultFindTimeout) .setFindTimeout(defaultFindTimeout)
.findByCssSelector('div.schemaEditors.ng-scope > div > div > button:nth-child(2)') .findByCssSelector('div.schemaEditors.ng-scope > div > div > button:nth-child(2)')
.click(); .click();
}, }
waitForToastMessageGone: function waitForToastMessageGone() { waitForToastMessageGone() {
var self = this; var self = this;
return common.try(function tryingForTime() { return PageObjects.common.try(function tryingForTime() {
return self.remote return self.remote
.setFindTimeout(100) .setFindTimeout(100)
.findAllByCssSelector('kbn-truncated.toast-message.ng-isolate-scope') .findAllByCssSelector('kbn-truncated.toast-message.ng-isolate-scope')
@ -675,20 +678,17 @@ export default (function () {
if (messages.length > 0) { if (messages.length > 0) {
throw new Error('waiting for toast message to clear'); throw new Error('waiting for toast message to clear');
} else { } else {
common.debug('now messages = 0 "' + messages + '"'); PageObjects.common.debug('now messages = 0 "' + messages + '"');
return messages; return messages;
} }
}); });
}); });
}, }
waitForVisualization: function waitForVisualization() { waitForVisualization() {
return this.remote return this.remote
.setFindTimeout(defaultFindTimeout) .setFindTimeout(defaultFindTimeout)
.findByCssSelector('visualize-legend'); .findByCssSelector('visualize-legend');
} }
}; }
return VisualizePage;
}());