[functional tests] move common.handleError to a higher level

This commit is contained in:
spalger 2016-06-12 00:48:19 -07:00
parent 8294487cee
commit f0c370209e
24 changed files with 142 additions and 197 deletions

View file

@ -10,8 +10,7 @@ var expect = require('expect.js');
bdd.describe('console app', function describeIndexTests() {
bdd.before(function () {
common.debug('navigateTo console');
return common.navigateToApp('console', false)
.catch(common.handleError(this));
return common.navigateToApp('console', false);
});
@ -34,8 +33,7 @@ bdd.describe('console app', function describeIndexTests() {
expect(actualRequest).to.eql(expectedRequest);
});
});
})
.catch(common.handleError(this));
});
});
bdd.it('default request response should contain .kibana' , function () {
@ -49,7 +47,6 @@ bdd.describe('console app', function describeIndexTests() {
expect(actualResponse).to.contain(expectedResponseContains);
});
});
})
.catch(common.handleError(this));
});
});
});

View file

@ -28,8 +28,7 @@ bdd.describe('dashboard tab', function describeIndexTests() {
// wait for the logstash data load to finish if it hasn't already
.then(function () {
return logstash;
})
.catch(common.handleError(this));
});
});
bdd.describe('add visualizations to dashboard', function dashboardTest() {
@ -72,8 +71,7 @@ bdd.describe('dashboard tab', function describeIndexTests() {
.then(function takeScreenshot() {
common.debug('Take screenshot');
common.saveScreenshot('./screenshot-' + testSubName + '.png');
})
.catch(common.handleError(this));
});
});
bdd.it('should save and load dashboard', function saveAndLoadDashboard() {
@ -86,8 +84,7 @@ bdd.describe('dashboard tab', function describeIndexTests() {
})
.then(function () {
return dashboardPage.loadSavedDashboard(testSubName);
})
.catch(common.handleError(this));
});
});
bdd.it('should have all the expected visualizations', function checkVisualizations() {
@ -97,8 +94,7 @@ bdd.describe('dashboard tab', function describeIndexTests() {
common.log('visualization titles = ' + panelTitles);
expect(panelTitles).to.eql(visualizations);
});
})
.catch(common.handleError(this));
});
});
bdd.it('should have all the expected initial sizes', function checkVisualizationSizes() {
@ -116,8 +112,7 @@ bdd.describe('dashboard tab', function describeIndexTests() {
common.log('visualization titles = ' + panelTitles);
expect(panelTitles).to.eql(visObjects);
});
})
.catch(common.handleError(this));
});
});
});
});

View file

@ -33,8 +33,7 @@ bdd.describe('discover tab', function describeIndexTests() {
.then(function () {
common.debug('setAbsoluteRange');
return headerPage.setAbsoluteRange(fromTime, toTime);
})
.catch(common.handleError(this));
});
});
bdd.describe('field data', function () {
@ -43,8 +42,7 @@ bdd.describe('discover tab', function describeIndexTests() {
.then(function (width) {
common.debug('expanded sidebar width = ' + width);
expect(width > 180).to.be(true);
})
.catch(common.handleError(this));
});
});
bdd.it('should collapse when clicked', function () {
@ -56,8 +54,7 @@ bdd.describe('discover tab', function describeIndexTests() {
.then(function (width) {
common.debug('collapsed sidebar width = ' + width);
expect(width < 20).to.be(true);
})
.catch(common.handleError(this));
});
});
bdd.it('should expand when clicked', function () {
@ -69,8 +66,7 @@ bdd.describe('discover tab', function describeIndexTests() {
.then(function (width) {
common.debug('expanded sidebar width = ' + width);
expect(width > 180).to.be(true);
})
.catch(common.handleError(this));
});
});
});
});

View file

@ -33,8 +33,7 @@ bdd.describe('discover app', function describeIndexTests() {
.then(function () {
common.debug('setAbsoluteRange');
return headerPage.setAbsoluteRange(fromTime, toTime);
})
.catch(common.handleError(this));
});
});
@ -48,8 +47,7 @@ bdd.describe('discover app', function describeIndexTests() {
return discoverPage.getTimespanText()
.then(function (actualTimeString) {
expect(actualTimeString).to.be(expectedTimeRangeString);
})
.catch(common.handleError(this));
});
});
@ -70,8 +68,7 @@ bdd.describe('discover app', function describeIndexTests() {
})
.then(function (actualQueryNameString) {
expect(actualQueryNameString).to.be(queryName1);
})
.catch(common.handleError(this));
});
});
bdd.it('load query should show query name', function () {
@ -84,8 +81,7 @@ bdd.describe('discover app', function describeIndexTests() {
})
.then(function (actualQueryNameString) {
expect(actualQueryNameString).to.be(queryName1);
})
.catch(common.handleError(this));
});
});
bdd.it('should show the correct hit count', function () {
@ -95,8 +91,7 @@ bdd.describe('discover app', function describeIndexTests() {
.then(function compareData(hitCount) {
expect(hitCount).to.be(expectedHitCount);
});
})
.catch(common.handleError(this));
});
});
bdd.it('should show the correct bar chart', function () {
@ -109,8 +104,7 @@ bdd.describe('discover app', function describeIndexTests() {
return common.sleep(4000)
.then(function () {
return verifyChartData(expectedBarChartData);
})
.catch(common.handleError(this));
});
});
bdd.it('should show correct time range string in chart', function () {
@ -118,8 +112,7 @@ bdd.describe('discover app', function describeIndexTests() {
return discoverPage.getChartTimespan()
.then(function (actualTimeString) {
expect(actualTimeString).to.be(expectedTimeRangeString);
})
.catch(common.handleError(this));
});
});
bdd.it('should show correct initial chart interval of 3 hours', function () {
@ -127,8 +120,7 @@ bdd.describe('discover app', function describeIndexTests() {
return discoverPage.getChartInterval()
.then(function (actualInterval) {
expect(actualInterval).to.be(expectedChartInterval);
})
.catch(common.handleError(this));
});
});
bdd.it('should show correct data for chart interval Hourly', function () {
@ -152,8 +144,7 @@ bdd.describe('discover app', function describeIndexTests() {
})
.then(function () {
return verifyChartData(expectedBarChartData);
})
.catch(common.handleError(this));
});
});
bdd.it('should show correct data for chart interval Daily', function () {
@ -167,8 +158,7 @@ bdd.describe('discover app', function describeIndexTests() {
})
.then(function () {
return verifyChartData(expectedBarChartData);
})
.catch(common.handleError(this));
});
});
bdd.it('should show correct data for chart interval Weekly', function () {
@ -180,8 +170,7 @@ bdd.describe('discover app', function describeIndexTests() {
})
.then(function () {
return verifyChartData(expectedBarChartData);
})
.catch(common.handleError(this));
});
});
bdd.it('browser back button should show previous interval Daily', function () {
@ -200,8 +189,7 @@ bdd.describe('discover app', function describeIndexTests() {
})
.then(function () {
return verifyChartData(expectedBarChartData);
})
.catch(common.handleError(this));
});
});
bdd.it('should show correct data for chart interval Monthly', function () {
@ -213,8 +201,7 @@ bdd.describe('discover app', function describeIndexTests() {
})
.then(function () {
return verifyChartData(expectedBarChartData);
})
.catch(common.handleError(this));
});
});
bdd.it('should show correct data for chart interval Yearly', function () {
@ -226,8 +213,7 @@ bdd.describe('discover app', function describeIndexTests() {
})
.then(function () {
return verifyChartData(expectedBarChartData);
})
.catch(common.handleError(this));
});
});
bdd.it('should show correct data for chart interval Auto', function () {
@ -244,8 +230,7 @@ bdd.describe('discover app', function describeIndexTests() {
})
.then(function () {
return verifyChartData(expectedBarChartData);
})
.catch(common.handleError(this));
});
});
bdd.it('should show Auto chart interval of 3 hours', function () {
@ -253,15 +238,13 @@ bdd.describe('discover app', function describeIndexTests() {
return discoverPage.getChartInterval()
.then(function (actualInterval) {
expect(actualInterval).to.be(expectedChartInterval);
})
.catch(common.handleError(this));
});
});
bdd.it('should not show "no results"', () => {
return discoverPage.hasNoResults().then(visible => {
expect(visible).to.be(false);
})
.catch(common.handleError(this));
});
});
function verifyChartData(expectedBarChartData) {
@ -301,22 +284,19 @@ bdd.describe('discover app', function describeIndexTests() {
bdd.before(() => {
common.debug('setAbsoluteRangeForAnotherQuery');
return headerPage
.setAbsoluteRange(fromTime, toTime)
.catch(common.handleError(this));
.setAbsoluteRange(fromTime, toTime);
});
bdd.it('should show "no results"', () => {
return discoverPage.hasNoResults().then(visible => {
expect(visible).to.be(true);
})
.catch(common.handleError(this));
});
});
bdd.it('should suggest a new time range is picked', () => {
return discoverPage.hasNoResultsTimepicker().then(visible => {
expect(visible).to.be(true);
})
.catch(common.handleError(this));
});
});
bdd.it('should open and close the time picker', () => {

View file

@ -33,8 +33,7 @@ bdd.describe('discover app', function describeIndexTests() {
.then(function () {
common.debug('setAbsoluteRange');
return headerPage.setAbsoluteRange(fromTime, toTime);
})
.catch(common.handleError(this));
});
});
@ -53,8 +52,7 @@ bdd.describe('discover app', function describeIndexTests() {
expect(hitCount).to.be(expectedHitCount);
});
});
})
.catch(common.handleError(this));
});
});
bdd.it('the search term should be highlighted in the field data', function () {
@ -63,8 +61,7 @@ bdd.describe('discover app', function describeIndexTests() {
.then(function (marks) {
expect(marks.length).to.be(50);
expect(marks.indexOf('php')).to.be(0);
})
.catch(common.handleError(this));
});
});
@ -78,8 +75,7 @@ bdd.describe('discover app', function describeIndexTests() {
expect(hitCount).to.be(expectedHitCount);
});
});
})
.catch(common.handleError(this));
});
});
bdd.it('doc view should show Time and _source columns', function () {
@ -87,8 +83,7 @@ bdd.describe('discover app', function describeIndexTests() {
return discoverPage.getDocHeader()
.then(function (header) {
expect(header).to.be(expectedHeader);
})
.catch(common.handleError(this));
});
});
bdd.it('doc view should show oldest time first', function () {
@ -139,8 +134,7 @@ bdd.describe('discover app', function describeIndexTests() {
return discoverPage.getDocTableIndex(1)
.then(function (rowData) {
expect(rowData).to.be(ExpectedDoc);
})
.catch(common.handleError(this));
});
});
bdd.it('doc view should sort ascending', function () {
@ -231,8 +225,7 @@ bdd.describe('discover app', function describeIndexTests() {
expect(rowData).to.be(ExpectedDoc);
});
});
})
.catch(common.handleError(this));
});
});
@ -248,8 +241,7 @@ bdd.describe('discover app', function describeIndexTests() {
})
.then(function () {
return headerPage.clickToastOK();
})
.catch(common.handleError(this));
});
});
});
});

View file

@ -47,8 +47,7 @@ bdd.describe('shared links', function describeIndexTests() {
//After hiding the time picker, we need to wait for
//the refresh button to hide before clicking the share button
return common.sleep(1000);
})
.catch(common.handleError(this));
});
});
@ -61,8 +60,7 @@ bdd.describe('shared links', function describeIndexTests() {
})
.then(function (actualCaption) {
expect(actualCaption).to.be(expectedCaption);
})
.catch(common.handleError(this));
});
});
bdd.it('should show the correct formatted URL', function () {
@ -78,8 +76,7 @@ bdd.describe('shared links', function describeIndexTests() {
// strip the timestamp out of each URL
expect(actualUrl.replace(/_t=\d{13}/,'_t=TIMESTAMP'))
.to.be(expectedUrl.replace(/_t=\d{13}/,'_t=TIMESTAMP'));
})
.catch(common.handleError(this));
});
});
bdd.it('should show toast message for copy to clipboard', function () {
@ -92,8 +89,7 @@ bdd.describe('shared links', function describeIndexTests() {
})
.then(function () {
return headerPage.waitForToastMessageGone();
})
.catch(common.handleError(this));
});
});
// TODO: verify clipboard contents
@ -107,8 +103,7 @@ bdd.describe('shared links', function describeIndexTests() {
expect(actualUrl).to.match(re);
});
});
})
.catch(common.handleError(this));
});
});
// NOTE: This test has to run immediately after the test above
@ -122,8 +117,7 @@ bdd.describe('shared links', function describeIndexTests() {
})
.then(function () {
return headerPage.waitForToastMessageGone();
})
.catch(common.handleError(this));
});
});
});
});

View file

@ -33,8 +33,7 @@ bdd.describe('creating and deleting default index', function describeIndexTests(
})
.then(function (advancedSetting) {
expect(advancedSetting).to.be('America/Phoenix');
})
.catch(common.handleError(this));
});
});
});

View file

@ -49,7 +49,6 @@ bdd.describe('user input reactions', function () {
.then(function (enabled) {
expect(enabled).to.be.ok();
});
})
.catch(common.handleError(this));
});
});
});

View file

@ -27,8 +27,7 @@ bdd.describe('creating and deleting default index', function describeIndexTests(
return settingsPage.getIndexPageHeading().getVisibleText()
.then(function (patternName) {
expect(patternName).to.be('logstash-*');
})
.catch(common.handleError(this));
});
});
bdd.it('should have index pattern in url', function url() {
@ -37,8 +36,7 @@ bdd.describe('creating and deleting default index', function describeIndexTests(
.then(function (currentUrl) {
expect(currentUrl).to.contain('logstash-*');
});
})
.catch(common.handleError(this));
});
});
bdd.it('should have expected table headers', function checkingHeader() {
@ -65,8 +63,7 @@ bdd.describe('creating and deleting default index', function describeIndexTests(
});
return Promise.all(comparedHeaders);
})
.catch(common.handleError(this));
});
});
});
@ -82,8 +79,7 @@ bdd.describe('creating and deleting default index', function describeIndexTests(
bdd.it('should return to index pattern creation page', function returnToPage() {
return common.try(function tryingForTime() {
return settingsPage.getCreateButton();
})
.catch(common.handleError(this));
});
});
bdd.it('should remove index pattern from url', function indexNotInUrl() {
@ -94,8 +90,7 @@ bdd.describe('creating and deleting default index', function describeIndexTests(
common.debug('currentUrl = ' + currentUrl);
expect(currentUrl).to.not.contain('logstash-*');
});
})
.catch(common.handleError(this));
});
});
});
});

View file

@ -63,8 +63,7 @@ bdd.describe('index result popularity', function describeIndexTests() {
.then(function (popularity) {
common.debug('popularity = ' + popularity);
expect(popularity).to.be('1');
})
.catch(common.handleError(this));
});
});
bdd.it('should be reset on cancel', function pageHeader() {
@ -83,8 +82,7 @@ bdd.describe('index result popularity', function describeIndexTests() {
.then(function (popularity) {
common.debug('popularity = ' + popularity);
expect(popularity).to.be('0');
})
.catch(common.handleError(this));
});
});
bdd.it('can be saved', function pageHeader() {
@ -103,8 +101,7 @@ bdd.describe('index result popularity', function describeIndexTests() {
.then(function (popularity) {
common.debug('popularity = ' + popularity);
expect(popularity).to.be('1');
})
.catch(common.handleError(this));
});
});
}); // end 'change popularity'
}); // end index result popularity

View file

@ -52,8 +52,7 @@ bdd.describe('index result field sort', function describeIndexTests() {
})
.then(function (rowText) {
expect(rowText).to.be(col.first);
})
.catch(common.handleError(this));
});
});
bdd.it('should sort descending', function pageHeader() {
@ -66,8 +65,7 @@ bdd.describe('index result field sort', function describeIndexTests() {
})
.then(function (rowText) {
expect(rowText).to.be(col.last);
})
.catch(common.handleError(this));
});
});
});
});
@ -95,16 +93,14 @@ bdd.describe('index result field sort', function describeIndexTests() {
.then(function (tabCount) {
expect(tabCount).to.be('' + expectedFieldCount);
});
})
.catch(common.handleError(this));
});
});
bdd.it('should have correct default page size selected', function () {
return settingsPage.getPageSize()
.then(function (pageSize) {
expect(pageSize).to.be('' + expectedDefaultPageSize);
})
.catch(common.handleError(this));
});
});
bdd.it('should have the correct number of rows per page', function () {

View file

@ -21,16 +21,14 @@ bdd.describe('initial state', function () {
return settingsPage.getTimeBasedEventsCheckbox().isSelected()
.then(function (selected) {
expect(selected).to.be.ok();
})
.catch(common.handleError(this));
});
});
bdd.it('should load with name pattern unchecked', function () {
return settingsPage.getTimeBasedIndexPatternCheckbox().isSelected()
.then(function (selected) {
expect(selected).to.not.be.ok();
})
.catch(common.handleError(this));
});
});
bdd.it('should contain default index pattern', function () {
@ -39,8 +37,7 @@ bdd.describe('initial state', function () {
return settingsPage.getIndexPatternField().getProperty('value')
.then(function (pattern) {
expect(pattern).to.be(defaultPattern);
})
.catch(common.handleError(this));
});
});
bdd.it('should not select the time field', function () {
@ -48,15 +45,13 @@ bdd.describe('initial state', function () {
.then(function (timeFieldIsSelected) {
common.debug('timeField isSelected = ' + timeFieldIsSelected);
expect(timeFieldIsSelected).to.not.be.ok();
})
.catch(common.handleError(this));
});
});
bdd.it('should not be enable creation', function () {
return settingsPage.getCreateButton().isEnabled()
.then(function (enabled) {
expect(enabled).to.not.be.ok();
})
.catch(common.handleError(this));
});
});
});

View file

@ -57,8 +57,7 @@ bdd.describe('visualize app', function describeIndexTests() {
.then(function getSpinnerDone() {
common.debug('Waiting...');
return headerPage.getSpinnerDone();
})
.catch(common.handleError(this));
});
});
bdd.describe('area charts', function indexPatternCreation() {
@ -85,8 +84,7 @@ bdd.describe('visualize app', function describeIndexTests() {
// otherwise it hangs.
.then(function sleep() {
return common.sleep(2000);
})
.catch(common.handleError(this));
});
});
@ -125,8 +123,7 @@ bdd.describe('visualize app', function describeIndexTests() {
.then(function takeScreenshot() {
common.debug('Take screenshot');
common.saveScreenshot('./screenshot-' + testSubName + '.png');
})
.catch(common.handleError(this));
});
});
@ -167,8 +164,7 @@ bdd.describe('visualize app', function describeIndexTests() {
.then(function showData(data) {
common.debug('getDataTableData = ' + data.split('\n'));
expect(data.trim().split('\n')).to.eql(expectedTableData);
})
.catch(common.handleError(this));
});
});

View file

@ -29,8 +29,7 @@ bdd.describe('visualize app', function describeIndexTests() {
common.debug('returned chart types = ' + chartTypes);
common.debug('expected chart types = ' + expectedChartTypes);
expect(chartTypes).to.eql(expectedChartTypes);
})
.catch(common.handleError(this));
});
});
});
});

View file

@ -49,8 +49,7 @@ bdd.describe('visualize app', function describeIndexTests() {
})
.then(function () {
return headerPage.getSpinnerDone();
})
.catch(common.handleError(this));
});
});
@ -72,8 +71,7 @@ bdd.describe('visualize app', function describeIndexTests() {
})
.then(function () {
return visualizePage.waitForVisualization();
})
.catch(common.handleError(this));
});
});
@ -91,8 +89,7 @@ bdd.describe('visualize app', function describeIndexTests() {
.then(function takeScreenshot() {
common.debug('Take screenshot');
common.saveScreenshot('./screenshot-' + testSubName + '.png');
})
.catch(common.handleError(this));
});
});

View file

@ -48,8 +48,7 @@ bdd.describe('visualize app', function describeIndexTests() {
})
.then(function () {
return headerPage.getSpinnerDone(); // only matches the hidden spinner
})
.catch(common.handleError(this));
});
});
bdd.describe('line charts', function indexPatternCreation() {
@ -74,8 +73,7 @@ bdd.describe('visualize app', function describeIndexTests() {
})
.then(function waitForVisualization() {
return visualizePage.waitForVisualization();
})
.catch(common.handleError(this));
});
});
@ -106,8 +104,7 @@ bdd.describe('visualize app', function describeIndexTests() {
// 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 data', function pageHeader() {
@ -122,8 +119,7 @@ bdd.describe('visualize app', function describeIndexTests() {
.then(function showData(data) {
common.debug(data.split('\n'));
expect(data.trim().split('\n')).to.eql(expectedChartData);
})
.catch(common.handleError(this));
});
});

View file

@ -31,8 +31,7 @@ bdd.describe('visualize app', function describeIndexTests() {
.then(function setAbsoluteRange() {
common.debug('Set absolute time range from \"' + fromTime + '\" to \"' + toTime + '\"');
return headerPage.setAbsoluteRange(fromTime, toTime);
})
.catch(common.handleError(this));
});
});
@ -71,8 +70,7 @@ bdd.describe('visualize app', function describeIndexTests() {
expect(avgMachineRam).to.eql(metricValue.split('\n'));
});
});
})
.catch(common.handleError(this));
});
});
bdd.it('should show Sum', function pageHeader() {
@ -93,8 +91,7 @@ bdd.describe('visualize app', function describeIndexTests() {
expect(sumPhpMemory).to.eql(metricValue.split('\n'));
});
});
})
.catch(common.handleError(this));
});
});
bdd.it('should show Median', function pageHeader() {
@ -117,8 +114,7 @@ bdd.describe('visualize app', function describeIndexTests() {
expect(medianBytes[1]).to.eql(metricValue.split('\n')[1]);
});
});
})
.catch(common.handleError(this));
});
});
bdd.it('should show Min', function pageHeader() {
@ -139,8 +135,7 @@ bdd.describe('visualize app', function describeIndexTests() {
expect(minTimestamp).to.eql(metricValue.split('\n'));
});
});
})
.catch(common.handleError(this));
});
});
bdd.it('should show Max', function pageHeader() {
@ -161,8 +156,7 @@ bdd.describe('visualize app', function describeIndexTests() {
expect(maxRelatedContentArticleModifiedTime).to.eql(metricValue.split('\n'));
});
});
})
.catch(common.handleError(this));
});
});
bdd.it('should show Standard Deviation', function pageHeader() {
@ -187,8 +181,7 @@ bdd.describe('visualize app', function describeIndexTests() {
expect(standardDeviationBytes).to.eql(metricValue.split('\n'));
});
});
})
.catch(common.handleError(this));
});
});
bdd.it('should show Unique Count', function pageHeader() {
@ -216,8 +209,7 @@ bdd.describe('visualize app', function describeIndexTests() {
common.debug('metricValue=' + metricValue.split('\n'));
expect(uniqueCountClientip).to.eql(metricValue.split('\n'));
});
})
.catch(common.handleError(this));
});
});
bdd.it('should show Percentiles', function pageHeader() {
@ -247,8 +239,7 @@ bdd.describe('visualize app', function describeIndexTests() {
expect(percentileMachineRam).to.eql(metricValue.split('\n'));
});
});
})
.catch(common.handleError(this));
});
});
bdd.it('should show Percentile Ranks', function pageHeader() {
@ -273,8 +264,7 @@ bdd.describe('visualize app', function describeIndexTests() {
expect(percentileRankBytes).to.eql(metricValue.split('\n'));
});
});
})
.catch(common.handleError(this));
});
});
});

View file

@ -85,8 +85,7 @@ bdd.describe('visualize app', function describeIndexTests() {
// sleep a bit before trying to get the pie chart data below
.then(function sleep() {
return common.sleep(2000);
})
.catch(common.handleError(this));
});
});
bdd.it('should show 10 slices in pie chart, take screenshot', function pageHeader() {
@ -102,8 +101,7 @@ bdd.describe('visualize app', function describeIndexTests() {
.then(function takeScreenshot() {
common.debug('Take screenshot');
common.saveScreenshot('./screenshot-' + testSubName + '.png');
})
.catch(common.handleError(this));
});
});
bdd.it('should show correct data', function pageHeader() {
@ -122,8 +120,7 @@ bdd.describe('visualize app', function describeIndexTests() {
.then(function showData(data) {
common.debug(data.split('\n'));
expect(data.trim().split('\n')).to.eql(expectedTableData);
})
.catch(common.handleError(this));
});
});

View file

@ -47,8 +47,7 @@ bdd.describe('visualize app', function describeIndexTests() {
})
.then(function () {
return headerPage.getSpinnerDone();
})
.catch(common.handleError(this));
});
});
@ -81,8 +80,7 @@ bdd.describe('visualize app', function describeIndexTests() {
.then(function takeScreenshot() {
common.debug('Take screenshot');
common.saveScreenshot('./screenshot-' + testSubName + '.png');
})
.catch(common.handleError(this));
});
});
bdd.it('should show correct tile map data', function pageHeader() {
@ -107,8 +105,7 @@ bdd.describe('visualize app', function describeIndexTests() {
common.debug(data.split('\n'));
expect(data.trim().split('\n')).to.eql(expectedTableData);
});
})
.catch(common.handleError(this));
});
});

View file

@ -72,8 +72,7 @@ bdd.describe('visualize app', function describeIndexTests() {
})
.then(function waitForVisualization() {
return visualizePage.waitForVisualization();
})
.catch(common.handleError(this));
});
});
@ -97,8 +96,7 @@ bdd.describe('visualize app', function describeIndexTests() {
.then(function takeScreenshot() {
common.debug('Take screenshot');
common.saveScreenshot('./screenshot-' + testSubName + '.png');
})
.catch(common.handleError(this));
});
});
@ -124,8 +122,7 @@ bdd.describe('visualize app', function describeIndexTests() {
.then(function showData(data) {
common.debug(data.split('\n'));
expect(data.trim().split('\n')).to.eql(expectedChartData);
})
.catch(common.handleError(this));
});
});
});
});

View file

@ -26,8 +26,7 @@ bdd.describe('visualize app', function () {
// wait for the logstash data load to finish if it hasn't already
.then(function () {
return logstash;
})
.catch(common.handleError(this));
});
});
require('./_chart_types');

View file

@ -0,0 +1,42 @@
import { attempt } from 'bluebird';
import { common } from './';
export default class BddWrapper {
constructor(real) {
this.real = real;
}
errorWrapper = fn => {
// we want to assume the context set
// by the test runner, so don't use an arrow
return function () {
const suiteOrTest = this;
return attempt(fn.bind(suiteOrTest)).catch(common.handleError(suiteOrTest));
};
}
describe = (name, fn) => {
this.real.describe(name, fn);
}
before = (fn) => {
this.real.before(this.errorWrapper(fn));
}
beforeEach = (fn) => {
this.real.beforeEach(this.errorWrapper(fn));
}
it = (name, fn) => {
this.real.it(name, this.errorWrapper(fn));
}
afterEach = (fn) => {
this.real.afterEach(this.errorWrapper(fn));
}
after = (fn) => {
this.real.after(this.errorWrapper(fn));
}
}

View file

@ -1,6 +1,7 @@
import url from 'url';
import EsClient from './es_client';
import ElasticDump from './elastic_dump';
import BddWrapper from './bdd_wrapper';
import ScenarioManager from '../fixtures/scenario_manager';
import Common from './pages/common';
import DiscoverPage from './pages/discover_page';
@ -13,7 +14,6 @@ import ConsolePage from './pages/console_page';
const kbnInternVars = global.__kibana__intern__;
exports.bdd = kbnInternVars.bdd;
exports.intern = kbnInternVars.intern;
exports.config = exports.intern.config;
exports.defaultTimeout = exports.config.defaultTimeout;
@ -21,6 +21,7 @@ exports.defaultTryTimeout = exports.config.defaultTryTimeout;
exports.defaultFindTimeout = exports.config.defaultFindTimeout;
exports.scenarioManager = new ScenarioManager(url.format(exports.config.servers.elasticsearch));
exports.esClient = new EsClient(url.format(exports.config.servers.elasticsearch));
exports.bdd = new BddWrapper(kbnInternVars.bdd);
defineDelayedExport('remote', (suite) => suite.remote);
defineDelayedExport('common', () => new Common());

View file

@ -44,8 +44,7 @@ export default (function () {
.then(function clickSave() {
common.debug('--find save button');
return common.findTestSubject('discover-save-search-btn').click();
})
.catch(common.handleError(this));
});
},
loadSavedSearch: function loadSavedSearch(searchName) {