Refactor, clean up, new inspector, pie chart services (#28509)
* Refactor, clean up, new inspector, pie chart services * Move inspector service to top level, outside of visualizations folder * Refactor some more instances of getTableData into expectTableData
This commit is contained in:
parent
85fa8290fb
commit
1078782106
43 changed files with 502 additions and 464 deletions
|
@ -22,6 +22,7 @@ import expect from 'expect.js';
|
|||
export default function ({ getService, getPageObjects }) {
|
||||
const PageObjects = getPageObjects(['dashboard', 'header']);
|
||||
const dashboardExpect = getService('dashboardExpect');
|
||||
const pieChart = getService('pieChart');
|
||||
const browser = getService('browser');
|
||||
const log = getService('log');
|
||||
const queryBar = getService('queryBar');
|
||||
|
@ -67,7 +68,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
const query = await queryBar.getQueryString();
|
||||
expect(query).to.equal('memory:>220000');
|
||||
|
||||
await dashboardExpect.pieSliceCount(5);
|
||||
await pieChart.expectPieSliceCount(5);
|
||||
await dashboardExpect.panelCount(2);
|
||||
await dashboardExpect.selectedLegendColorCount('#F9D9F9', 5);
|
||||
});
|
||||
|
@ -83,7 +84,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
const query = await queryBar.getQueryString();
|
||||
expect(query).to.equal('memory:>220000');
|
||||
|
||||
await dashboardExpect.pieSliceCount(5);
|
||||
await pieChart.expectPieSliceCount(5);
|
||||
await dashboardExpect.panelCount(2);
|
||||
await dashboardExpect.selectedLegendColorCount('#F9D9F9', 5);
|
||||
});
|
||||
|
|
|
@ -24,6 +24,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
const dashboardAddPanel = getService('dashboardAddPanel');
|
||||
const testSubjects = getService('testSubjects');
|
||||
const filterBar = getService('filterBar');
|
||||
const pieChart = getService('pieChart');
|
||||
const PageObjects = getPageObjects(['dashboard', 'header', 'visualize']);
|
||||
|
||||
describe('dashboard filter bar', async () => {
|
||||
|
@ -92,11 +93,11 @@ export default function ({ getService, getPageObjects }) {
|
|||
it('are added when a pie chart slice is clicked', async function () {
|
||||
await dashboardAddPanel.addVisualization('Rendering Test: pie');
|
||||
await PageObjects.dashboard.waitForRenderComplete();
|
||||
await PageObjects.dashboard.filterOnPieSlice('4,886');
|
||||
await pieChart.filterOnPieSlice('4,886');
|
||||
const filters = await PageObjects.dashboard.getFilters();
|
||||
expect(filters.length).to.equal(1);
|
||||
|
||||
await dashboardExpect.pieSliceCount(1);
|
||||
await pieChart.expectPieSliceCount(1);
|
||||
});
|
||||
|
||||
it('are preserved after saving a dashboard', async () => {
|
||||
|
@ -106,7 +107,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
const filters = await PageObjects.dashboard.getFilters();
|
||||
expect(filters.length).to.equal(1);
|
||||
|
||||
await dashboardExpect.pieSliceCount(1);
|
||||
await pieChart.expectPieSliceCount(1);
|
||||
});
|
||||
|
||||
it('are preserved after opening a dashboard saved with filters', async () => {
|
||||
|
@ -117,7 +118,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
const filters = await PageObjects.dashboard.getFilters();
|
||||
expect(filters.length).to.equal(1);
|
||||
|
||||
await dashboardExpect.pieSliceCount(1);
|
||||
await pieChart.expectPieSliceCount(1);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -25,6 +25,7 @@ import expect from 'expect.js';
|
|||
*/
|
||||
export default function ({ getService, getPageObjects }) {
|
||||
const dashboardExpect = getService('dashboardExpect');
|
||||
const pieChart = getService('pieChart');
|
||||
const queryBar = getService('queryBar');
|
||||
const dashboardAddPanel = getService('dashboardAddPanel');
|
||||
const renderable = getService('renderable');
|
||||
|
@ -57,7 +58,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
});
|
||||
|
||||
it('filters on pie charts', async () => {
|
||||
await dashboardExpect.pieSliceCount(0);
|
||||
await pieChart.expectPieSliceCount(0);
|
||||
});
|
||||
|
||||
it('area, bar and heatmap charts filtered', async () => {
|
||||
|
@ -119,7 +120,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
});
|
||||
|
||||
it('filters on pie charts', async () => {
|
||||
await dashboardExpect.pieSliceCount(0);
|
||||
await pieChart.expectPieSliceCount(0);
|
||||
});
|
||||
|
||||
it('area, bar and heatmap charts filtered', async () => {
|
||||
|
@ -177,7 +178,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
});
|
||||
|
||||
it('pie charts', async () => {
|
||||
await dashboardExpect.pieSliceCount(5);
|
||||
await pieChart.expectPieSliceCount(5);
|
||||
});
|
||||
|
||||
it('area, bar and heatmap charts', async () => {
|
||||
|
@ -238,7 +239,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
await dashboardAddPanel.addVisualization('Rendering-Test:-animal-sounds-pie');
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
await PageObjects.dashboard.waitForRenderComplete();
|
||||
await dashboardExpect.pieSliceCount(5);
|
||||
await pieChart.expectPieSliceCount(5);
|
||||
|
||||
await dashboardPanelActions.openContextMenu();
|
||||
await dashboardPanelActions.clickEdit();
|
||||
|
@ -250,13 +251,13 @@ export default function ({ getService, getPageObjects }) {
|
|||
// We are on the visualize page, not dashboard, so can't use "PageObjects.dashboard.waitForRenderComplete();"
|
||||
// as that expects an item with the `data-shared-items-count` tag.
|
||||
await renderable.waitForRender();
|
||||
await dashboardExpect.pieSliceCount(3);
|
||||
await pieChart.expectPieSliceCount(3);
|
||||
|
||||
await PageObjects.visualize.saveVisualizationExpectSuccess('Rendering Test: animal sounds pie');
|
||||
await PageObjects.header.clickDashboard();
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
await PageObjects.dashboard.waitForRenderComplete();
|
||||
await dashboardExpect.pieSliceCount(3);
|
||||
await pieChart.expectPieSliceCount(3);
|
||||
});
|
||||
|
||||
it('Nested visualization filter pills filters data as expected', async () => {
|
||||
|
@ -264,14 +265,14 @@ export default function ({ getService, getPageObjects }) {
|
|||
await dashboardPanelActions.clickEdit();
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
await renderable.waitForRender();
|
||||
await PageObjects.dashboard.filterOnPieSlice('grr');
|
||||
await pieChart.filterOnPieSlice('grr');
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
await dashboardExpect.pieSliceCount(1);
|
||||
await pieChart.expectPieSliceCount(1);
|
||||
|
||||
await PageObjects.visualize.saveVisualizationExpectSuccess('animal sounds pie');
|
||||
await PageObjects.header.clickDashboard();
|
||||
|
||||
await dashboardExpect.pieSliceCount(1);
|
||||
await pieChart.expectPieSliceCount(1);
|
||||
});
|
||||
|
||||
it('Removing filter pills and query unfiters data as expected', async () => {
|
||||
|
@ -283,17 +284,17 @@ export default function ({ getService, getPageObjects }) {
|
|||
await queryBar.submitQuery();
|
||||
await filterBar.removeFilter('sound.keyword');
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
await dashboardExpect.pieSliceCount(5);
|
||||
await pieChart.expectPieSliceCount(5);
|
||||
|
||||
await PageObjects.visualize.saveVisualization('Rendering Test: animal sounds pie');
|
||||
await PageObjects.header.clickDashboard();
|
||||
|
||||
await dashboardExpect.pieSliceCount(5);
|
||||
await pieChart.expectPieSliceCount(5);
|
||||
});
|
||||
|
||||
it('Pie chart linked to saved search filters data', async () => {
|
||||
await dashboardAddPanel.addVisualization('Filter Test: animals: linked to search with filter');
|
||||
await dashboardExpect.pieSliceCount(7);
|
||||
await pieChart.expectPieSliceCount(7);
|
||||
});
|
||||
|
||||
it('Pie chart linked to saved search filters shows no data with conflicting dashboard query', async () => {
|
||||
|
@ -301,7 +302,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
await queryBar.submitQuery();
|
||||
await PageObjects.dashboard.waitForRenderComplete();
|
||||
|
||||
await dashboardExpect.pieSliceCount(5);
|
||||
await pieChart.expectPieSliceCount(5);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -21,7 +21,7 @@ import expect from 'expect.js';
|
|||
|
||||
export default function ({ getService, getPageObjects }) {
|
||||
const esArchiver = getService('esArchiver');
|
||||
const dashboardExpect = getService('dashboardExpect');
|
||||
const pieChart = getService('pieChart');
|
||||
const queryBar = getService('queryBar');
|
||||
const PageObjects = getPageObjects(['dashboard', 'discover']);
|
||||
|
||||
|
@ -37,7 +37,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
const headers = await PageObjects.discover.getColumnHeaders();
|
||||
expect(headers.length).to.be(0);
|
||||
|
||||
await dashboardExpect.pieSliceCount(0);
|
||||
await pieChart.expectPieSliceCount(0);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -29,6 +29,8 @@ export default function ({ getService, getPageObjects }) {
|
|||
const testSubjects = getService('testSubjects');
|
||||
const browser = getService('browser');
|
||||
const queryBar = getService('queryBar');
|
||||
const pieChart = getService('pieChart');
|
||||
const inspector = getService('inspector');
|
||||
const retry = getService('retry');
|
||||
const dashboardPanelActions = getService('dashboardPanelActions');
|
||||
const dashboardAddPanel = getService('dashboardAddPanel');
|
||||
|
@ -140,8 +142,8 @@ export default function ({ getService, getPageObjects }) {
|
|||
await PageObjects.dashboard.saveDashboard('No local edits');
|
||||
|
||||
await dashboardPanelActions.openInspector();
|
||||
const tileMapData = await PageObjects.visualize.getInspectorTableData();
|
||||
await PageObjects.visualize.closeInspector();
|
||||
const tileMapData = await inspector.getTableData();
|
||||
await inspector.close();
|
||||
|
||||
await PageObjects.dashboard.switchToEditMode();
|
||||
await dashboardPanelActions.openContextMenu();
|
||||
|
@ -157,8 +159,8 @@ export default function ({ getService, getPageObjects }) {
|
|||
await PageObjects.header.clickDashboard();
|
||||
|
||||
await dashboardPanelActions.openInspector();
|
||||
const changedTileMapData = await PageObjects.visualize.getInspectorTableData();
|
||||
await PageObjects.visualize.closeInspector();
|
||||
const changedTileMapData = await inspector.getTableData();
|
||||
await inspector.close();
|
||||
expect(changedTileMapData.length).to.not.equal(tileMapData.length);
|
||||
});
|
||||
|
||||
|
@ -228,7 +230,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
|
||||
await retry.try(async () => {
|
||||
const allPieSlicesColor = await PageObjects.visualize.getAllPieSliceStyles('80,000');
|
||||
const allPieSlicesColor = await pieChart.getAllPieSliceStyles('80,000');
|
||||
let whitePieSliceCounts = 0;
|
||||
allPieSlicesColor.forEach(style => {
|
||||
if (style.indexOf('rgb(255, 255, 255)') > 0) {
|
||||
|
@ -255,7 +257,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
|
||||
await retry.try(async () => {
|
||||
const pieSliceStyle = await PageObjects.visualize.getPieSliceStyle('80,000');
|
||||
const pieSliceStyle = await pieChart.getPieSliceStyle('80,000');
|
||||
// The default green color that was stored with the visualization before any dashboard overrides.
|
||||
expect(pieSliceStyle.indexOf('rgb(87, 193, 123)')).to.be.greaterThan(0);
|
||||
});
|
||||
|
|
|
@ -21,6 +21,7 @@ import { PIE_CHART_VIS_NAME } from '../../page_objects/dashboard_page';
|
|||
|
||||
export default function ({ getService, getPageObjects }) {
|
||||
const dashboardExpect = getService('dashboardExpect');
|
||||
const pieChart = getService('pieChart');
|
||||
const dashboardVisualizations = getService('dashboardVisualizations');
|
||||
const PageObjects = getPageObjects(['dashboard', 'header', 'visualize']);
|
||||
|
||||
|
@ -41,10 +42,10 @@ export default function ({ getService, getPageObjects }) {
|
|||
it('Visualization updated when time picker changes', async () => {
|
||||
await PageObjects.dashboard.clickNewDashboard();
|
||||
await PageObjects.dashboard.addVisualizations([PIE_CHART_VIS_NAME]);
|
||||
await dashboardExpect.pieSliceCount(0);
|
||||
await pieChart.expectPieSliceCount(0);
|
||||
|
||||
await PageObjects.dashboard.setTimepickerInHistoricalDataRange();
|
||||
await dashboardExpect.pieSliceCount(10);
|
||||
await pieChart.expectPieSliceCount(10);
|
||||
});
|
||||
|
||||
it('Saved search updated when time picker changes', async () => {
|
||||
|
|
|
@ -30,12 +30,13 @@ import expect from 'expect.js';
|
|||
export default function ({ getService, getPageObjects }) {
|
||||
const find = getService('find');
|
||||
const browser = getService('browser');
|
||||
const pieChart = getService('pieChart');
|
||||
const dashboardExpect = getService('dashboardExpect');
|
||||
const dashboardAddPanel = getService('dashboardAddPanel');
|
||||
const PageObjects = getPageObjects(['common', 'dashboard', 'header', 'visualize', 'discover']);
|
||||
|
||||
const expectAllDataRenders = async () => {
|
||||
await dashboardExpect.pieSliceCount(16);
|
||||
await pieChart.expectPieSliceCount(16);
|
||||
await dashboardExpect.seriesElementCount(19);
|
||||
await dashboardExpect.dataTableRowCount(5);
|
||||
await dashboardExpect.savedSearchRowCount(50);
|
||||
|
@ -57,7 +58,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
};
|
||||
|
||||
const expectNoDataRenders = async () => {
|
||||
await dashboardExpect.pieSliceCount(0);
|
||||
await pieChart.expectPieSliceCount(0);
|
||||
await dashboardExpect.seriesElementCount(0);
|
||||
await dashboardExpect.dataTableRowCount(0);
|
||||
await dashboardExpect.savedSearchRowCount(0);
|
||||
|
|
|
@ -21,7 +21,7 @@ import path from 'path';
|
|||
import expect from 'expect.js';
|
||||
|
||||
export default function ({ getService, getPageObjects }) {
|
||||
const dashboardExpect = getService('dashboardExpect');
|
||||
const pieChart = getService('pieChart');
|
||||
const PageObjects = getPageObjects(['dashboard', 'header', 'settings', 'common']);
|
||||
|
||||
describe('dashboard time zones', () => {
|
||||
|
@ -43,7 +43,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
it('Exported dashboard adjusts EST time to UTC', async () => {
|
||||
const timeRange = await PageObjects.header.getPrettyDuration();
|
||||
expect(timeRange).to.be('April 10th 2018, 03:00:00.000 to April 10th 2018, 04:00:00.000');
|
||||
await dashboardExpect.pieSliceCount(4);
|
||||
await pieChart.expectPieSliceCount(4);
|
||||
});
|
||||
|
||||
it('Changing timezone changes dashboard timestamp and shows the same data', async () => {
|
||||
|
@ -54,7 +54,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
await PageObjects.dashboard.loadSavedDashboard('time zone test');
|
||||
const timeRange = await PageObjects.header.getPrettyDuration();
|
||||
expect(timeRange).to.be('April 9th 2018, 22:00:00.000 to April 9th 2018, 23:00:00.000');
|
||||
await dashboardExpect.pieSliceCount(4);
|
||||
await pieChart.expectPieSliceCount(4);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
const PageObjects = getPageObjects(['common', 'header', 'visualize']);
|
||||
const esArchiver = getService('esArchiver');
|
||||
const kibanaServer = getService('kibanaServer');
|
||||
const inspector = getService('inspector');
|
||||
|
||||
const STATS_ROW_NAME_INDEX = 0;
|
||||
const STATS_ROW_VALUE_INDEX = 1;
|
||||
|
@ -47,12 +48,12 @@ export default function ({ getService, getPageObjects }) {
|
|||
});
|
||||
|
||||
afterEach(async () => {
|
||||
await PageObjects.visualize.closeInspector();
|
||||
await inspector.close();
|
||||
});
|
||||
|
||||
it('should display request stats with no results', async () => {
|
||||
await PageObjects.visualize.openInspector();
|
||||
const requestStats = await PageObjects.visualize.getInspectorTableData();
|
||||
await inspector.open();
|
||||
const requestStats = await inspector.getTableData();
|
||||
|
||||
expect(getHitCount(requestStats)).to.be('0');
|
||||
});
|
||||
|
@ -60,8 +61,8 @@ export default function ({ getService, getPageObjects }) {
|
|||
it('should display request stats with results', async () => {
|
||||
await PageObjects.header.setAbsoluteRange('2015-09-19 06:31:44.000', '2015-09-23 18:31:44.000');
|
||||
|
||||
await PageObjects.visualize.openInspector();
|
||||
const requestStats = await PageObjects.visualize.getInspectorTableData();
|
||||
await inspector.open();
|
||||
const requestStats = await inspector.getTableData();
|
||||
|
||||
expect(getHitCount(requestStats)).to.be('14004');
|
||||
});
|
||||
|
|
|
@ -22,6 +22,7 @@ import expect from 'expect.js';
|
|||
export default function ({ getService, getPageObjects }) {
|
||||
const retry = getService('retry');
|
||||
const find = getService('find');
|
||||
const pieChart = getService('pieChart');
|
||||
const dashboardExpect = getService('dashboardExpect');
|
||||
const PageObjects = getPageObjects(['common', 'header', 'home', 'dashboard']);
|
||||
|
||||
|
@ -91,7 +92,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
|
||||
|
||||
it.skip('pie charts rendered', async () => {
|
||||
await dashboardExpect.pieSliceCount(4);
|
||||
await pieChart.expectPieSliceCount(4);
|
||||
});
|
||||
|
||||
it.skip('area, bar and heatmap charts rendered', async () => {
|
||||
|
|
|
@ -36,6 +36,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
const log = getService('log');
|
||||
const browser = getService('browser');
|
||||
const retry = getService('retry');
|
||||
const inspector = getService('inspector');
|
||||
const testSubjects = getService('testSubjects');
|
||||
const PageObjects = getPageObjects(['common', 'header', 'settings', 'visualize', 'discover']);
|
||||
|
||||
|
@ -131,13 +132,9 @@ export default function ({ getService, getPageObjects }) {
|
|||
await PageObjects.discover.clickFieldListItemVisualize(scriptedPainlessFieldName);
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
await PageObjects.visualize.waitForVisualization();
|
||||
await PageObjects.visualize.openInspector();
|
||||
await PageObjects.visualize.setInspectorTablePageSize(50);
|
||||
const data = await PageObjects.visualize.getInspectorTableData();
|
||||
await log.debug('getDataTableData = ' + data);
|
||||
await log.debug('data=' + data);
|
||||
await log.debug('data.length=' + data.length);
|
||||
expect(data).to.eql(expectedChartValues);
|
||||
await inspector.open();
|
||||
await inspector.setTablePageSize(50);
|
||||
await inspector.expectTableData(expectedChartValues);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -195,12 +192,8 @@ export default function ({ getService, getPageObjects }) {
|
|||
await PageObjects.discover.clickFieldListItemVisualize(scriptedPainlessFieldName2);
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
await PageObjects.visualize.waitForVisualization();
|
||||
await PageObjects.visualize.openInspector();
|
||||
const data = await PageObjects.visualize.getInspectorTableData();
|
||||
await log.debug('getDataTableData = ' + data);
|
||||
await log.debug('data=' + data);
|
||||
await log.debug('data.length=' + data.length);
|
||||
expect(data).to.eql([
|
||||
await inspector.open();
|
||||
await inspector.expectTableData([
|
||||
['good', '359'],
|
||||
['bad', '27']
|
||||
]);
|
||||
|
@ -261,12 +254,8 @@ export default function ({ getService, getPageObjects }) {
|
|||
await PageObjects.discover.clickFieldListItemVisualize(scriptedPainlessFieldName2);
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
await PageObjects.visualize.waitForVisualization();
|
||||
await PageObjects.visualize.openInspector();
|
||||
const data = await PageObjects.visualize.getInspectorTableData();
|
||||
await log.debug('getDataTableData = ' + data);
|
||||
await log.debug('data=' + data);
|
||||
await log.debug('data.length=' + data.length);
|
||||
expect(data).to.eql([
|
||||
await inspector.open();
|
||||
await inspector.expectTableData([
|
||||
['true', '359'],
|
||||
['false', '27']
|
||||
]);
|
||||
|
@ -327,13 +316,9 @@ export default function ({ getService, getPageObjects }) {
|
|||
await PageObjects.discover.clickFieldListItemVisualize(scriptedPainlessFieldName2);
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
await PageObjects.visualize.waitForVisualization();
|
||||
await PageObjects.visualize.openInspector();
|
||||
await PageObjects.visualize.setInspectorTablePageSize(50);
|
||||
const data = await PageObjects.visualize.getInspectorTableData();
|
||||
await log.debug('getDataTableData = ' + data);
|
||||
await log.debug('data=' + data);
|
||||
await log.debug('data.length=' + data.length);
|
||||
expect(data).to.eql([
|
||||
await inspector.open();
|
||||
await inspector.setTablePageSize(50);
|
||||
await inspector.expectTableData([
|
||||
['2015-09-17 20:00', '1'],
|
||||
['2015-09-17 21:00', '1'],
|
||||
['2015-09-17 23:00', '1'],
|
||||
|
|
|
@ -21,6 +21,7 @@ import expect from 'expect.js';
|
|||
|
||||
export default function ({ getService, getPageObjects }) {
|
||||
const log = getService('log');
|
||||
const inspector = getService('inspector');
|
||||
const browser = getService('browser');
|
||||
const retry = getService('retry');
|
||||
const PageObjects = getPageObjects(['common', 'visualize', 'header', 'settings']);
|
||||
|
@ -81,12 +82,10 @@ export default function ({ getService, getPageObjects }) {
|
|||
await PageObjects.visualize.waitForVisualizationSavedToastGone();
|
||||
await PageObjects.visualize.loadSavedVisualization(vizName1);
|
||||
await PageObjects.visualize.waitForVisualization();
|
||||
return PageObjects.common.sleep(2000);
|
||||
});
|
||||
|
||||
it('should have inspector enabled', async function () {
|
||||
const spyToggleExists = await PageObjects.visualize.isInspectorButtonEnabled();
|
||||
expect(spyToggleExists).to.be(true);
|
||||
await inspector.expectIsEnabled();
|
||||
});
|
||||
|
||||
it('should show correct chart', async function () {
|
||||
|
@ -140,11 +139,9 @@ export default function ({ getService, getPageObjects }) {
|
|||
['2015-09-22 21:00', '29']
|
||||
];
|
||||
|
||||
await PageObjects.visualize.openInspector();
|
||||
await PageObjects.visualize.setInspectorTablePageSize(50);
|
||||
const data = await PageObjects.visualize.getInspectorTableData();
|
||||
log.debug('getDataTableData = ' + data);
|
||||
expect(data).to.eql(expectedTableData);
|
||||
await inspector.open();
|
||||
await inspector.setTablePageSize(50);
|
||||
await inspector.expectTableData(expectedTableData);
|
||||
});
|
||||
|
||||
it('should hide side editor if embed is set to true in url', async () => {
|
||||
|
|
|
@ -21,6 +21,7 @@ import expect from 'expect.js';
|
|||
|
||||
export default function ({ getService, getPageObjects }) {
|
||||
const log = getService('log');
|
||||
const inspector = getService('inspector');
|
||||
const retry = getService('retry');
|
||||
const filterBar = getService('filterBar');
|
||||
const renderable = getService('renderable');
|
||||
|
@ -77,8 +78,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
});
|
||||
|
||||
it('should have inspector enabled', async function () {
|
||||
const spyToggleExists = await PageObjects.visualize.isInspectorButtonEnabled();
|
||||
expect(spyToggleExists).to.be(true);
|
||||
await inspector.expectIsEnabled();
|
||||
});
|
||||
|
||||
it('should show correct data', function () {
|
||||
|
@ -96,11 +96,9 @@ export default function ({ getService, getPageObjects }) {
|
|||
];
|
||||
|
||||
return retry.try(async function () {
|
||||
await PageObjects.visualize.openInspector();
|
||||
const data = await PageObjects.visualize.getInspectorTableData();
|
||||
await PageObjects.visualize.closeInspector();
|
||||
log.debug(data);
|
||||
expect(data).to.eql(expectedChartData);
|
||||
await inspector.open();
|
||||
await inspector.expectTableData(expectedChartData);
|
||||
await inspector.close();
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ import expect from 'expect.js';
|
|||
|
||||
export default function ({ getService, getPageObjects }) {
|
||||
const log = getService('log');
|
||||
const inspector = getService('inspector');
|
||||
const retry = getService('retry');
|
||||
const filterBar = getService('filterBar');
|
||||
const renderable = getService('renderable');
|
||||
|
@ -72,8 +73,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
});
|
||||
|
||||
it('should have inspector enabled', async function () {
|
||||
const spyToggleExists = await PageObjects.visualize.isInspectorButtonEnabled();
|
||||
expect(spyToggleExists).to.be(true);
|
||||
await inspector.expectIsEnabled();
|
||||
});
|
||||
|
||||
it('should show correct data', function () {
|
||||
|
@ -91,11 +91,9 @@ export default function ({ getService, getPageObjects }) {
|
|||
];
|
||||
|
||||
return retry.try(async function () {
|
||||
await PageObjects.visualize.openInspector();
|
||||
const data = await PageObjects.visualize.getInspectorTableData();
|
||||
await PageObjects.visualize.closeInspector();
|
||||
log.debug(data);
|
||||
expect(data).to.eql(expectedChartData);
|
||||
await inspector.open();
|
||||
await inspector.expectTableData(expectedChartData);
|
||||
await inspector.close();
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ import expect from 'expect.js';
|
|||
export default function ({ getService, getPageObjects }) {
|
||||
const log = getService('log');
|
||||
const retry = getService('retry');
|
||||
const inspector = getService('inspector');
|
||||
const PageObjects = getPageObjects(['common', 'visualize', 'header']);
|
||||
|
||||
describe('gauge chart', function indexPatternCreation() {
|
||||
|
@ -40,8 +41,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
|
||||
|
||||
it('should have inspector enabled', async function () {
|
||||
const spyToggleExists = await PageObjects.visualize.isInspectorButtonEnabled();
|
||||
expect(spyToggleExists).to.be(true);
|
||||
await inspector.expectIsEnabled();
|
||||
});
|
||||
|
||||
it('should show Count', function () {
|
||||
|
|
|
@ -21,6 +21,7 @@ import expect from 'expect.js';
|
|||
|
||||
export default function ({ getService, getPageObjects }) {
|
||||
const log = getService('log');
|
||||
const inspector = getService('inspector');
|
||||
const PageObjects = getPageObjects(['common', 'visualize', 'header']);
|
||||
|
||||
describe('heatmap chart', function indexPatternCreation() {
|
||||
|
@ -69,8 +70,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
});
|
||||
|
||||
it('should have inspector enabled', async function () {
|
||||
const spyToggleExists = await PageObjects.visualize.isInspectorButtonEnabled();
|
||||
expect(spyToggleExists).to.be(true);
|
||||
await inspector.expectIsEnabled();
|
||||
});
|
||||
|
||||
it('should show correct data', async function () {
|
||||
|
@ -99,11 +99,9 @@ export default function ({ getService, getPageObjects }) {
|
|||
];
|
||||
|
||||
|
||||
await PageObjects.visualize.openInspector();
|
||||
const data = await PageObjects.visualize.getInspectorTableData();
|
||||
log.debug(data);
|
||||
expect(data).to.eql(expectedChartData);
|
||||
await PageObjects.visualize.closeInspector();
|
||||
await inspector.open();
|
||||
await inspector.expectTableData(expectedChartData);
|
||||
await inspector.close();
|
||||
});
|
||||
|
||||
it('should show 4 color ranges as default colorNumbers param', async function () {
|
||||
|
|
|
@ -23,6 +23,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
const filterBar = getService('filterBar');
|
||||
const PageObjects = getPageObjects(['common', 'visualize', 'header']);
|
||||
const testSubjects = getService('testSubjects');
|
||||
const inspector = getService('inspector');
|
||||
const find = getService('find');
|
||||
const comboBox = getService('comboBox');
|
||||
|
||||
|
@ -44,8 +45,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
|
||||
|
||||
it('should not have inspector enabled', async function () {
|
||||
const spyToggleExists = await PageObjects.visualize.isInspectorButtonEnabled();
|
||||
expect(spyToggleExists).to.be(false);
|
||||
await inspector.expectIsNotEnabled();
|
||||
});
|
||||
|
||||
describe('updateFiltersOnChange is false', () => {
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import expect from 'expect.js';
|
||||
|
||||
export default function ({ getService, getPageObjects }) {
|
||||
const log = getService('log');
|
||||
const inspector = getService('inspector');
|
||||
const filterBar = getService('filterBar');
|
||||
const PageObjects = getPageObjects(['common', 'visualize', 'header']);
|
||||
|
||||
|
@ -39,9 +39,8 @@ export default function ({ getService, getPageObjects }) {
|
|||
|
||||
describe('inspector table', function indexPatternCreation() {
|
||||
it('should update table header when columns change', async function () {
|
||||
await PageObjects.visualize.openInspector();
|
||||
let headers = await PageObjects.visualize.getInspectorTableHeaders();
|
||||
expect(headers).to.eql(['Count']);
|
||||
await inspector.open();
|
||||
await inspector.expectTableHeaders(['Count']);
|
||||
|
||||
log.debug('Add Average Metric on machine.ram field');
|
||||
await PageObjects.visualize.clickAddMetric();
|
||||
|
@ -49,10 +48,8 @@ export default function ({ getService, getPageObjects }) {
|
|||
await PageObjects.visualize.selectAggregation('Average', 'metrics');
|
||||
await PageObjects.visualize.selectField('machine.ram', 'metrics');
|
||||
await PageObjects.visualize.clickGo();
|
||||
await PageObjects.visualize.openInspector();
|
||||
|
||||
headers = await PageObjects.visualize.getInspectorTableHeaders();
|
||||
expect(headers).to.eql(['Count', 'Average machine.ram']);
|
||||
await inspector.open();
|
||||
await inspector.expectTableHeaders(['Count', 'Average machine.ram']);
|
||||
});
|
||||
|
||||
describe('filtering on inspector table values', function () {
|
||||
|
@ -67,33 +64,30 @@ export default function ({ getService, getPageObjects }) {
|
|||
});
|
||||
|
||||
beforeEach(async function () {
|
||||
await PageObjects.visualize.openInspector();
|
||||
await inspector.open();
|
||||
});
|
||||
|
||||
afterEach(async function () {
|
||||
await PageObjects.visualize.closeInspector();
|
||||
await inspector.close();
|
||||
await filterBar.removeFilter('machine.os.raw');
|
||||
});
|
||||
|
||||
it('should allow filtering for values', async function () {
|
||||
let data = await PageObjects.visualize.getInspectorTableData();
|
||||
expect(data).to.eql([
|
||||
await inspector.expectTableData([
|
||||
['win 8', '2,904', '13,031,579,645.108'],
|
||||
['win xp', '2,858', '13,073,190,186.423'],
|
||||
['Other', '6,920', '13,123,599,766.011'],
|
||||
]);
|
||||
|
||||
await PageObjects.visualize.filterForInspectorTableCell(1, 1);
|
||||
data = await PageObjects.visualize.getInspectorTableData();
|
||||
expect(data).to.eql([
|
||||
await inspector.filterForTableCell(1, 1);
|
||||
await inspector.expectTableData([
|
||||
['win 8', '2,904', '13,031,579,645.108'],
|
||||
]);
|
||||
});
|
||||
|
||||
it('should allow filtering out values', async function () {
|
||||
await PageObjects.visualize.filterOutInspectorTableCell(1, 1);
|
||||
const data = await PageObjects.visualize.getInspectorTableData();
|
||||
expect(data).to.eql([
|
||||
await inspector.filterOutTableCell(1, 1);
|
||||
await inspector.expectTableData([
|
||||
['win xp', '2,858', '13,073,190,186.423'],
|
||||
['win 7', '2,814', '13,186,695,551.251'],
|
||||
['Other', '4,106', '13,080,420,659.354'],
|
||||
|
@ -101,9 +95,8 @@ export default function ({ getService, getPageObjects }) {
|
|||
});
|
||||
|
||||
it('should allow filtering for other values', async function () {
|
||||
await PageObjects.visualize.filterForInspectorTableCell(1, 3);
|
||||
const data = await PageObjects.visualize.getInspectorTableData();
|
||||
expect(data).to.eql([
|
||||
await inspector.filterForTableCell(1, 3);
|
||||
await inspector.expectTableData([
|
||||
['win 7', '2,814', '13,186,695,551.251'],
|
||||
['ios', '2,784', '13,009,497,206.823'],
|
||||
['Other', '1,322', '13,228,964,670.613'],
|
||||
|
@ -111,9 +104,8 @@ export default function ({ getService, getPageObjects }) {
|
|||
});
|
||||
|
||||
it('should allow filtering out other values', async function () {
|
||||
await PageObjects.visualize.filterOutInspectorTableCell(1, 3);
|
||||
const data = await PageObjects.visualize.getInspectorTableData();
|
||||
expect(data).to.eql([
|
||||
await inspector.filterOutTableCell(1, 3);
|
||||
await inspector.expectTableData([
|
||||
['win 8', '2,904', '13,031,579,645.108'],
|
||||
['win xp', '2,858', '13,073,190,186.423'],
|
||||
]);
|
||||
|
|
|
@ -21,6 +21,7 @@ import expect from 'expect.js';
|
|||
|
||||
export default function ({ getService, getPageObjects }) {
|
||||
const log = getService('log');
|
||||
const inspector = getService('inspector');
|
||||
const retry = getService('retry');
|
||||
const PageObjects = getPageObjects(['common', 'visualize', 'header']);
|
||||
|
||||
|
@ -52,7 +53,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
before(initLineChart);
|
||||
|
||||
afterEach(async () => {
|
||||
await PageObjects.visualize.closeInspector();
|
||||
await inspector.close();
|
||||
});
|
||||
|
||||
it('should show correct chart', async function () {
|
||||
|
@ -77,8 +78,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
|
||||
|
||||
it('should have inspector enabled', async function () {
|
||||
const spyToggleExists = await PageObjects.visualize.isInspectorButtonEnabled();
|
||||
expect(spyToggleExists).to.be(true);
|
||||
await inspector.expectIsEnabled();
|
||||
});
|
||||
|
||||
it('should show correct chart order by Term', async function () {
|
||||
|
@ -107,10 +107,8 @@ export default function ({ getService, getPageObjects }) {
|
|||
|
||||
const expectedChartData = [['png', '1,373'], ['php', '445'], ['jpg', '9,109'], ['gif', '918'], ['css', '2,159']];
|
||||
|
||||
await PageObjects.visualize.openInspector();
|
||||
const data = await PageObjects.visualize.getInspectorTableData();
|
||||
log.debug(data);
|
||||
expect(data).to.eql(expectedChartData);
|
||||
await inspector.open();
|
||||
await inspector.expectTableData(expectedChartData);
|
||||
});
|
||||
|
||||
it('should be able to save and load', async function () {
|
||||
|
|
|
@ -22,6 +22,7 @@ import expect from 'expect.js';
|
|||
export default function ({ getPageObjects, getService }) {
|
||||
const PageObjects = getPageObjects(['common', 'visualize', 'header']);
|
||||
const find = getService('find');
|
||||
const inspector = getService('inspector');
|
||||
const markdown = `
|
||||
# Heading 1
|
||||
|
||||
|
@ -39,8 +40,7 @@ export default function ({ getPageObjects, getService }) {
|
|||
describe('markdown vis', async () => {
|
||||
|
||||
it('should not have inspector enabled', async function () {
|
||||
const spyToggleExists = await PageObjects.visualize.isInspectorButtonEnabled();
|
||||
expect(spyToggleExists).to.be(false);
|
||||
await inspector.expectIsNotEnabled();
|
||||
});
|
||||
|
||||
it('should render markdown as html', async function () {
|
||||
|
|
|
@ -22,6 +22,7 @@ import expect from 'expect.js';
|
|||
export default function ({ getService, getPageObjects }) {
|
||||
const log = getService('log');
|
||||
const retry = getService('retry');
|
||||
const inspector = getService('inspector');
|
||||
const PageObjects = getPageObjects(['common', 'visualize', 'header']);
|
||||
|
||||
describe('metric chart', function () {
|
||||
|
@ -39,8 +40,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
});
|
||||
|
||||
it('should have inspector enabled', async function () {
|
||||
const spyToggleExists = await PageObjects.visualize.isInspectorButtonEnabled();
|
||||
expect(spyToggleExists).to.be(true);
|
||||
await inspector.expectIsEnabled();
|
||||
});
|
||||
|
||||
it('should show Count', async function () {
|
||||
|
|
|
@ -22,6 +22,8 @@ import expect from 'expect.js';
|
|||
export default function ({ getService, getPageObjects }) {
|
||||
const log = getService('log');
|
||||
const filterBar = getService('filterBar');
|
||||
const pieChart = getService('pieChart');
|
||||
const inspector = getService('inspector');
|
||||
const PageObjects = getPageObjects(['common', 'visualize', 'header', 'settings']);
|
||||
const fromTime = '2015-09-19 06:31:44.000';
|
||||
const toTime = '2015-09-23 18:31:44.000';
|
||||
|
@ -58,22 +60,15 @@ export default function ({ getService, getPageObjects }) {
|
|||
await PageObjects.visualize.waitForVisualizationSavedToastGone();
|
||||
await PageObjects.visualize.loadSavedVisualization(vizName1);
|
||||
await PageObjects.visualize.waitForVisualization();
|
||||
// sleep a bit before trying to get the pie chart data below
|
||||
await PageObjects.common.sleep(2000);
|
||||
});
|
||||
|
||||
it('should have inspector enabled', async function () {
|
||||
const spyToggleExists = await PageObjects.visualize.isInspectorButtonEnabled();
|
||||
expect(spyToggleExists).to.be(true);
|
||||
await inspector.expectIsEnabled();
|
||||
});
|
||||
|
||||
|
||||
it('should show 10 slices in pie chart', async function () {
|
||||
const expectedPieChartSliceCount = 10;
|
||||
|
||||
const pieData = await PageObjects.visualize.getPieChartData();
|
||||
log.debug('pieData.length = ' + pieData.length);
|
||||
expect(pieData.length).to.be(expectedPieChartSliceCount);
|
||||
pieChart.expectPieSliceCount(10);
|
||||
});
|
||||
|
||||
it('should show correct data', async function () {
|
||||
|
@ -81,11 +76,9 @@ export default function ({ getService, getPageObjects }) {
|
|||
['160,000', '44'], ['200,000', '40'], ['240,000', '46'], ['280,000', '39'], ['320,000', '40'], ['360,000', '47']
|
||||
];
|
||||
|
||||
await PageObjects.visualize.openInspector();
|
||||
await PageObjects.visualize.setInspectorTablePageSize(50);
|
||||
const data = await PageObjects.visualize.getInspectorTableData();
|
||||
log.debug(data);
|
||||
expect(data).to.eql(expectedTableData);
|
||||
await inspector.open();
|
||||
await inspector.setTablePageSize(50);
|
||||
await inspector.expectTableData(expectedTableData);
|
||||
});
|
||||
|
||||
describe('other bucket', () => {
|
||||
|
@ -108,35 +101,27 @@ export default function ({ getService, getPageObjects }) {
|
|||
await PageObjects.visualize.toggleMissingBucket();
|
||||
log.debug('clickGo');
|
||||
await PageObjects.visualize.clickGo();
|
||||
const pieData = await PageObjects.visualize.getPieChartLabels();
|
||||
log.debug(`pieData.length = ${pieData.length}`);
|
||||
expect(pieData).to.eql(expectedTableData);
|
||||
await pieChart.expectPieChartLabels(expectedTableData);
|
||||
});
|
||||
|
||||
// FLAKY: https://github.com/elastic/kibana/issues/25955
|
||||
it.skip('should apply correct filter on other bucket', async () => {
|
||||
it('should apply correct filter on other bucket', async () => {
|
||||
const expectedTableData = [ 'Missing', 'osx' ];
|
||||
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
await PageObjects.visualize.filterPieSlice('Other');
|
||||
await pieChart.filterOnPieSlice('Other');
|
||||
await PageObjects.visualize.waitForVisualization();
|
||||
const pieData = await PageObjects.visualize.getPieChartLabels();
|
||||
log.debug(`pieData.length = ${pieData.length}`);
|
||||
expect(pieData).to.eql(expectedTableData);
|
||||
await pieChart.expectPieChartLabels(expectedTableData);
|
||||
await filterBar.removeFilter('machine.os.raw');
|
||||
await PageObjects.visualize.waitForVisualization();
|
||||
});
|
||||
|
||||
// FLAKY: https://github.com/elastic/kibana/issues/26323
|
||||
it.skip('should apply correct filter on other bucket by clicking on a legend', async () => {
|
||||
it('should apply correct filter on other bucket by clicking on a legend', async () => {
|
||||
const expectedTableData = [ 'Missing', 'osx' ];
|
||||
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
await PageObjects.visualize.filterLegend('Other');
|
||||
await PageObjects.visualize.waitForVisualization();
|
||||
const pieData = await PageObjects.visualize.getPieChartLabels();
|
||||
log.debug(`pieData.length = ${pieData.length}`);
|
||||
expect(pieData).to.eql(expectedTableData);
|
||||
await pieChart.expectPieChartLabels(expectedTableData);
|
||||
await filterBar.removeFilter('machine.os.raw');
|
||||
await PageObjects.visualize.waitForVisualization();
|
||||
});
|
||||
|
@ -157,9 +142,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
await PageObjects.visualize.toggleMissingBucket();
|
||||
log.debug('clickGo');
|
||||
await PageObjects.visualize.clickGo();
|
||||
const pieData = await PageObjects.visualize.getPieChartLabels();
|
||||
log.debug(`pieData.length = ${pieData.length}`);
|
||||
expect(pieData).to.eql(expectedTableData);
|
||||
await pieChart.expectPieChartLabels(expectedTableData);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -181,9 +164,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
await PageObjects.visualize.toggleDisabledAgg(2);
|
||||
await PageObjects.visualize.clickGo();
|
||||
|
||||
const pieData = await PageObjects.visualize.getPieChartLabels();
|
||||
log.debug('pieData.length = ' + pieData.length);
|
||||
expect(pieData).to.eql(expectedTableData);
|
||||
await pieChart.expectPieChartLabels(expectedTableData);
|
||||
});
|
||||
|
||||
it('should correctly save disabled agg', async () => {
|
||||
|
@ -196,9 +177,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
await PageObjects.visualize.waitForVisualization();
|
||||
|
||||
const expectedTableData = [ 'win 8', 'win xp', 'win 7', 'ios', 'osx' ];
|
||||
const pieData = await PageObjects.visualize.getPieChartLabels();
|
||||
log.debug('pieData.length = ' + pieData.length);
|
||||
expect(pieData).to.eql(expectedTableData);
|
||||
await pieChart.expectPieChartLabels(expectedTableData);
|
||||
});
|
||||
|
||||
it('should show correct result when agg is re-enabled', async () => {
|
||||
|
@ -211,9 +190,8 @@ export default function ({ getService, getPageObjects }) {
|
|||
'win 8', 'ios', 'win 7', 'win xp', 'osx', '200,000', 'win 8', 'ios', 'win xp', 'win 7', 'osx', '240,000',
|
||||
'ios', 'win 7', 'win xp', 'win 8', 'osx', '280,000', 'win xp', 'win 8', 'win 7', 'ios', 'osx', '320,000',
|
||||
'win xp', 'win 7', 'ios', 'win 8', 'osx', '360,000', 'win 7', 'win xp', 'ios', 'win 8', 'osx' ];
|
||||
const pieData = await PageObjects.visualize.getPieChartLabels();
|
||||
log.debug('pieData.length = ' + pieData.length);
|
||||
expect(pieData).to.eql(expectedTableData);
|
||||
|
||||
await pieChart.expectPieChartLabels(expectedTableData);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -241,7 +219,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
log.debug('Switch to a different time range from \"' + emptyFromTime + '\" to \"' + emptyToTime + '\"');
|
||||
await PageObjects.header.setAbsoluteRange(emptyFromTime, emptyToTime);
|
||||
await PageObjects.visualize.waitForVisualization();
|
||||
await PageObjects.visualize.expectPieChartError();
|
||||
await PageObjects.visualize.expectError();
|
||||
});
|
||||
});
|
||||
describe('multi series slice', () => {
|
||||
|
@ -325,12 +303,10 @@ export default function ({ getService, getPageObjects }) {
|
|||
[ 'osx', '1,322', 'ID', '56' ],
|
||||
[ 'osx', '1,322', 'BR', '30' ]
|
||||
];
|
||||
await PageObjects.visualize.openInspector();
|
||||
await PageObjects.visualize.setInspectorTablePageSize(50);
|
||||
const data = await PageObjects.visualize.getInspectorTableData();
|
||||
await PageObjects.visualize.closeInspector();
|
||||
log.debug(data);
|
||||
expect(data).to.eql(expectedTableData);
|
||||
await inspector.open();
|
||||
await inspector.setTablePageSize(50);
|
||||
await inspector.expectTableData(expectedTableData);
|
||||
await inspector.close();
|
||||
});
|
||||
|
||||
it ('correctly applies filter', async () => {
|
||||
|
@ -338,12 +314,10 @@ export default function ({ getService, getPageObjects }) {
|
|||
await PageObjects.visualize.filterLegend('CN');
|
||||
await PageObjects.visualize.applyFilters();
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
await PageObjects.visualize.openInspector();
|
||||
await PageObjects.visualize.setInspectorTablePageSize(50);
|
||||
const data = await PageObjects.visualize.getInspectorTableData();
|
||||
await PageObjects.visualize.closeInspector();
|
||||
log.debug(data);
|
||||
expect(data).to.eql(expectedTableData);
|
||||
await inspector.open();
|
||||
await inspector.setTablePageSize(50);
|
||||
await inspector.expectTableData(expectedTableData);
|
||||
await inspector.close();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -26,6 +26,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
const fromTime = '2015-09-19 06:31:44.000';
|
||||
const toTime = '2015-09-23 18:31:44.000';
|
||||
|
||||
const inspector = getService('inspector');
|
||||
const log = getService('log');
|
||||
const find = getService('find');
|
||||
const PageObjects = getPageObjects(['common', 'visualize', 'header', 'settings']);
|
||||
|
@ -51,15 +52,13 @@ export default function ({ getService, getPageObjects }) {
|
|||
describe('vector map', function indexPatternCreation() {
|
||||
|
||||
it('should have inspector enabled', async function () {
|
||||
const spyToggleExists = await PageObjects.visualize.isInspectorButtonEnabled();
|
||||
expect(spyToggleExists).to.be(true);
|
||||
await inspector.expectIsEnabled();
|
||||
});
|
||||
|
||||
it('should show results after clicking play (join on states)', async function () {
|
||||
const expectedData = [['CN', '2,592'], ['IN', '2,373'], ['US', '1,194'], ['ID', '489'], ['BR', '415']];
|
||||
await PageObjects.visualize.openInspector();
|
||||
const data = await PageObjects.visualize.getInspectorTableData();
|
||||
expect(data).to.eql(expectedData);
|
||||
await inspector.open();
|
||||
await inspector.expectTableData(expectedData);
|
||||
});
|
||||
|
||||
it('should change results after changing layer to world', async function () {
|
||||
|
@ -76,8 +75,8 @@ export default function ({ getService, getPageObjects }) {
|
|||
await PageObjects.visualize.selectFieldById('ISO 3166-1 alpha-2 code', 'joinField');
|
||||
await PageObjects.common.sleep(2000);//need some time for the data to load
|
||||
|
||||
await PageObjects.visualize.openInspector();
|
||||
const actualData = await PageObjects.visualize.getInspectorTableData();
|
||||
await inspector.open();
|
||||
const actualData = await inspector.getTableData();
|
||||
const expectedData = [['CN', '2,592'], ['IN', '2,373'], ['US', '1,194'], ['ID', '489'], ['BR', '415']];
|
||||
expect(actualData).to.eql(expectedData);
|
||||
});
|
||||
|
|
|
@ -22,6 +22,7 @@ import expect from 'expect.js';
|
|||
export default function ({ getService, getPageObjects }) {
|
||||
const filterBar = getService('filterBar');
|
||||
const log = getService('log');
|
||||
const inspector = getService('inspector');
|
||||
const browser = getService('browser');
|
||||
const retry = getService('retry');
|
||||
const find = getService('find');
|
||||
|
@ -55,8 +56,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
|
||||
|
||||
it('should have inspector enabled', async function () {
|
||||
const spyToggleExists = await PageObjects.visualize.isInspectorButtonEnabled();
|
||||
expect(spyToggleExists).to.be(true);
|
||||
await inspector.expectIsEnabled();
|
||||
});
|
||||
|
||||
it('should show correct tag cloud data', async function () {
|
||||
|
@ -127,11 +127,9 @@ export default function ({ getService, getPageObjects }) {
|
|||
[ '18,253,611,008', '679' ]
|
||||
];
|
||||
|
||||
await PageObjects.visualize.openInspector();
|
||||
await await PageObjects.visualize.setInspectorTablePageSize('50');
|
||||
const data = await PageObjects.visualize.getInspectorTableData();
|
||||
log.debug(data);
|
||||
expect(data).to.eql(expectedTableData);
|
||||
await inspector.open();
|
||||
await await inspector.setTablePageSize('50');
|
||||
await inspector.expectTableData(expectedTableData);
|
||||
});
|
||||
|
||||
describe('formatted field', function () {
|
||||
|
|
|
@ -22,6 +22,7 @@ import expect from 'expect.js';
|
|||
export default function ({ getService, getPageObjects }) {
|
||||
const log = getService('log');
|
||||
const retry = getService('retry');
|
||||
const inspector = getService('inspector');
|
||||
const find = getService('find');
|
||||
const testSubjects = getService('testSubjects');
|
||||
const browser = getService('browser');
|
||||
|
@ -104,8 +105,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
|
||||
describe('tile map chart', function indexPatternCreation() {
|
||||
it('should have inspector enabled', async function () {
|
||||
const spyToggleExists = await PageObjects.visualize.isInspectorButtonEnabled();
|
||||
expect(spyToggleExists).to.be(true);
|
||||
await inspector.expectIsEnabled();
|
||||
});
|
||||
|
||||
it('should show correct tile map data on default zoom level', async function () {
|
||||
|
@ -122,10 +122,10 @@ export default function ({ getService, getPageObjects }) {
|
|||
//level 0
|
||||
await PageObjects.visualize.clickMapZoomOut();
|
||||
|
||||
await PageObjects.visualize.openInspector();
|
||||
await PageObjects.visualize.setInspectorTablePageSize(50);
|
||||
const actualTableData = await PageObjects.visualize.getInspectorTableData();
|
||||
await PageObjects.visualize.closeInspector();
|
||||
await inspector.open();
|
||||
await inspector.setTablePageSize(50);
|
||||
const actualTableData = await inspector.getTableData();
|
||||
await inspector.close();
|
||||
compareTableData(actualTableData, expectedTableData);
|
||||
});
|
||||
|
||||
|
@ -161,9 +161,9 @@ export default function ({ getService, getPageObjects }) {
|
|||
];
|
||||
|
||||
await PageObjects.visualize.clickMapFitDataBounds();
|
||||
await PageObjects.visualize.openInspector();
|
||||
const data = await PageObjects.visualize.getInspectorTableData();
|
||||
await PageObjects.visualize.closeInspector();
|
||||
await inspector.open();
|
||||
const data = await inspector.getTableData();
|
||||
await inspector.close();
|
||||
compareTableData(data, expectedPrecision2DataTable);
|
||||
});
|
||||
|
||||
|
@ -174,13 +174,13 @@ export default function ({ getService, getPageObjects }) {
|
|||
await PageObjects.visualize.clickMapZoomIn();
|
||||
|
||||
const mapBounds = await PageObjects.visualize.getMapBounds();
|
||||
await PageObjects.visualize.closeInspector();
|
||||
await inspector.close();
|
||||
|
||||
await PageObjects.visualize.saveVisualizationExpectSuccess(vizName1);
|
||||
|
||||
const afterSaveMapBounds = await PageObjects.visualize.getMapBounds();
|
||||
|
||||
await PageObjects.visualize.closeInspector();
|
||||
await inspector.close();
|
||||
// For some reason the values are slightly different, so we can't check that they are equal. But we did
|
||||
// have a bug where after the save, there were _no_ map bounds. So this checks for the later case, but
|
||||
// until we figure out how to make sure the map center is always the exact same, we can't comparison check.
|
||||
|
@ -195,20 +195,18 @@ export default function ({ getService, getPageObjects }) {
|
|||
it('when checked adds filters to aggregation', async () => {
|
||||
const vizName1 = 'Visualization TileMap';
|
||||
await PageObjects.visualize.loadSavedVisualization(vizName1);
|
||||
await PageObjects.visualize.openInspector();
|
||||
const tableHeaders = await PageObjects.visualize.getInspectorTableHeaders();
|
||||
await PageObjects.visualize.closeInspector();
|
||||
expect(tableHeaders).to.eql(['filter', 'geohash_grid', 'Count', 'Geo Centroid']);
|
||||
await inspector.open();
|
||||
await inspector.expectTableHeaders(['filter', 'geohash_grid', 'Count', 'Geo Centroid']);
|
||||
await inspector.close();
|
||||
});
|
||||
|
||||
it('when not checked does not add filters to aggregation', async () => {
|
||||
await PageObjects.visualize.toggleOpenEditor(2);
|
||||
await PageObjects.visualize.toggleIsFilteredByCollarCheckbox();
|
||||
await PageObjects.visualize.clickGo();
|
||||
await PageObjects.visualize.openInspector();
|
||||
const tableHeaders = await PageObjects.visualize.getInspectorTableHeaders();
|
||||
await PageObjects.visualize.closeInspector();
|
||||
expect(tableHeaders).to.eql(['geohash_grid', 'Count', 'Geo Centroid']);
|
||||
await inspector.open();
|
||||
await inspector.expectTableHeaders(['geohash_grid', 'Count', 'Geo Centroid']);
|
||||
await inspector.close();
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
|
|
|
@ -22,6 +22,7 @@ import expect from 'expect.js';
|
|||
export default function ({ getService, getPageObjects }) {
|
||||
const esArchiver = getService('esArchiver');
|
||||
const log = getService('log');
|
||||
const inspector = getService('inspector');
|
||||
const retry = getService('retry');
|
||||
const PageObjects = getPageObjects(['common', 'visualize', 'header', 'settings', 'visualBuilder']);
|
||||
|
||||
|
@ -70,8 +71,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
});
|
||||
|
||||
it('should not have inspector enabled', async function () {
|
||||
const spyToggleExists = await PageObjects.visualize.isInspectorButtonEnabled();
|
||||
expect(spyToggleExists).to.be(false);
|
||||
await inspector.expectIsNotEnabled();
|
||||
});
|
||||
|
||||
it('should show correct data', async function () {
|
||||
|
@ -91,8 +91,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
});
|
||||
|
||||
it('should not have inspector enabled', async function () {
|
||||
const spyToggleExists = await PageObjects.visualize.isInspectorButtonEnabled();
|
||||
expect(spyToggleExists).to.be(false);
|
||||
await inspector.expectIsNotEnabled();
|
||||
});
|
||||
|
||||
it('should show correct data', async function () {
|
||||
|
|
|
@ -21,6 +21,7 @@ import expect from 'expect.js';
|
|||
|
||||
export default function ({ getService, getPageObjects }) {
|
||||
const log = getService('log');
|
||||
const inspector = getService('inspector');
|
||||
const PageObjects = getPageObjects(['common', 'visualize', 'header']);
|
||||
|
||||
describe('visualize app', () => {
|
||||
|
@ -33,8 +34,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
|
||||
describe('vega chart', () => {
|
||||
it('should not have inspector enabled', async function () {
|
||||
const spyToggleExists = await PageObjects.visualize.isInspectorButtonEnabled();
|
||||
expect(spyToggleExists).to.be(false);
|
||||
await inspector.expectIsNotEnabled();
|
||||
});
|
||||
|
||||
it.skip('should have some initial vega spec text', async function () {
|
||||
|
|
|
@ -22,6 +22,7 @@ import expect from 'expect.js';
|
|||
export default function ({ getService, getPageObjects }) {
|
||||
const log = getService('log');
|
||||
const retry = getService('retry');
|
||||
const inspector = getService('inspector');
|
||||
const PageObjects = getPageObjects(['common', 'visualize', 'header']);
|
||||
|
||||
describe('vertical bar chart', function () {
|
||||
|
@ -64,8 +65,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
});
|
||||
|
||||
it('should have inspector enabled', async function () {
|
||||
const spyToggleExists = await PageObjects.visualize.isInspectorButtonEnabled();
|
||||
expect(spyToggleExists).to.be(true);
|
||||
await inspector.expectIsEnabled();
|
||||
});
|
||||
|
||||
it('should show correct chart', async function () {
|
||||
|
@ -109,11 +109,9 @@ export default function ({ getService, getPageObjects }) {
|
|||
[ '2015-09-22 09:00', '1,408' ],
|
||||
];
|
||||
|
||||
await PageObjects.visualize.openInspector();
|
||||
const data = await PageObjects.visualize.getInspectorTableData();
|
||||
await PageObjects.visualize.closeInspector();
|
||||
log.debug(data);
|
||||
expect(data).to.eql(expectedChartData);
|
||||
await inspector.open();
|
||||
await inspector.expectTableData(expectedChartData);
|
||||
await inspector.close();
|
||||
});
|
||||
|
||||
it('should have `drop partial buckets` option', async () => {
|
||||
|
|
|
@ -22,6 +22,7 @@ import expect from 'expect.js';
|
|||
export default function ({ getService, getPageObjects }) {
|
||||
const log = getService('log');
|
||||
const retry = getService('retry');
|
||||
const inspector = getService('inspector');
|
||||
const PageObjects = getPageObjects(['common', 'visualize', 'header']);
|
||||
|
||||
describe.skip('vertical bar chart with index without time filter', function () {
|
||||
|
@ -61,8 +62,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
});
|
||||
|
||||
it('should have inspector enabled', async function () {
|
||||
const spyToggleExists = await PageObjects.visualize.isInspectorButtonEnabled();
|
||||
expect(spyToggleExists).to.be(true);
|
||||
await inspector.expectIsEnabled();
|
||||
});
|
||||
|
||||
it('should show correct chart', async function () {
|
||||
|
@ -106,10 +106,8 @@ export default function ({ getService, getPageObjects }) {
|
|||
[ '2015-09-22 09:00', '1,408' ],
|
||||
];
|
||||
|
||||
await PageObjects.visualize.openInspector();
|
||||
const data = await PageObjects.visualize.getInspectorTableData();
|
||||
log.debug(data);
|
||||
expect(data).to.eql(expectedChartData);
|
||||
await inspector.open();
|
||||
await inspector.expectTableData(expectedChartData);
|
||||
});
|
||||
|
||||
describe.skip('switch between Y axis scale types', () => {
|
||||
|
|
|
@ -55,6 +55,8 @@ import {
|
|||
RenderableProvider,
|
||||
TableProvider,
|
||||
BrowserProvider,
|
||||
InspectorProvider,
|
||||
PieChartProvider,
|
||||
} from './services';
|
||||
|
||||
export default async function ({ readConfigFile }) {
|
||||
|
@ -115,6 +117,8 @@ export default async function ({ readConfigFile }) {
|
|||
renderable: RenderableProvider,
|
||||
table: TableProvider,
|
||||
browser: BrowserProvider,
|
||||
pieChart: PieChartProvider,
|
||||
inspector: InspectorProvider,
|
||||
},
|
||||
servers: commonConfig.get('servers'),
|
||||
|
||||
|
|
|
@ -562,28 +562,6 @@ export function DashboardPageProvider({ getService, getPageObjects }) {
|
|||
return _.map(filters, async (filter) => await filter.getVisibleText());
|
||||
}
|
||||
|
||||
async getPieSliceCount(timeout) {
|
||||
log.debug('getPieSliceCount');
|
||||
return await retry.try(async () => {
|
||||
const slices = await find.allByCssSelector('svg > g > g.arcs > path.slice', timeout);
|
||||
return slices.length;
|
||||
});
|
||||
}
|
||||
|
||||
async filterOnPieSlice(sliceValue) {
|
||||
log.debug(`Filtering on a pie slice with optional value ${sliceValue}`);
|
||||
if (sliceValue) {
|
||||
await testSubjects.click(`pieSlice-${sliceValue}`);
|
||||
} else {
|
||||
// If no pie slice has been provided, find the first one available.
|
||||
await retry.try(async () => {
|
||||
const slices = await find.allByCssSelector('svg > g > g.arcs > path.slice');
|
||||
log.debug('Slices found:' + slices.length);
|
||||
return slices[0].click();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async getSharedItemsCount() {
|
||||
log.debug('in getSharedItemsCount');
|
||||
const attributeName = 'data-shared-items-count';
|
||||
|
|
|
@ -28,7 +28,7 @@ export function VisualizePageProvider({ getService, getPageObjects }) {
|
|||
const retry = getService('retry');
|
||||
const find = getService('find');
|
||||
const log = getService('log');
|
||||
const flyout = getService('flyout');
|
||||
const inspector = getService('inspector');
|
||||
const renderable = getService('renderable');
|
||||
const table = getService('table');
|
||||
const PageObjects = getPageObjects(['common', 'header']);
|
||||
|
@ -289,41 +289,10 @@ export function VisualizePageProvider({ getService, getPageObjects }) {
|
|||
await options[optionIndex].click();
|
||||
}
|
||||
|
||||
async isInspectorButtonEnabled() {
|
||||
const button = await testSubjects.find('openInspectorButton');
|
||||
const ariaDisabled = await button.getAttribute('aria-disabled');
|
||||
return ariaDisabled !== 'true';
|
||||
}
|
||||
|
||||
async getSideEditorExists() {
|
||||
return await find.existsByCssSelector('.collapsible-sidebar');
|
||||
}
|
||||
|
||||
async openInspector() {
|
||||
log.debug('Open Inspector');
|
||||
const isOpen = await testSubjects.exists('inspectorPanel');
|
||||
if (!isOpen) {
|
||||
await retry.try(async () => {
|
||||
await testSubjects.click('openInspectorButton');
|
||||
await testSubjects.find('inspectorPanel');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async closeInspector() {
|
||||
log.debug('Close Inspector');
|
||||
let isOpen = await testSubjects.exists('inspectorPanel');
|
||||
if (isOpen) {
|
||||
await retry.try(async () => {
|
||||
await flyout.close('inspectorPanel');
|
||||
isOpen = await testSubjects.exists('inspectorPanel');
|
||||
if (isOpen) {
|
||||
throw new Error('Failed to close inspector');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async setInspectorTablePageSize(size) {
|
||||
const panel = await testSubjects.find('inspectorPanel');
|
||||
await find.clickByButtonText('Rows per page: 20', panel);
|
||||
|
@ -881,25 +850,7 @@ export function VisualizePageProvider({ getService, getPageObjects }) {
|
|||
return await Promise.all(getChartTypesPromises);
|
||||
}
|
||||
|
||||
async getPieChartData() {
|
||||
const chartTypes = await find.allByCssSelector('path.slice', defaultFindTimeout * 2);
|
||||
|
||||
const getChartTypesPromises = chartTypes.map(async chart => await chart.getAttribute('d'));
|
||||
return await Promise.all(getChartTypesPromises);
|
||||
}
|
||||
|
||||
async getPieChartLabels() {
|
||||
// Outer retry is because because of stale element references getting thrown on grabbing the data-label.
|
||||
// I suspect it's due to a rendering bug with pie charts not emitting the render-complete flag
|
||||
// when actually done rendering.
|
||||
return await retry.try(async () => {
|
||||
const chartTypes = await find.allByCssSelector('path.slice', defaultFindTimeout * 2);
|
||||
|
||||
const getChartTypesPromises = chartTypes.map(async chart => await chart.getAttribute('data-label'));
|
||||
return await Promise.all(getChartTypesPromises);
|
||||
});
|
||||
}
|
||||
async expectPieChartError() {
|
||||
async expectError() {
|
||||
return await testSubjects.existOrFail('visLibVisualizeError');
|
||||
}
|
||||
|
||||
|
@ -953,32 +904,6 @@ export function VisualizePageProvider({ getService, getPageObjects }) {
|
|||
});
|
||||
}
|
||||
|
||||
async getInspectorTableData() {
|
||||
// TODO: we should use datat-test-subj=inspectorTable as soon as EUI supports it
|
||||
const inspectorPanel = await testSubjects.find('inspectorPanel');
|
||||
const tableBody = await retry.try(async () => inspectorPanel.findByTagName('tbody'));
|
||||
// Convert the data into a nested array format:
|
||||
// [ [cell1_in_row1, cell2_in_row1], [cell1_in_row2, cell2_in_row2] ]
|
||||
const rows = await tableBody.findAllByTagName('tr');
|
||||
return await Promise.all(rows.map(async row => {
|
||||
const cells = await row.findAllByTagName('td');
|
||||
return await Promise.all(cells.map(async cell => cell.getVisibleText()));
|
||||
}));
|
||||
}
|
||||
|
||||
async getInspectorTableHeaders() {
|
||||
// TODO: we should use datat-test-subj=inspectorTable as soon as EUI supports it
|
||||
const dataTableHeader = await retry.try(async () => {
|
||||
const inspectorPanel = await testSubjects.find('inspectorPanel');
|
||||
return await inspectorPanel.findByTagName('thead');
|
||||
});
|
||||
const cells = await dataTableHeader.findAllByTagName('th');
|
||||
return await Promise.all(cells.map(async (cell) => {
|
||||
const untrimmed = await cell.getVisibleText();
|
||||
return untrimmed.trim();
|
||||
}));
|
||||
}
|
||||
|
||||
async toggleIsFilteredByCollarCheckbox() {
|
||||
await testSubjects.click('isFilteredByCollarCheckbox');
|
||||
}
|
||||
|
@ -1016,7 +941,7 @@ export function VisualizePageProvider({ getService, getPageObjects }) {
|
|||
|
||||
async getVisualizationRequest() {
|
||||
log.debug('getVisualizationRequest');
|
||||
await this.openInspector();
|
||||
await inspector.open();
|
||||
await testSubjects.click('inspectorViewChooser');
|
||||
await testSubjects.click('inspectorViewChooserRequests');
|
||||
await testSubjects.click('inspectorRequestDetailRequest');
|
||||
|
@ -1025,7 +950,7 @@ export function VisualizePageProvider({ getService, getPageObjects }) {
|
|||
|
||||
async getVisualizationResponse() {
|
||||
log.debug('getVisualizationResponse');
|
||||
await this.openInspector();
|
||||
await inspector.open();
|
||||
await testSubjects.click('inspectorViewChooser');
|
||||
await testSubjects.click('inspectorViewChooserRequests');
|
||||
await testSubjects.click('inspectorRequestDetailResponse');
|
||||
|
@ -1131,28 +1056,6 @@ export function VisualizePageProvider({ getService, getPageObjects }) {
|
|||
});
|
||||
}
|
||||
|
||||
async filterForInspectorTableCell(column, row) {
|
||||
await retry.try(async () => {
|
||||
const table = await testSubjects.find('inspectorTable');
|
||||
const cell = await table.findByCssSelector(`tbody tr:nth-child(${row}) td:nth-child(${column})`);
|
||||
await browser.moveMouseTo(cell);
|
||||
const filterBtn = await testSubjects.findDescendant('filterForInspectorCellValue', cell);
|
||||
await filterBtn.click();
|
||||
});
|
||||
await renderable.waitForRender();
|
||||
}
|
||||
|
||||
async filterOutInspectorTableCell(column, row) {
|
||||
await retry.try(async () => {
|
||||
const table = await testSubjects.find('inspectorTable');
|
||||
const cell = await table.findByCssSelector(`tbody tr:nth-child(${row}) td:nth-child(${column})`);
|
||||
await browser.moveMouseTo(cell);
|
||||
const filterBtn = await testSubjects.findDescendant('filterOutInspectorCellValue', cell);
|
||||
await filterBtn.click();
|
||||
});
|
||||
await renderable.waitForRender();
|
||||
}
|
||||
|
||||
async toggleLegend(show = true) {
|
||||
await retry.try(async () => {
|
||||
const isVisible = find.byCssSelector('vislib-legend');
|
||||
|
@ -1190,31 +1093,6 @@ export function VisualizePageProvider({ getService, getPageObjects }) {
|
|||
return await bucketType.click();
|
||||
}
|
||||
|
||||
async filterPieSlice(name) {
|
||||
const slice = await this.getPieSlice(name);
|
||||
await slice.click();
|
||||
}
|
||||
|
||||
async getPieSlice(name) {
|
||||
return await testSubjects.find(`pieSlice-${name.split(' ').join('-')}`);
|
||||
}
|
||||
|
||||
async getAllPieSlices(name) {
|
||||
return await testSubjects.findAll(`pieSlice-${name.split(' ').join('-')}`);
|
||||
}
|
||||
|
||||
async getPieSliceStyle(name) {
|
||||
log.debug(`VisualizePage.getPieSliceStyle(${name})`);
|
||||
const pieSlice = await this.getPieSlice(name);
|
||||
return await pieSlice.getAttribute('style');
|
||||
}
|
||||
|
||||
async getAllPieSliceStyles(name) {
|
||||
log.debug(`VisualizePage.getAllPieSliceStyles(${name})`);
|
||||
const pieSlices = await this.getAllPieSlices(name);
|
||||
return await Promise.all(pieSlices.map(async pieSlice => await pieSlice.getAttribute('style')));
|
||||
}
|
||||
|
||||
async getBucketErrorMessage() {
|
||||
const error = await find.byCssSelector('.visEditorAggParam__error');
|
||||
const errorMessage = await error.getProperty('innerText');
|
||||
|
|
|
@ -28,13 +28,6 @@ export function DashboardExpectProvider({ getService, getPageObjects }) {
|
|||
const PageObjects = getPageObjects(['dashboard', 'visualize']);
|
||||
|
||||
return new class DashboardExpect {
|
||||
async pieSliceCount(expectedCount) {
|
||||
log.debug(`DashboardExpect.expectPieSliceCount(${expectedCount})`);
|
||||
await retry.try(async () => {
|
||||
const slicesCount = await PageObjects.dashboard.getPieSliceCount();
|
||||
expect(slicesCount).to.be(expectedCount);
|
||||
});
|
||||
}
|
||||
|
||||
async panelCount(expectedCount) {
|
||||
log.debug(`DashboardExpect.panelCount(${expectedCount})`);
|
||||
|
|
|
@ -32,5 +32,7 @@ export { ComboBoxProvider } from './combo_box';
|
|||
export { RenderableProvider } from './renderable';
|
||||
export { TableProvider } from './table';
|
||||
export { BrowserProvider } from './browser';
|
||||
export { InspectorProvider } from './inspector';
|
||||
|
||||
export * from './visualizations';
|
||||
export * from './dashboard';
|
||||
|
|
149
test/functional/services/inspector.js
Normal file
149
test/functional/services/inspector.js
Normal file
|
@ -0,0 +1,149 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import expect from 'expect.js';
|
||||
|
||||
export function InspectorProvider({ getService }) {
|
||||
const log = getService('log');
|
||||
const retry = getService('retry');
|
||||
const browser = getService('browser');
|
||||
const renderable = getService('renderable');
|
||||
const flyout = getService('flyout');
|
||||
const testSubjects = getService('testSubjects');
|
||||
const find = getService('find');
|
||||
|
||||
return new class Inspector {
|
||||
async getIsEnabled() {
|
||||
const button = await testSubjects.find('openInspectorButton');
|
||||
const ariaDisabled = await button.getAttribute('aria-disabled');
|
||||
return ariaDisabled !== 'true';
|
||||
}
|
||||
|
||||
async expectIsEnabled() {
|
||||
await retry.try(async () => {
|
||||
const isEnabled = await this.getIsEnabled();
|
||||
expect(isEnabled).to.be(true);
|
||||
});
|
||||
}
|
||||
|
||||
async expectIsNotEnabled() {
|
||||
await retry.try(async () => {
|
||||
const isEnabled = await this.getIsEnabled();
|
||||
expect(isEnabled).to.be(false);
|
||||
});
|
||||
}
|
||||
|
||||
async open() {
|
||||
log.debug('Inspector.open');
|
||||
const isOpen = await testSubjects.exists('inspectorPanel');
|
||||
if (!isOpen) {
|
||||
await retry.try(async () => {
|
||||
await testSubjects.click('openInspectorButton');
|
||||
await testSubjects.find('inspectorPanel');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async close() {
|
||||
log.debug('Close Inspector');
|
||||
let isOpen = await testSubjects.exists('inspectorPanel');
|
||||
if (isOpen) {
|
||||
await retry.try(async () => {
|
||||
await flyout.close('inspectorPanel');
|
||||
isOpen = await testSubjects.exists('inspectorPanel');
|
||||
if (isOpen) {
|
||||
throw new Error('Failed to close inspector');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async expectTableData(expectedData) {
|
||||
await log.debug(`Inspector.expectTableData(${expectedData.join(',')})`);
|
||||
const data = await this.getTableData();
|
||||
expect(data).to.eql(expectedData);
|
||||
}
|
||||
|
||||
async setTablePageSize(size) {
|
||||
const panel = await testSubjects.find('inspectorPanel');
|
||||
await find.clickByButtonText('Rows per page: 20', panel);
|
||||
// The buttons for setting table page size are in a popover element. This popover
|
||||
// element appears as if it's part of the inspectorPanel but it's really attached
|
||||
// to the body element by a portal.
|
||||
const tableSizesPopover = await find.byCssSelector('.euiPanel');
|
||||
await find.clickByButtonText(`${size} rows`, tableSizesPopover);
|
||||
}
|
||||
|
||||
async getTableData() {
|
||||
// TODO: we should use datat-test-subj=inspectorTable as soon as EUI supports it
|
||||
const inspectorPanel = await testSubjects.find('inspectorPanel');
|
||||
const tableBody = await retry.try(async () => inspectorPanel.findByTagName('tbody'));
|
||||
// Convert the data into a nested array format:
|
||||
// [ [cell1_in_row1, cell2_in_row1], [cell1_in_row2, cell2_in_row2] ]
|
||||
const rows = await tableBody.findAllByTagName('tr');
|
||||
return await Promise.all(rows.map(async row => {
|
||||
const cells = await row.findAllByTagName('td');
|
||||
return await Promise.all(cells.map(async cell => cell.getVisibleText()));
|
||||
}));
|
||||
}
|
||||
|
||||
async getTableHeaders() {
|
||||
log.debug('Inspector.getTableHeaders');
|
||||
// TODO: we should use datat-test-subj=inspectorTable as soon as EUI supports it
|
||||
const dataTableHeader = await retry.try(async () => {
|
||||
const inspectorPanel = await testSubjects.find('inspectorPanel');
|
||||
return await inspectorPanel.findByTagName('thead');
|
||||
});
|
||||
const cells = await dataTableHeader.findAllByTagName('th');
|
||||
return await Promise.all(cells.map(async (cell) => {
|
||||
const untrimmed = await cell.getVisibleText();
|
||||
return untrimmed.trim();
|
||||
}));
|
||||
}
|
||||
|
||||
async expectTableHeaders(expected) {
|
||||
await retry.try(async () => {
|
||||
const headers = await this.getTableHeaders();
|
||||
expect(headers).to.eql(expected);
|
||||
});
|
||||
}
|
||||
|
||||
async filterForTableCell(column, row) {
|
||||
await retry.try(async () => {
|
||||
const table = await testSubjects.find('inspectorTable');
|
||||
const cell = await table.findByCssSelector(`tbody tr:nth-child(${row}) td:nth-child(${column})`);
|
||||
await browser.moveMouseTo(cell);
|
||||
const filterBtn = await testSubjects.findDescendant('filterForInspectorCellValue', cell);
|
||||
await filterBtn.click();
|
||||
});
|
||||
await renderable.waitForRender();
|
||||
}
|
||||
|
||||
async filterOutTableCell(column, row) {
|
||||
await retry.try(async () => {
|
||||
const table = await testSubjects.find('inspectorTable');
|
||||
const cell = await table.findByCssSelector(`tbody tr:nth-child(${row}) td:nth-child(${column})`);
|
||||
await browser.moveMouseTo(cell);
|
||||
const filterBtn = await testSubjects.findDescendant('filterOutInspectorCellValue', cell);
|
||||
await filterBtn.click();
|
||||
});
|
||||
await renderable.waitForRender();
|
||||
}
|
||||
};
|
||||
}
|
20
test/functional/services/visualizations/index.js
Normal file
20
test/functional/services/visualizations/index.js
Normal file
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
export { PieChartProvider } from './pie_chart';
|
111
test/functional/services/visualizations/pie_chart.js
Normal file
111
test/functional/services/visualizations/pie_chart.js
Normal file
|
@ -0,0 +1,111 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import expect from 'expect.js';
|
||||
|
||||
export function PieChartProvider({ getService }) {
|
||||
const log = getService('log');
|
||||
const retry = getService('retry');
|
||||
const config = getService('config');
|
||||
const inspector = getService('inspector');
|
||||
const testSubjects = getService('testSubjects');
|
||||
const find = getService('find');
|
||||
const defaultFindTimeout = config.get('timeouts.find');
|
||||
|
||||
return new class PieChart {
|
||||
|
||||
async filterOnPieSlice(name) {
|
||||
log.debug(`PieChart.filterOnPieSlice(${name})`);
|
||||
if (name) {
|
||||
await testSubjects.click(`pieSlice-${name.split(' ').join('-')}`);
|
||||
} else {
|
||||
// If no pie slice has been provided, find the first one available.
|
||||
await retry.try(async () => {
|
||||
const slices = await find.allByCssSelector('svg > g > g.arcs > path.slice');
|
||||
log.debug('Slices found:' + slices.length);
|
||||
return slices[0].click();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async getPieSlice(name) {
|
||||
return await testSubjects.find(`pieSlice-${name.split(' ').join('-')}`);
|
||||
}
|
||||
|
||||
async getAllPieSlices(name) {
|
||||
return await testSubjects.findAll(`pieSlice-${name.split(' ').join('-')}`);
|
||||
}
|
||||
|
||||
async getPieSliceStyle(name) {
|
||||
log.debug(`VisualizePage.getPieSliceStyle(${name})`);
|
||||
const pieSlice = await this.getPieSlice(name);
|
||||
return await pieSlice.getAttribute('style');
|
||||
}
|
||||
|
||||
async getAllPieSliceStyles(name) {
|
||||
log.debug(`VisualizePage.getAllPieSliceStyles(${name})`);
|
||||
const pieSlices = await this.getAllPieSlices(name);
|
||||
return await Promise.all(pieSlices.map(async pieSlice => await pieSlice.getAttribute('style')));
|
||||
}
|
||||
|
||||
async getPieChartData() {
|
||||
const chartTypes = await find.allByCssSelector('path.slice', defaultFindTimeout * 2);
|
||||
|
||||
const getChartTypesPromises = chartTypes.map(async chart => await chart.getAttribute('d'));
|
||||
return await Promise.all(getChartTypesPromises);
|
||||
}
|
||||
|
||||
async expectPieChartTableData(expectedTableData) {
|
||||
await inspector.open();
|
||||
await inspector.setTablePageSize(50);
|
||||
await inspector.expectTableData(expectedTableData);
|
||||
}
|
||||
|
||||
async getPieChartLabels() {
|
||||
const chartTypes = await find.allByCssSelector('path.slice', defaultFindTimeout * 2);
|
||||
|
||||
const getChartTypesPromises = chartTypes.map(async chart => await chart.getAttribute('data-label'));
|
||||
return await Promise.all(getChartTypesPromises);
|
||||
}
|
||||
|
||||
async getPieSliceCount() {
|
||||
log.debug('PieChart.getPieSliceCount');
|
||||
return await retry.try(async () => {
|
||||
const slices = await find.allByCssSelector('svg > g > g.arcs > path.slice');
|
||||
return slices.length;
|
||||
});
|
||||
}
|
||||
|
||||
async expectPieSliceCount(expectedCount) {
|
||||
log.debug(`PieChart.expectPieSliceCount(${expectedCount})`);
|
||||
await retry.try(async () => {
|
||||
const slicesCount = await this.getPieSliceCount();
|
||||
expect(slicesCount).to.be(expectedCount);
|
||||
});
|
||||
}
|
||||
|
||||
async expectPieChartLabels(expectedLabels) {
|
||||
log.debug(`PieChart.expectPieChartLabels(${expectedLabels.join(',')})`);
|
||||
await retry.try(async () => {
|
||||
const pieData = await this.getPieChartLabels();
|
||||
expect(pieData).to.eql(expectedLabels);
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
|
@ -12,6 +12,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
const browser = getService('browser');
|
||||
const log = getService('log');
|
||||
const find = getService('find');
|
||||
const pieChart = getService('pieChart');
|
||||
const testSubjects = getService('testSubjects');
|
||||
const dashboardAddPanel = getService('dashboardAddPanel');
|
||||
const dashboardPanelActions = getService('dashboardPanelActions');
|
||||
|
@ -146,7 +147,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
|
||||
it('can filter on a visualization', async () => {
|
||||
await PageObjects.dashboard.setTimepickerInHistoricalDataRange();
|
||||
await PageObjects.dashboard.filterOnPieSlice();
|
||||
await pieChart.filterOnPieSlice();
|
||||
const filters = await PageObjects.dashboard.getFilters();
|
||||
expect(filters.length).to.equal(1);
|
||||
});
|
||||
|
|
|
@ -9,15 +9,16 @@ import expect from 'expect.js';
|
|||
export default function ({ getPageObjects, getService }) {
|
||||
const PageObjects = getPageObjects(['gis']);
|
||||
const queryBar = getService('queryBar');
|
||||
const inspector = getService('inspector');
|
||||
const DOC_COUNT_PROP_NAME = 'doc_count';
|
||||
|
||||
describe('layer geohashgrid aggregation source', () => {
|
||||
|
||||
async function getRequestTimestamp() {
|
||||
await PageObjects.gis.openInspectorRequestsView();
|
||||
const requestStats = await PageObjects.gis.getInspectorTableData();
|
||||
const requestStats = await inspector.getTableData();
|
||||
const requestTimestamp = PageObjects.gis.getInspectorStatRowHit(requestStats, 'Request timestamp');
|
||||
await PageObjects.gis.closeInspector();
|
||||
await inspector.close();
|
||||
return requestTimestamp;
|
||||
}
|
||||
|
||||
|
@ -61,21 +62,21 @@ export default function ({ getPageObjects, getService }) {
|
|||
|
||||
it('should apply query to geohashgrid aggregation request', async () => {
|
||||
await PageObjects.gis.openInspectorRequestsView();
|
||||
const requestStats = await PageObjects.gis.getInspectorTableData();
|
||||
const requestStats = await inspector.getTableData();
|
||||
const hits = PageObjects.gis.getInspectorStatRowHit(requestStats, 'Hits (total)');
|
||||
await PageObjects.gis.closeInspector();
|
||||
await inspector.close();
|
||||
expect(hits).to.equal('1');
|
||||
});
|
||||
});
|
||||
|
||||
describe('inspector', () => {
|
||||
afterEach(async () => {
|
||||
await PageObjects.gis.closeInspector();
|
||||
await inspector.close();
|
||||
});
|
||||
|
||||
it('should contain geohashgrid aggregation elasticsearch request', async () => {
|
||||
await PageObjects.gis.openInspectorRequestsView();
|
||||
const requestStats = await PageObjects.gis.getInspectorTableData();
|
||||
const requestStats = await inspector.getTableData();
|
||||
const totalHits = PageObjects.gis.getInspectorStatRowHit(requestStats, 'Hits (total)');
|
||||
expect(totalHits).to.equal('6');
|
||||
const hits = PageObjects.gis.getInspectorStatRowHit(requestStats, 'Hits');
|
||||
|
@ -132,21 +133,21 @@ export default function ({ getPageObjects, getService }) {
|
|||
|
||||
it('should apply query to geohashgrid aggregation request', async () => {
|
||||
await PageObjects.gis.openInspectorRequestsView();
|
||||
const requestStats = await PageObjects.gis.getInspectorTableData();
|
||||
const requestStats = await inspector.getTableData();
|
||||
const hits = PageObjects.gis.getInspectorStatRowHit(requestStats, 'Hits (total)');
|
||||
await PageObjects.gis.closeInspector();
|
||||
await inspector.close();
|
||||
expect(hits).to.equal('1');
|
||||
});
|
||||
});
|
||||
|
||||
describe('inspector', () => {
|
||||
afterEach(async () => {
|
||||
await PageObjects.gis.closeInspector();
|
||||
await inspector.close();
|
||||
});
|
||||
|
||||
it('should contain geohashgrid aggregation elasticsearch request', async () => {
|
||||
await PageObjects.gis.openInspectorRequestsView();
|
||||
const requestStats = await PageObjects.gis.getInspectorTableData();
|
||||
const requestStats = await inspector.getTableData();
|
||||
const totalHits = PageObjects.gis.getInspectorStatRowHit(requestStats, 'Hits (total)');
|
||||
expect(totalHits).to.equal('6');
|
||||
const hits = PageObjects.gis.getInspectorStatRowHit(requestStats, 'Hits');
|
||||
|
|
|
@ -9,6 +9,7 @@ import expect from 'expect.js';
|
|||
export default function ({ getPageObjects, getService }) {
|
||||
const PageObjects = getPageObjects(['gis']);
|
||||
const queryBar = getService('queryBar');
|
||||
const inspector = getService('inspector');
|
||||
|
||||
describe('elasticsearch document layer', () => {
|
||||
before(async () => {
|
||||
|
@ -17,9 +18,9 @@ export default function ({ getPageObjects, getService }) {
|
|||
|
||||
async function getRequestTimestamp() {
|
||||
await PageObjects.gis.openInspectorRequestsView();
|
||||
const requestStats = await PageObjects.gis.getInspectorTableData();
|
||||
const requestStats = await inspector.getTableData();
|
||||
const requestTimestamp = PageObjects.gis.getInspectorStatRowHit(requestStats, 'Request timestamp');
|
||||
await PageObjects.gis.closeInspector();
|
||||
await inspector.close();
|
||||
return requestTimestamp;
|
||||
}
|
||||
|
||||
|
@ -44,9 +45,9 @@ export default function ({ getPageObjects, getService }) {
|
|||
|
||||
it('should apply query to search request', async () => {
|
||||
await PageObjects.gis.openInspectorRequestsView();
|
||||
const requestStats = await PageObjects.gis.getInspectorTableData();
|
||||
const requestStats = await inspector.getTableData();
|
||||
const hits = PageObjects.gis.getInspectorStatRowHit(requestStats, 'Hits');
|
||||
await PageObjects.gis.closeInspector();
|
||||
await inspector.close();
|
||||
expect(hits).to.equal('1');
|
||||
});
|
||||
|
||||
|
@ -61,7 +62,7 @@ export default function ({ getPageObjects, getService }) {
|
|||
describe('inspector', () => {
|
||||
it('should register elasticsearch request in inspector', async () => {
|
||||
await PageObjects.gis.openInspectorRequestsView();
|
||||
const requestStats = await PageObjects.gis.getInspectorTableData();
|
||||
const requestStats = await inspector.getTableData();
|
||||
const hits = PageObjects.gis.getInspectorStatRowHit(requestStats, 'Hits');
|
||||
expect(hits).to.equal('6');
|
||||
});
|
||||
|
|
|
@ -13,8 +13,9 @@ const EXPECTED_JOIN_VALUES = {
|
|||
charlie: 12,
|
||||
};
|
||||
|
||||
export default function ({ getPageObjects }) {
|
||||
export default function ({ getPageObjects, getService }) {
|
||||
const PageObjects = getPageObjects(['gis']);
|
||||
const inspector = getService('inspector');
|
||||
|
||||
describe('layer with joins', () => {
|
||||
before(async () => {
|
||||
|
@ -22,15 +23,15 @@ export default function ({ getPageObjects }) {
|
|||
});
|
||||
|
||||
after(async () => {
|
||||
await PageObjects.gis.closeInspector();
|
||||
await inspector.close();
|
||||
});
|
||||
|
||||
it('should re-fetch join with refresh timer', async () => {
|
||||
async function getRequestTimestamp() {
|
||||
await PageObjects.gis.openInspectorRequest('meta_for_geo_shapes*.shape_name');
|
||||
const requestStats = await PageObjects.gis.getInspectorTableData();
|
||||
const requestStats = await inspector.getTableData();
|
||||
const requestTimestamp = PageObjects.gis.getInspectorStatRowHit(requestStats, 'Request timestamp');
|
||||
await PageObjects.gis.closeInspector();
|
||||
await inspector.close();
|
||||
return requestTimestamp;
|
||||
}
|
||||
|
||||
|
@ -53,12 +54,12 @@ export default function ({ getPageObjects }) {
|
|||
|
||||
describe('inspector', () => {
|
||||
afterEach(async () => {
|
||||
await PageObjects.gis.closeInspector();
|
||||
await inspector.close();
|
||||
});
|
||||
|
||||
it('should contain terms aggregation elasticsearch request', async () => {
|
||||
await PageObjects.gis.openInspectorRequest('meta_for_geo_shapes*.shape_name');
|
||||
const requestStats = await PageObjects.gis.getInspectorTableData();
|
||||
const requestStats = await inspector.getTableData();
|
||||
const totalHits = PageObjects.gis.getInspectorStatRowHit(requestStats, 'Hits (total)');
|
||||
expect(totalHits).to.equal('6');
|
||||
const hits = PageObjects.gis.getInspectorStatRowHit(requestStats, 'Hits');
|
||||
|
|
|
@ -11,6 +11,7 @@ export default function ({ getPageObjects, getService }) {
|
|||
const PageObjects = getPageObjects(['gis', 'header']);
|
||||
const queryBar = getService('queryBar');
|
||||
const browser = getService('browser');
|
||||
const inspector = getService('inspector');
|
||||
|
||||
describe('gis-map saved object management', () => {
|
||||
|
||||
|
@ -63,9 +64,9 @@ export default function ({ getPageObjects, getService }) {
|
|||
|
||||
it('should apply query stored with map', async () => {
|
||||
await PageObjects.gis.openInspectorRequestsView();
|
||||
const requestStats = await PageObjects.gis.getInspectorTableData();
|
||||
const requestStats = await inspector.getTableData();
|
||||
const hits = PageObjects.gis.getInspectorStatRowHit(requestStats, 'Hits');
|
||||
await PageObjects.gis.closeInspector();
|
||||
await inspector.close();
|
||||
expect(hits).to.equal('2');
|
||||
});
|
||||
|
||||
|
@ -81,8 +82,8 @@ export default function ({ getPageObjects, getService }) {
|
|||
expect(query).to.equal('machine.os.raw : "win 8"');
|
||||
|
||||
await PageObjects.gis.openInspectorRequestsView();
|
||||
const requestStats = await PageObjects.gis.getInspectorTableData();
|
||||
await PageObjects.gis.closeInspector();
|
||||
const requestStats = await inspector.getTableData();
|
||||
await inspector.close();
|
||||
const hits = PageObjects.gis.getInspectorStatRowHit(requestStats, 'Hits');
|
||||
expect(hits).to.equal('1');
|
||||
});
|
||||
|
|
|
@ -10,7 +10,7 @@ export function GisPageProvider({ getService, getPageObjects }) {
|
|||
const log = getService('log');
|
||||
const testSubjects = getService('testSubjects');
|
||||
const retry = getService('retry');
|
||||
const flyout = getService('flyout');
|
||||
const inspector = getService('inspector');
|
||||
const find = getService('find');
|
||||
|
||||
class GisPage {
|
||||
|
@ -143,37 +143,8 @@ export function GisPageProvider({ getService, getPageObjects }) {
|
|||
await testSubjects.click(`mapRemoveLayerButton`);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Inspector utility functions
|
||||
*/
|
||||
async openInspector() {
|
||||
log.debug('Open Inspector');
|
||||
const isOpen = await testSubjects.exists('inspectorPanel');
|
||||
if (!isOpen) {
|
||||
await retry.try(async () => {
|
||||
await testSubjects.click('openInspectorButton');
|
||||
await testSubjects.find('inspectorPanel');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async closeInspector() {
|
||||
log.debug('Close Inspector');
|
||||
let isOpen = await testSubjects.exists('inspectorPanel');
|
||||
if (isOpen) {
|
||||
await retry.try(async () => {
|
||||
await flyout.close('inspectorPanel');
|
||||
isOpen = await testSubjects.exists('inspectorPanel');
|
||||
if (isOpen) {
|
||||
throw new Error('Failed to close inspector');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async openInspectorView(viewId) {
|
||||
await this.openInspector();
|
||||
await inspector.open();
|
||||
log.debug(`Open Inspector view ${viewId}`);
|
||||
await testSubjects.click('inspectorViewChooser');
|
||||
await testSubjects.click(viewId);
|
||||
|
@ -207,7 +178,7 @@ export function GisPageProvider({ getService, getPageObjects }) {
|
|||
await testSubjects.click('mapboxStyleTab');
|
||||
const mapboxStyleContainer = await testSubjects.find('mapboxStyleContainer');
|
||||
const mapboxStyleJson = await mapboxStyleContainer.getVisibleText();
|
||||
await this.closeInspector();
|
||||
await inspector.close();
|
||||
let mapboxStyle;
|
||||
try {
|
||||
mapboxStyle = JSON.parse(mapboxStyleJson);
|
||||
|
@ -217,18 +188,6 @@ export function GisPageProvider({ getService, getPageObjects }) {
|
|||
return mapboxStyle;
|
||||
}
|
||||
|
||||
async getInspectorTableData() {
|
||||
const inspectorPanel = await testSubjects.find('inspectorPanel');
|
||||
const tableBody = await retry.try(async () => inspectorPanel.findByTagName('tbody'));
|
||||
// Convert the data into a nested array format:
|
||||
// [ [cell1_in_row1, cell2_in_row1], [cell1_in_row2, cell2_in_row2] ]
|
||||
const rows = await tableBody.findAllByTagName('tr');
|
||||
return await Promise.all(rows.map(async row => {
|
||||
const cells = await row.findAllByTagName('td');
|
||||
return await Promise.all(cells.map(async cell => cell.getVisibleText()));
|
||||
}));
|
||||
}
|
||||
|
||||
getInspectorStatRowHit(stats, rowName) {
|
||||
const STATS_ROW_NAME_INDEX = 0;
|
||||
const STATS_ROW_VALUE_INDEX = 1;
|
||||
|
|
Loading…
Reference in a new issue