Skip to content

Commit

Permalink
Improve visualization tests (#20782)
Browse files Browse the repository at this point in the history
* Improve tests for histogram, tag cloud, input controls and enable lab mode.

* enable skipped tests

* Update shakespeare test navigation to visualize

* Add sleep to shakespeare test

* Skip shakespeare test for now, it is not clear why it is failing and does not fail locally, need the other tests to run in CI

* Revert selector for selectAggregation, re-enable shakespeare test

* skip vega spec text test, was not fixed with changes

* Enable only visualize tests to run, need to see results and it's being blocked by other test failures

* Enable all tests again, visualization tests all passed

* Skipping sample data test due to bug #20807, let's see if rest of the tests pass
  • Loading branch information
liza-mae authored Jul 18, 2018
1 parent 651013b commit 4551dfc
Show file tree
Hide file tree
Showing 24 changed files with 79 additions and 48 deletions.
3 changes: 2 additions & 1 deletion test/functional/apps/getting_started/_shakespeare.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default function ({ getService, getPageObjects }) {
*/
it('should create initial vertical bar chart', async function () {
log.debug('create shakespeare vertical bar chart');
await PageObjects.common.navigateToUrl('visualize', 'new');
await PageObjects.visualize.navigateToNewVisualization();
await PageObjects.visualize.clickVerticalBarChart();
await PageObjects.visualize.clickNewSearch('shakes*');
await PageObjects.visualize.waitForVisualization();
Expand Down Expand Up @@ -107,6 +107,7 @@ export default function ({ getService, getPageObjects }) {
*/
it('should configure Terms aggregation on play_name', async function () {
await PageObjects.visualize.clickBucket('X-Axis');
await PageObjects.common.sleep(1000);
log.debug('Aggregation = Terms');
await PageObjects.visualize.selectAggregation('Terms');
aggIndex = aggIndex + 1;
Expand Down
2 changes: 1 addition & 1 deletion test/functional/apps/visualize/_area_chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default function ({ getService, getPageObjects }) {
const toTime = '2015-09-23 18:31:44.000';

log.debug('navigateToApp visualize');
await PageObjects.common.navigateToUrl('visualize', 'new');
await PageObjects.visualize.navigateToNewVisualization();
log.debug('clickAreaChart');
await PageObjects.visualize.clickAreaChart();
log.debug('clickNewSearch');
Expand Down
7 changes: 4 additions & 3 deletions test/functional/apps/visualize/_data_table.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default function ({ getService, getPageObjects }) {

before(async function () {
log.debug('navigateToApp visualize');
await PageObjects.common.navigateToUrl('visualize', 'new');
await PageObjects.visualize.navigateToNewVisualization();
log.debug('clickDataTable');
await PageObjects.visualize.clickDataTable();
log.debug('clickNewSearch');
Expand Down Expand Up @@ -90,7 +90,7 @@ export default function ({ getService, getPageObjects }) {
});

it('should show correct data for a data table with date histogram', async () => {
await PageObjects.common.navigateToUrl('visualize', 'new');
await PageObjects.visualize.navigateToNewVisualization();
await PageObjects.visualize.clickDataTable();
await PageObjects.visualize.clickNewSearch();
await PageObjects.header.setAbsoluteRange(fromTime, toTime);
Expand All @@ -110,7 +110,7 @@ export default function ({ getService, getPageObjects }) {
});

it('should show correct data for a data table with date histogram', async () => {
await PageObjects.common.navigateToUrl('visualize', 'new');
await PageObjects.visualize.navigateToNewVisualization();
await PageObjects.visualize.clickDataTable();
await PageObjects.visualize.clickNewSearch();
await PageObjects.header.setAbsoluteRange(fromTime, toTime);
Expand All @@ -131,6 +131,7 @@ export default function ({ getService, getPageObjects }) {
it('should correctly filter for applied time filter on the main timefield', async () => {
await filterBar.addFilter('@timestamp', 'is between', ['2015-09-19', '2015-09-21']);
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.common.sleep(1000);
const data = await PageObjects.visualize.getTableVisData();
expect(data.trim().split('\n')).to.be.eql([
'2015-09-20', '4,757',
Expand Down
2 changes: 1 addition & 1 deletion test/functional/apps/visualize/_experimental_vis.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default ({ getService, getPageObjects }) => {

beforeEach(async () => {
log.debug('navigateToApp visualize');
await PageObjects.common.navigateToUrl('visualize', 'new');
await PageObjects.visualize.navigateToNewVisualization();
await PageObjects.visualize.waitForVisualizationSelectPage();
});

Expand Down
2 changes: 1 addition & 1 deletion test/functional/apps/visualize/_gauge_chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default function ({ getService, getPageObjects }) {

before(async function () {
log.debug('navigateToApp visualize');
await PageObjects.common.navigateToUrl('visualize', 'new');
await PageObjects.visualize.navigateToNewVisualization();
log.debug('clickGauge');
await PageObjects.visualize.clickGauge();
await PageObjects.visualize.clickNewSearch();
Expand Down
2 changes: 1 addition & 1 deletion test/functional/apps/visualize/_heatmap_chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default function ({ getService, getPageObjects }) {

before(async function () {
log.debug('navigateToApp visualize');
await PageObjects.common.navigateToUrl('visualize', 'new');
await PageObjects.visualize.navigateToNewVisualization();
log.debug('clickHeatmapChart');
await PageObjects.visualize.clickHeatmapChart();
await PageObjects.visualize.clickNewSearch();
Expand Down
2 changes: 1 addition & 1 deletion test/functional/apps/visualize/_histogram_request_start.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default function ({ getService, getPageObjects }) {
const toTime = '2015-09-23 18:31:44.000';

log.debug('navigateToApp visualize');
await PageObjects.common.navigateToUrl('visualize', 'new');
await PageObjects.visualize.navigateToNewVisualization();
log.debug('clickDataTable');
await PageObjects.visualize.clickDataTable();
await PageObjects.visualize.clickNewSearch();
Expand Down
23 changes: 10 additions & 13 deletions test/functional/apps/visualize/_input_control_vis.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,13 @@ export default function ({ getService, getPageObjects }) {
describe('input control visualization', () => {

before(async () => {
await PageObjects.common.navigateToUrl('visualize', 'new');
await PageObjects.visualize.navigateToNewVisualization();
await PageObjects.visualize.clickInputControlVis();
// set time range to time with no documents - input controls do not use time filter be default
await PageObjects.header.setAbsoluteRange('2017-01-01', '2017-01-02');
await PageObjects.visualize.clickVisEditorTab('controls');
await PageObjects.visualize.addInputControl();
await PageObjects.visualize.setComboBox('indexPatternSelect-0', 'logstash');
await PageObjects.common.sleep(1000); // give time for index-pattern to be fetched
await PageObjects.visualize.setComboBox('fieldSelect-0', FIELD_NAME);
await PageObjects.visualize.clickGo();
await PageObjects.header.waitUntilLoadingHasFinished();
Expand Down Expand Up @@ -76,7 +75,7 @@ export default function ({ getService, getPageObjects }) {
});

it('should add filter pill when submit button is clicked', async () => {
await testSubjects.click('inputControlSubmitBtn');
await PageObjects.visualize.inputControlSubmit();

const hasFilter = await filterBar.hasFilter(FIELD_NAME, 'ios');
expect(hasFilter).to.equal(true);
Expand All @@ -85,7 +84,8 @@ export default function ({ getService, getPageObjects }) {
it('should replace existing filter pill(s) when new item is selected', async () => {
await PageObjects.visualize.clearComboBox('listControlSelect0');
await PageObjects.visualize.setComboBox('listControlSelect0', 'osx');
await testSubjects.click('inputControlSubmitBtn');
await PageObjects.visualize.inputControlSubmit();
await PageObjects.common.sleep(1000);

const hasOldFilter = await filterBar.hasFilter(FIELD_NAME, 'ios');
const hasNewFilter = await filterBar.hasFilter(FIELD_NAME, 'osx');
Expand All @@ -103,11 +103,11 @@ export default function ({ getService, getPageObjects }) {

it('should clear form when Clear button is clicked but not remove filter pill', async () => {
await PageObjects.visualize.setComboBox('listControlSelect0', 'ios');
await testSubjects.click('inputControlSubmitBtn');
await PageObjects.visualize.inputControlSubmit();
const hasFilterBeforeClearBtnClicked = await filterBar.hasFilter(FIELD_NAME, 'ios');
expect(hasFilterBeforeClearBtnClicked).to.equal(true);

await testSubjects.click('inputControlClearBtn');
await PageObjects.visualize.inputControlClear();
const hasValue = await PageObjects.visualize.doesComboBoxHaveSelectedOptions('listControlSelect0');
expect(hasValue).to.equal(false);

Expand All @@ -116,7 +116,7 @@ export default function ({ getService, getPageObjects }) {
});

it('should remove filter pill when cleared form is submitted', async () => {
await testSubjects.click('inputControlSubmitBtn');
await PageObjects.visualize.inputControlSubmit();
const hasFilter = await filterBar.hasFilter(FIELD_NAME, 'ios');
expect(hasFilter).to.equal(false);
});
Expand Down Expand Up @@ -184,13 +184,12 @@ export default function ({ getService, getPageObjects }) {

describe('dynamic options', () => {
beforeEach(async () => {
await PageObjects.common.navigateToUrl('visualize', 'new');
await PageObjects.visualize.navigateToNewVisualization();
await PageObjects.visualize.clickInputControlVis();
await PageObjects.visualize.clickVisEditorTab('controls');

await PageObjects.visualize.addInputControl();
await PageObjects.visualize.setComboBox('indexPatternSelect-0', 'logstash');
await PageObjects.common.sleep(1000); // give time for index-pattern to be fetched
await PageObjects.visualize.setComboBox('fieldSelect-0', 'geo.src');

await PageObjects.visualize.clickGo();
Expand Down Expand Up @@ -228,18 +227,16 @@ export default function ({ getService, getPageObjects }) {
describe('chained controls', () => {

before(async () => {
await PageObjects.common.navigateToUrl('visualize', 'new');
await PageObjects.visualize.navigateToNewVisualization();
await PageObjects.visualize.clickInputControlVis();
await PageObjects.visualize.clickVisEditorTab('controls');

await PageObjects.visualize.addInputControl();
await PageObjects.visualize.setComboBox('indexPatternSelect-0', 'logstash');
await PageObjects.common.sleep(1000); // give time for index-pattern to be fetched
await PageObjects.visualize.setComboBox('fieldSelect-0', 'geo.src');

await PageObjects.visualize.addInputControl();
await PageObjects.visualize.setComboBox('indexPatternSelect-1', 'logstash');
await PageObjects.common.sleep(1000); // give time for index-pattern to be fetched
await PageObjects.visualize.setComboBox('fieldSelect-1', 'clientip');
await PageObjects.visualize.setSelectByOptionText('parentSelect-1', 'geo.src');

Expand All @@ -266,7 +263,7 @@ export default function ({ getService, getPageObjects }) {
it('should create a seperate filter pill for parent control and child control', async () => {
await PageObjects.visualize.setComboBox('listControlSelect1', '14.61.182.136');

await testSubjects.click('inputControlSubmitBtn');
await PageObjects.visualize.inputControlSubmit();

const hasParentControlFilter = await filterBar.hasFilter('geo.src', 'BR');
expect(hasParentControlFilter).to.equal(true);
Expand Down
2 changes: 1 addition & 1 deletion test/functional/apps/visualize/_inspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default function ({ getService, getPageObjects }) {
const fromTime = '2015-09-19 06:31:44.000';
const toTime = '2015-09-23 18:31:44.000';

await PageObjects.common.navigateToUrl('visualize', 'new');
await PageObjects.visualize.navigateToNewVisualization();
await PageObjects.visualize.clickVerticalBarChart();
await PageObjects.visualize.clickNewSearch();

Expand Down
2 changes: 1 addition & 1 deletion test/functional/apps/visualize/_lab_mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default function ({ getService, getPageObjects }) {
const PageObjects = getPageObjects(['common', 'header', 'discover', 'settings']);

// Flaky: https://github.com/elastic/kibana/issues/19743
describe.skip('visualize lab mode', () => {
describe('visualize lab mode', () => {

it('disabling does not break loading saved searches', async () => {
await PageObjects.common.navigateToUrl('discover', '');
Expand Down
2 changes: 1 addition & 1 deletion test/functional/apps/visualize/_line_chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default function ({ getService, getPageObjects }) {
const toTime = '2015-09-23 18:31:44.000';

log.debug('navigateToApp visualize');
await PageObjects.common.navigateToUrl('visualize', 'new');
await PageObjects.visualize.navigateToNewVisualization();
log.debug('clickLineChart');
await PageObjects.visualize.clickLineChart();
await PageObjects.visualize.clickNewSearch();
Expand Down
11 changes: 3 additions & 8 deletions test/functional/apps/visualize/_linked_saved_searches.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@

import expect from 'expect.js';

export default function ({ getPageObjects, getService }) {
const retry = getService('retry');
export default function ({ getPageObjects }) {
const PageObjects = getPageObjects(['common', 'discover', 'visualize', 'header']);

// Blocked by: https://github.com/elastic/kibana/issues/19750
describe.skip('visualize app', function describeIndexTests() {
describe('visualize app', function describeIndexTests() {
const fromTime = '2015-09-19 06:31:44.000';
const toTime = '2015-09-23 18:31:44.000';

Expand All @@ -38,11 +37,7 @@ export default function ({ getPageObjects, getService }) {
});

it('should create a visualization from a saved search', async () => {
retry.try(async () => {
// Sometimes navigation to the page fails, so we have this in a retry
await PageObjects.common.navigateToUrl('visualize', 'new');
await PageObjects.visualize.waitForVisualizationSelectPage();
});
await PageObjects.visualize.navigateToNewVisualization();
await PageObjects.visualize.clickDataTable();
await PageObjects.visualize.clickSavedSearch(savedSearchName);
await PageObjects.header.setAbsoluteRange(fromTime, toTime);
Expand Down
2 changes: 1 addition & 1 deletion test/functional/apps/visualize/_markdown_vis.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default function ({ getPageObjects, getService }) {

describe('visualize app', async () => {
before(async function () {
await PageObjects.common.navigateToUrl('visualize', 'new');
await PageObjects.visualize.navigateToNewVisualization();
await PageObjects.visualize.clickMarkdownWidget();
await PageObjects.visualize.setMarkdownTxt(markdown);
await PageObjects.visualize.clickGo();
Expand Down
2 changes: 1 addition & 1 deletion test/functional/apps/visualize/_metric_chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default function ({ getService, getPageObjects }) {

before(async function () {
log.debug('navigateToApp visualize');
await PageObjects.common.navigateToUrl('visualize', 'new');
await PageObjects.visualize.navigateToNewVisualization();
log.debug('clickMetric');
await PageObjects.visualize.clickMetric();
await PageObjects.visualize.clickNewSearch();
Expand Down
5 changes: 3 additions & 2 deletions test/functional/apps/visualize/_pie_chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default function ({ getService, getPageObjects }) {
before(async function () {

log.debug('navigateToApp visualize');
await PageObjects.common.navigateToUrl('visualize', 'new');
await PageObjects.visualize.navigateToNewVisualization();
log.debug('clickPieChart');
await PageObjects.visualize.clickPieChart();
await PageObjects.visualize.clickNewSearch();
Expand Down Expand Up @@ -92,7 +92,7 @@ export default function ({ getService, getPageObjects }) {
it('should show other and missing bucket', async function () {
const expectedTableData = [ 'win 8', 'win xp', 'win 7', 'ios', 'Missing', 'Other' ];

await PageObjects.common.navigateToUrl('visualize', 'new');
await PageObjects.visualize.navigateToNewVisualization();
log.debug('clickPieChart');
await PageObjects.visualize.clickPieChart();
await PageObjects.visualize.clickNewSearch();
Expand Down Expand Up @@ -157,6 +157,7 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.visualize.toggleDisabledAgg(2);
await PageObjects.visualize.clickGo();
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.common.sleep(2000);

const expectedTableData = [
'0', 'win 7', 'win xp', 'win 8', 'ios', 'osx', '40,000', 'win 8', 'ios', 'win 7', 'win xp', 'osx', '80,000',
Expand Down
2 changes: 1 addition & 1 deletion test/functional/apps/visualize/_point_series_options.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default function ({ getService, getPageObjects }) {
const toTime = '2015-09-23 18:31:44.000';

log.debug('navigateToApp visualize');
await PageObjects.common.navigateToUrl('visualize', 'new');
await PageObjects.visualize.navigateToNewVisualization();
log.debug('clickLineChart');
await PageObjects.visualize.clickLineChart();
await PageObjects.visualize.clickNewSearch();
Expand Down
2 changes: 1 addition & 1 deletion test/functional/apps/visualize/_region_map.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default function ({ getService, getPageObjects }) {
before(async function () {

log.debug('navigateToApp visualize');
await PageObjects.common.navigateToUrl('visualize', 'new');
await PageObjects.visualize.navigateToNewVisualization();
log.debug('clickRegionMap');
await PageObjects.visualize.clickRegionMap();
await PageObjects.visualize.clickNewSearch();
Expand Down
6 changes: 4 additions & 2 deletions test/functional/apps/visualize/_tag_cloud.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,16 @@ export default function ({ getService, getPageObjects }) {

before(async function () {
log.debug('navigateToApp visualize');
await PageObjects.common.navigateToUrl('visualize', 'new');
await PageObjects.visualize.navigateToNewVisualization();
log.debug('clickTagCloud');
await PageObjects.visualize.clickTagCloud();
await PageObjects.visualize.clickNewSearch();
log.debug('Set absolute time range from \"' + fromTime + '\" to \"' + toTime + '\"');
await PageObjects.header.setAbsoluteRange(fromTime, toTime);
await PageObjects.common.sleep(1000);
log.debug('select Tags');
await PageObjects.visualize.clickBucket('Tags');
await PageObjects.common.sleep(1000);
log.debug('Click aggregation Terms');
await PageObjects.visualize.selectAggregation('Terms');
log.debug('Click field machine.ram');
Expand Down Expand Up @@ -143,7 +145,7 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.settings.openControlsByName(termsField);
await PageObjects.settings.setFieldFormat('bytes');
await PageObjects.settings.controlChangeSave();
await PageObjects.common.navigateToUrl('visualize', 'new');
await PageObjects.visualize.navigateToNewVisualization();
await PageObjects.visualize.loadSavedVisualization(vizName1);
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.header.setAbsoluteRange(fromTime, toTime);
Expand Down
4 changes: 2 additions & 2 deletions test/functional/apps/visualize/_tile_map.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default function ({ getService, getPageObjects }) {
const toTime = '2015-09-23 18:31:44.000';

log.debug('navigateToApp visualize');
await PageObjects.common.navigateToUrl('visualize', 'new');
await PageObjects.visualize.navigateToNewVisualization();
log.debug('clickTileMap');
await PageObjects.visualize.clickTileMap();
await PageObjects.visualize.clickNewSearch();
Expand Down Expand Up @@ -71,7 +71,7 @@ export default function ({ getService, getPageObjects }) {
const toTime = '2015-09-23 18:31:44.000';

log.debug('navigateToApp visualize');
await PageObjects.common.navigateToUrl('visualize', 'new');
await PageObjects.visualize.navigateToNewVisualization();
log.debug('clickTileMap');
await PageObjects.visualize.clickTileMap();
await PageObjects.visualize.clickNewSearch();
Expand Down
2 changes: 1 addition & 1 deletion test/functional/apps/visualize/_tsvb_chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export default function ({ getService, getPageObjects }) {
expect(text).to.be('1442901600000');
});

it.skip('should allow printing raw value of data', async () => {
it('should allow printing raw value of data', async () => {
await PageObjects.visualBuilder.enterMarkdown('{{ count.data.raw.[0].[1] }}');
const text = await PageObjects.visualBuilder.getMarkdownText();
expect(text).to.be('6');
Expand Down
2 changes: 1 addition & 1 deletion test/functional/apps/visualize/_vega_chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default function ({ getService, getPageObjects }) {
describe('visualize app', () => {
before(async () => {
log.debug('navigateToApp visualize');
await PageObjects.common.navigateToUrl('visualize', 'new');
await PageObjects.visualize.navigateToNewVisualization();
log.debug('clickVega');
await PageObjects.visualize.clickVega();
});
Expand Down
2 changes: 1 addition & 1 deletion test/functional/apps/visualize/_vertical_bar_chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default function ({ getService, getPageObjects }) {

const initBarChart = async () => {
log.debug('navigateToApp visualize');
await PageObjects.common.navigateToUrl('visualize', 'new');
await PageObjects.visualize.navigateToNewVisualization();
log.debug('clickVerticalBarChart');
await PageObjects.visualize.clickVerticalBarChart();
await PageObjects.visualize.clickNewSearch();
Expand Down
Loading

0 comments on commit 4551dfc

Please sign in to comment.