diff --git a/test/functional/apps/console/_console.js b/test/functional/apps/console/_console.js index 0df880b71b55b..2f96481dca0d1 100644 --- a/test/functional/apps/console/_console.js +++ b/test/functional/apps/console/_console.js @@ -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)); + }); }); }); diff --git a/test/functional/apps/dashboard/_dashboard.js b/test/functional/apps/dashboard/_dashboard.js index 53bda6c3bd279..7c045ac614a26 100644 --- a/test/functional/apps/dashboard/_dashboard.js +++ b/test/functional/apps/dashboard/_dashboard.js @@ -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)); + }); }); }); }); diff --git a/test/functional/apps/discover/_collapse_expand.js b/test/functional/apps/discover/_collapse_expand.js index a668b9f82f8e9..354638990d286 100644 --- a/test/functional/apps/discover/_collapse_expand.js +++ b/test/functional/apps/discover/_collapse_expand.js @@ -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)); + }); }); }); }); diff --git a/test/functional/apps/discover/_discover.js b/test/functional/apps/discover/_discover.js index 9e9136d7c832c..abb8f8e5bd9cb 100644 --- a/test/functional/apps/discover/_discover.js +++ b/test/functional/apps/discover/_discover.js @@ -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', () => { diff --git a/test/functional/apps/discover/_field_data.js b/test/functional/apps/discover/_field_data.js index 6652021d0b31d..eac33162b91bf 100644 --- a/test/functional/apps/discover/_field_data.js +++ b/test/functional/apps/discover/_field_data.js @@ -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)); + }); }); }); }); diff --git a/test/functional/apps/discover/_shared_links.js b/test/functional/apps/discover/_shared_links.js index 0fd461b550fa0..dbbe940b115fc 100644 --- a/test/functional/apps/discover/_shared_links.js +++ b/test/functional/apps/discover/_shared_links.js @@ -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)); + }); }); }); }); diff --git a/test/functional/apps/settings/_advanced_settings.js b/test/functional/apps/settings/_advanced_settings.js index 50c815aafe3e8..b85b4b4ee0493 100644 --- a/test/functional/apps/settings/_advanced_settings.js +++ b/test/functional/apps/settings/_advanced_settings.js @@ -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)); + }); }); }); diff --git a/test/functional/apps/settings/_creation_form_changes.js b/test/functional/apps/settings/_creation_form_changes.js index d5fd4727b18ea..f80d771a127ba 100644 --- a/test/functional/apps/settings/_creation_form_changes.js +++ b/test/functional/apps/settings/_creation_form_changes.js @@ -49,7 +49,6 @@ bdd.describe('user input reactions', function () { .then(function (enabled) { expect(enabled).to.be.ok(); }); - }) - .catch(common.handleError(this)); + }); }); }); diff --git a/test/functional/apps/settings/_index_pattern_create_delete.js b/test/functional/apps/settings/_index_pattern_create_delete.js index 3cbcffc1e4c0f..0578662e76ea5 100644 --- a/test/functional/apps/settings/_index_pattern_create_delete.js +++ b/test/functional/apps/settings/_index_pattern_create_delete.js @@ -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)); + }); }); }); }); diff --git a/test/functional/apps/settings/_index_pattern_popularity.js b/test/functional/apps/settings/_index_pattern_popularity.js index 3ab47d6c6aa9a..f7bb041db67f3 100644 --- a/test/functional/apps/settings/_index_pattern_popularity.js +++ b/test/functional/apps/settings/_index_pattern_popularity.js @@ -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 diff --git a/test/functional/apps/settings/_index_pattern_results_sort.js b/test/functional/apps/settings/_index_pattern_results_sort.js index 2f8a4a88aa55a..5f2fc88a52ac7 100644 --- a/test/functional/apps/settings/_index_pattern_results_sort.js +++ b/test/functional/apps/settings/_index_pattern_results_sort.js @@ -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 () { diff --git a/test/functional/apps/settings/_initial_state.js b/test/functional/apps/settings/_initial_state.js index a283ac97d4488..8d844572dd55e 100644 --- a/test/functional/apps/settings/_initial_state.js +++ b/test/functional/apps/settings/_initial_state.js @@ -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)); + }); }); }); diff --git a/test/functional/apps/visualize/_area_chart.js b/test/functional/apps/visualize/_area_chart.js index c933acc54b6ef..b95c5275b85b6 100644 --- a/test/functional/apps/visualize/_area_chart.js +++ b/test/functional/apps/visualize/_area_chart.js @@ -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)); + }); }); diff --git a/test/functional/apps/visualize/_chart_types.js b/test/functional/apps/visualize/_chart_types.js index a352a5bc197cc..1e375de7f868a 100644 --- a/test/functional/apps/visualize/_chart_types.js +++ b/test/functional/apps/visualize/_chart_types.js @@ -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)); + }); }); }); }); diff --git a/test/functional/apps/visualize/_data_table.js b/test/functional/apps/visualize/_data_table.js index ad5753c0f0f20..8734f51a54ac3 100644 --- a/test/functional/apps/visualize/_data_table.js +++ b/test/functional/apps/visualize/_data_table.js @@ -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)); + }); }); diff --git a/test/functional/apps/visualize/_line_chart.js b/test/functional/apps/visualize/_line_chart.js index 0b89c289f570d..0382f070bf4ac 100644 --- a/test/functional/apps/visualize/_line_chart.js +++ b/test/functional/apps/visualize/_line_chart.js @@ -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)); + }); }); diff --git a/test/functional/apps/visualize/_metric_chart.js b/test/functional/apps/visualize/_metric_chart.js index fd026b601f858..811061858af24 100644 --- a/test/functional/apps/visualize/_metric_chart.js +++ b/test/functional/apps/visualize/_metric_chart.js @@ -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)); + }); }); }); diff --git a/test/functional/apps/visualize/_pie_chart.js b/test/functional/apps/visualize/_pie_chart.js index 7b06e4c433cb9..424f855698a32 100644 --- a/test/functional/apps/visualize/_pie_chart.js +++ b/test/functional/apps/visualize/_pie_chart.js @@ -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)); + }); }); diff --git a/test/functional/apps/visualize/_tile_map.js b/test/functional/apps/visualize/_tile_map.js index dd7b2c0471e36..3693fbc888367 100644 --- a/test/functional/apps/visualize/_tile_map.js +++ b/test/functional/apps/visualize/_tile_map.js @@ -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)); + }); }); diff --git a/test/functional/apps/visualize/_vertical_bar_chart.js b/test/functional/apps/visualize/_vertical_bar_chart.js index 4e5586397e884..ec399a32879b5 100644 --- a/test/functional/apps/visualize/_vertical_bar_chart.js +++ b/test/functional/apps/visualize/_vertical_bar_chart.js @@ -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)); + }); }); }); }); diff --git a/test/functional/apps/visualize/index.js b/test/functional/apps/visualize/index.js index ac4a12b95aa00..215f14b5fb2fd 100644 --- a/test/functional/apps/visualize/index.js +++ b/test/functional/apps/visualize/index.js @@ -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'); diff --git a/test/support/bdd_wrapper.js b/test/support/bdd_wrapper.js new file mode 100644 index 0000000000000..e2973465c2523 --- /dev/null +++ b/test/support/bdd_wrapper.js @@ -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)); + } +} diff --git a/test/support/index.js b/test/support/index.js index 476a40d1e8ee9..6a0ccf41d014d 100644 --- a/test/support/index.js +++ b/test/support/index.js @@ -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()); diff --git a/test/support/pages/discover_page.js b/test/support/pages/discover_page.js index 490342eaec861..5af23960e3d16 100644 --- a/test/support/pages/discover_page.js +++ b/test/support/pages/discover_page.js @@ -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) {