Skip to content

Commit

Permalink
[Discover] Improve Percy functional tests (#51699)
Browse files Browse the repository at this point in the history
* Implement new wait for chart rendered function

* Add findByCssSelector to ensure the charts have been rendered
  • Loading branch information
kertal authored Nov 28, 2019
1 parent a35a6ca commit cd109fa
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/visual_regression/tests/discover/chart_visualization.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export default function ({ getService, getPageObjects }) {
const kibanaServer = getService('kibanaServer');
const PageObjects = getPageObjects(['common', 'discover', 'header', 'timePicker']);
const visualTesting = getService('visualTesting');
const find = getService('find');
const defaultSettings = {
defaultIndex: 'logstash-*',
'discover:sampleSize': 1
Expand All @@ -48,10 +49,12 @@ export default function ({ getService, getPageObjects }) {

describe('query', function () {
this.tags(['skipFirefox']);
let renderCounter = 0;

it('should show bars in the correct time zone', async function () {
await PageObjects.header.awaitGlobalLoadingIndicatorHidden();
await PageObjects.discover.waitUntilSearchingHasFinished();
await find.byCssSelector(`.echChart[data-ech-render-count="${++renderCounter}"]`);
await visualTesting.snapshot({
show: ['discoverChart'],
});
Expand All @@ -61,6 +64,7 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.header.awaitGlobalLoadingIndicatorHidden();
await PageObjects.discover.waitUntilSearchingHasFinished();
await PageObjects.discover.setChartInterval('Hourly');
await find.byCssSelector(`.echChart[data-ech-render-count="${++renderCounter}"]`);
await visualTesting.snapshot({
show: ['discoverChart'],
});
Expand All @@ -70,6 +74,7 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.header.awaitGlobalLoadingIndicatorHidden();
await PageObjects.discover.waitUntilSearchingHasFinished();
await PageObjects.discover.setChartInterval('Daily');
await find.byCssSelector(`.echChart[data-ech-render-count="${++renderCounter}"]`);
await visualTesting.snapshot({
show: ['discoverChart'],
});
Expand All @@ -79,6 +84,7 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.header.awaitGlobalLoadingIndicatorHidden();
await PageObjects.discover.waitUntilSearchingHasFinished();
await PageObjects.discover.setChartInterval('Weekly');
await find.byCssSelector(`.echChart[data-ech-render-count="${++renderCounter}"]`);
await visualTesting.snapshot({
show: ['discoverChart'],
});
Expand All @@ -92,6 +98,7 @@ export default function ({ getService, getPageObjects }) {
});
await PageObjects.header.awaitGlobalLoadingIndicatorHidden();
await PageObjects.discover.waitUntilSearchingHasFinished();
await find.byCssSelector(`.echChart[data-ech-render-count="${++renderCounter}"]`);
await visualTesting.snapshot({
show: ['discoverChart'],
});
Expand All @@ -101,6 +108,7 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.header.awaitGlobalLoadingIndicatorHidden();
await PageObjects.discover.waitUntilSearchingHasFinished();
await PageObjects.discover.setChartInterval('Monthly');
await find.byCssSelector(`.echChart[data-ech-render-count="${++renderCounter}"]`);
await visualTesting.snapshot({
show: ['discoverChart'],
});
Expand All @@ -110,6 +118,7 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.header.awaitGlobalLoadingIndicatorHidden();
await PageObjects.discover.waitUntilSearchingHasFinished();
await PageObjects.discover.setChartInterval('Yearly');
await find.byCssSelector(`.echChart[data-ech-render-count="${++renderCounter}"]`);
await visualTesting.snapshot({
show: ['discoverChart'],
});
Expand All @@ -119,6 +128,7 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.header.awaitGlobalLoadingIndicatorHidden();
await PageObjects.discover.waitUntilSearchingHasFinished();
await PageObjects.discover.setChartInterval('Auto');
await find.byCssSelector(`.echChart[data-ech-render-count="${++renderCounter}"]`);
await visualTesting.snapshot({
show: ['discoverChart'],
});
Expand Down

0 comments on commit cd109fa

Please sign in to comment.