mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Fix screenshots with minimal sleep calls. Remove a couple unnecessary promise chains in visualizePage.
Fixes #5932
This commit is contained in:
parent
c25bc1f0e3
commit
ff033eb8c6
6 changed files with 56 additions and 73 deletions
|
@ -97,12 +97,10 @@ define(function (require) {
|
|||
});
|
||||
|
||||
bdd.describe('area charts', function indexPatternCreation() {
|
||||
var testSubName = 'AreaChart';
|
||||
var vizName1 = 'Visualization ' + testSubName;
|
||||
|
||||
bdd.it('should save and load, take screenshot', function pageHeader() {
|
||||
|
||||
var testSubName = 'AreaChart';
|
||||
var vizName1 = 'Visualization ' + testSubName;
|
||||
|
||||
bdd.it('should save and load', function pageHeader() {
|
||||
return visualizePage.saveVisualization(vizName1)
|
||||
.then(function (message) {
|
||||
common.debug('Saved viz message = ' + message);
|
||||
|
@ -114,24 +112,17 @@ define(function (require) {
|
|||
.then(function loadSavedVisualization() {
|
||||
return visualizePage.loadSavedVisualization(vizName1);
|
||||
})
|
||||
.then(function getSpinnerDone() {
|
||||
common.debug('Waiting...');
|
||||
return headerPage.getSpinnerDone();
|
||||
})
|
||||
.then(function waitForVisualization() {
|
||||
.then(function () {
|
||||
return visualizePage.waitForVisualization();
|
||||
})
|
||||
.then(function takeScreenshot() {
|
||||
common.debug('Take screenshot');
|
||||
common.saveScreenshot('./screenshot-' + testSubName + '.png');
|
||||
.then(function sleep() {
|
||||
return common.sleep(2000);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
|
||||
|
||||
bdd.it('should show correct chart', function pageHeader() {
|
||||
|
||||
bdd.it('should show correct chart, take screenshot', function pageHeader() {
|
||||
var chartHeight = 0;
|
||||
var xAxisLabels = [ '2015-09-20 00:00', '2015-09-21 00:00',
|
||||
'2015-09-22 00:00', '2015-09-23 00:00'
|
||||
|
@ -141,10 +132,12 @@ define(function (require) {
|
|||
683, 1361, 1415, 707, 177, 27, 32, 175, 707, 1408, 1355, 726, 201, 29
|
||||
];
|
||||
|
||||
return visualizePage.getXAxisLabels()
|
||||
.then(function (labels) {
|
||||
common.debug('X-Axis labels = ' + labels);
|
||||
expect(labels).to.eql(xAxisLabels);
|
||||
return common.tryForTime(5000, function () {
|
||||
return visualizePage.getXAxisLabels()
|
||||
.then(function compareLabels(labels) {
|
||||
common.debug('X-Axis labels = ' + labels);
|
||||
expect(labels).to.eql(xAxisLabels);
|
||||
});
|
||||
})
|
||||
.then(function getYAxisLabels() {
|
||||
return visualizePage.getYAxisLabels();
|
||||
|
@ -154,7 +147,6 @@ define(function (require) {
|
|||
expect(labels).to.eql(yAxisLabels);
|
||||
})
|
||||
.then(function getAreaChartData() {
|
||||
//return common.tryForTime(500, function () {
|
||||
return visualizePage.getAreaChartData();
|
||||
})
|
||||
.then(function (paths) {
|
||||
|
@ -162,12 +154,15 @@ define(function (require) {
|
|||
common.debug('actual chart data = ' + paths);
|
||||
expect(paths).to.eql(expectedAreaChartData);
|
||||
})
|
||||
.then(function takeScreenshot() {
|
||||
common.debug('Take screenshot');
|
||||
common.saveScreenshot('./screenshot-' + testSubName + '.png');
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
|
||||
bdd.it('should show correct data', function pageHeader() {
|
||||
|
||||
var expectedTableData = [ 'September 20th 2015, 00:00:00.000 37',
|
||||
'September 20th 2015, 03:00:00.000 202',
|
||||
'September 20th 2015, 06:00:00.000 740',
|
||||
|
|
|
@ -101,10 +101,13 @@ define(function (require) {
|
|||
common.debug('Saved viz message = ' + message);
|
||||
expect(message).to.be('Visualization Editor: Saved Visualization \"' + vizName1 + '\"');
|
||||
})
|
||||
.then(function testVisualizeWaitForToastMessageGone() {
|
||||
return visualizePage.waitForToastMessageGone();
|
||||
})
|
||||
.then(function () {
|
||||
return visualizePage.loadSavedVisualization(vizName1);
|
||||
})
|
||||
.then(function waitForVisualization() {
|
||||
.then(function () {
|
||||
return visualizePage.waitForVisualization();
|
||||
})
|
||||
.then(function takeScreenshot() {
|
||||
|
|
|
@ -85,12 +85,12 @@ define(function (require) {
|
|||
});
|
||||
|
||||
bdd.describe('line charts', function indexPatternCreation() {
|
||||
var testSubName = 'LineChart';
|
||||
var vizName1 = 'Visualization ' + testSubName;
|
||||
|
||||
bdd.it('should be able to save and load, take screenshot', function pageHeader() {
|
||||
bdd.it('should be able to save and load', function pageHeader() {
|
||||
|
||||
var testSubName = 'LineChart';
|
||||
common.debug('Start of test' + testSubName + 'Visualization');
|
||||
var vizName1 = 'Visualization ' + testSubName;
|
||||
var remote = this.remote;
|
||||
|
||||
return visualizePage.saveVisualization(vizName1)
|
||||
|
@ -107,16 +107,11 @@ define(function (require) {
|
|||
.then(function waitForVisualization() {
|
||||
return visualizePage.waitForVisualization();
|
||||
})
|
||||
.then(function takeScreenshot() {
|
||||
// take a snapshot just as an example.
|
||||
common.debug('Take screenshot');
|
||||
common.saveScreenshot('./screenshot-' + testSubName + '.png');
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
|
||||
bdd.it('should show correct chart', function pageHeader() {
|
||||
bdd.it('should show correct chart, take screenshot', function pageHeader() {
|
||||
|
||||
var remote = this.remote;
|
||||
|
||||
|
@ -138,6 +133,11 @@ define(function (require) {
|
|||
common.debug('Done');
|
||||
});
|
||||
})
|
||||
.then(function takeScreenshot() {
|
||||
// take a snapshot just as an example.
|
||||
common.debug('Take screenshot');
|
||||
common.saveScreenshot('./screenshot-' + testSubName + '.png');
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
|
|
|
@ -92,12 +92,12 @@ define(function (require) {
|
|||
|
||||
|
||||
bdd.describe('pie chart', function indexPatternCreation() {
|
||||
var testSubName = 'PieChart';
|
||||
var vizName1 = 'Visualization ' + testSubName;
|
||||
|
||||
|
||||
bdd.it('should save and load, take screenshot', function pageHeader() {
|
||||
var testSubName = 'PieChart';
|
||||
bdd.it('should save and load', function pageHeader() {
|
||||
common.debug('Start of test' + testSubName + 'Visualization');
|
||||
var vizName1 = 'Visualization ' + testSubName;
|
||||
var remote = this.remote;
|
||||
|
||||
return visualizePage.saveVisualization(vizName1)
|
||||
|
@ -114,6 +114,22 @@ define(function (require) {
|
|||
.then(function waitForVisualization() {
|
||||
return visualizePage.waitForVisualization();
|
||||
})
|
||||
.then(function sleep() {
|
||||
return common.sleep(2000);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show 10 slices in pie chart, take screenshot', function pageHeader() {
|
||||
var remote = this.remote;
|
||||
var expectedPieChartSliceCount = 10;
|
||||
|
||||
return visualizePage.getPieChartData()
|
||||
.then(function (pieData) {
|
||||
var barHeightTolerance = 1;
|
||||
common.debug('pieData.length = ' + pieData.length);
|
||||
expect(pieData.length).to.be(expectedPieChartSliceCount);
|
||||
})
|
||||
.then(function takeScreenshot() {
|
||||
common.debug('Take screenshot');
|
||||
common.saveScreenshot('./screenshot-' + testSubName + '.png');
|
||||
|
@ -138,28 +154,9 @@ define(function (require) {
|
|||
common.debug(data.split('\n'));
|
||||
expect(data.trim().split('\n')).to.eql(expectedTableData);
|
||||
})
|
||||
// expandChart (toggle)
|
||||
.then(function () {
|
||||
return visualizePage.collapseChart();
|
||||
})
|
||||
.then(function sleep() {
|
||||
return common.sleep(500);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
bdd.it('should show 10 slices in pie chart', function pageHeader() {
|
||||
var remote = this.remote;
|
||||
var expectedPieChartSliceCount = 10;
|
||||
|
||||
return visualizePage.getPieChartData()
|
||||
.then(function (pieData) {
|
||||
var barHeightTolerance = 1;
|
||||
common.debug('pieData.length = ' + pieData.length);
|
||||
expect(pieData.length).to.be(expectedPieChartSliceCount);
|
||||
})
|
||||
.catch(common.handleError(this));
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
|
|
@ -13,9 +13,9 @@ define(function (require) {
|
|||
}],
|
||||
tunnelOptions: serverConfig.servers.webdriver,
|
||||
functionalSuites: [
|
||||
// 'test/functional/status_page/index',
|
||||
// 'test/functional/apps/settings/index',
|
||||
// 'test/functional/apps/discover/index',
|
||||
'test/functional/status_page/index',
|
||||
'test/functional/apps/settings/index',
|
||||
'test/functional/apps/discover/index',
|
||||
'test/functional/apps/visualize/index'
|
||||
],
|
||||
excludeInstrumentation: /(fixtures|node_modules)\//,
|
||||
|
@ -26,6 +26,7 @@ define(function (require) {
|
|||
}
|
||||
},
|
||||
timeouts: {
|
||||
// this is how long a test can run before timing out
|
||||
default: 90000
|
||||
},
|
||||
}, serverConfig);
|
||||
|
|
|
@ -339,14 +339,7 @@ define(function (require) {
|
|||
return self.remote
|
||||
.setFindTimeout(defaultTimeout)
|
||||
.findByLinkText(vizName)
|
||||
.click()
|
||||
.then(function getSpinnerDone() {
|
||||
return self.getSpinnerDone(); // only matches the hidden spinners
|
||||
})
|
||||
.catch(function () {
|
||||
common.debug('didn\'t find vis name on first page');
|
||||
return;
|
||||
});
|
||||
.click();
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -357,10 +350,7 @@ define(function (require) {
|
|||
.then(function (chartTypes) {
|
||||
function getChartType(chart) {
|
||||
return chart
|
||||
.getVisibleText()
|
||||
.then(function (theText) {
|
||||
return theText;
|
||||
});
|
||||
.getVisibleText();
|
||||
}
|
||||
var getChartTypesPromises = chartTypes.map(getChartType);
|
||||
return Promise.all(getChartTypesPromises);
|
||||
|
@ -379,10 +369,7 @@ define(function (require) {
|
|||
.then(function (chartTypes) {
|
||||
function getChartType(chart) {
|
||||
return chart
|
||||
.getVisibleText()
|
||||
.then(function (theText) {
|
||||
return theText;
|
||||
});
|
||||
.getVisibleText();
|
||||
}
|
||||
var getChartTypesPromises = chartTypes.map(getChartType);
|
||||
return Promise.all(getChartTypesPromises);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue