diff --git a/test/functional/apps/console/_console.js b/test/functional/apps/console/_console.js index d1cc4c4ae96daa..0df880b71b55b6 100644 --- a/test/functional/apps/console/_console.js +++ b/test/functional/apps/console/_console.js @@ -5,57 +5,51 @@ import { consolePage } from '../../../support'; -(function () { - var expect = require('expect.js'); +var expect = require('expect.js'); - (function () { - bdd.describe('console app', function describeIndexTests() { - bdd.before(function () { - common.debug('navigateTo console'); - return common.navigateToApp('console', false) - .catch(common.handleError(this)); - }); +bdd.describe('console app', function describeIndexTests() { + bdd.before(function () { + common.debug('navigateTo console'); + return common.navigateToApp('console', false) + .catch(common.handleError(this)); + }); - bdd.it('should show the default request', function () { - var expectedRequest = [ - 'GET _search', - '{', - ' "query": {', - ' "match_all": {}', - ' }', - '}', - '' - ]; - // collapse the help pane because we only get the VISIBLE TEXT, not the part that is scrolled - return consolePage.collapseHelp() - .then(function () { - return common.try(function () { - return consolePage.getRequest() - .then(function (actualRequest) { - expect(actualRequest).to.eql(expectedRequest); - }); - }); - }) - .catch(common.handleError(this)); + bdd.it('should show the default request', function () { + var expectedRequest = [ + 'GET _search', + '{', + ' "query": {', + ' "match_all": {}', + ' }', + '}', + '' + ]; + // collapse the help pane because we only get the VISIBLE TEXT, not the part that is scrolled + return consolePage.collapseHelp() + .then(function () { + return common.try(function () { + return consolePage.getRequest() + .then(function (actualRequest) { + expect(actualRequest).to.eql(expectedRequest); + }); }); + }) + .catch(common.handleError(this)); + }); - bdd.it('default request response should contain .kibana' , function () { - var expectedResponseContains = '"_index": ".kibana",'; - return consolePage.clickPlay() - .then(function () { - return common.try(function () { - return consolePage.getResponse() - .then(function (actualResponse) { - common.debug(actualResponse); - expect(actualResponse).to.contain(expectedResponseContains); - }); - }); - }) - .catch(common.handleError(this)); + bdd.it('default request response should contain .kibana' , function () { + var expectedResponseContains = '"_index": ".kibana",'; + return consolePage.clickPlay() + .then(function () { + return common.try(function () { + return consolePage.getResponse() + .then(function (actualResponse) { + common.debug(actualResponse); + expect(actualResponse).to.contain(expectedResponseContains); + }); }); - - - }); - }()); -}()); + }) + .catch(common.handleError(this)); + }); +}); diff --git a/test/functional/apps/console/index.js b/test/functional/apps/console/index.js index 7e48a17b7baf5c..b5af2f031eb3f9 100644 --- a/test/functional/apps/console/index.js +++ b/test/functional/apps/console/index.js @@ -1,13 +1,11 @@ import { bdd, remote, scenarioManager, defaultTimeout } from '../../../support'; -(function () { - bdd.describe('console app', function () { - this.timeout = defaultTimeout; +bdd.describe('console app', function () { + this.timeout = defaultTimeout; - bdd.before(function () { - return remote.setWindowSize(1200,800); - }); - - require('./_console'); + bdd.before(function () { + return remote.setWindowSize(1200,800); }); -}()); + + require('./_console'); +}); diff --git a/test/functional/apps/dashboard/_dashboard.js b/test/functional/apps/dashboard/_dashboard.js index b2bf2b1466440c..53bda6c3bd2797 100644 --- a/test/functional/apps/dashboard/_dashboard.js +++ b/test/functional/apps/dashboard/_dashboard.js @@ -8,128 +8,116 @@ import { elasticDump } from '../../../support'; -(function () { - var expect = require('expect.js'); - - (function () { - bdd.describe('dashboard tab', function describeIndexTests() { - - bdd.before(function () { - - common.debug('Starting dashboard before method'); - var logstash = scenarioManager.loadIfEmpty('logstashFunctional'); - // delete .kibana index and update configDoc - return esClient.deleteAndUpdateConfigDoc({'dateFormat:tz':'UTC', 'defaultIndex':'logstash-*'}) - // and load a set of makelogs data - .then(function loadkibanaVisualizations() { - common.debug('load kibana index with visualizations'); - return elasticDump.elasticLoad('dashboard','.kibana'); - }) - .then(function () { - common.debug('navigateToApp dashboard'); - return common.navigateToApp('dashboard'); - }) - // 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() { - var visualizations = ['Visualization漢字 AreaChart', - 'Visualization☺漢字 DataTable', - 'Visualization漢字 LineChart', - 'Visualization PieChart', - 'Visualization TileMap', - 'Visualization☺ VerticalBarChart', - 'Visualization MetricChart' - ]; - - - bdd.it('should be able to add visualizations to dashboard', function addVisualizations() { - - function addVisualizations(arr) { - return arr.reduce(function (promise, vizName) { - return promise - .then(function () { - return dashboardPage.addVisualization(vizName); - }); - }, Promise.resolve()); - } - - return addVisualizations(visualizations) +var expect = require('expect.js'); + +bdd.describe('dashboard tab', function describeIndexTests() { + bdd.before(function () { + common.debug('Starting dashboard before method'); + var logstash = scenarioManager.loadIfEmpty('logstashFunctional'); + // delete .kibana index and update configDoc + return esClient.deleteAndUpdateConfigDoc({'dateFormat:tz':'UTC', 'defaultIndex':'logstash-*'}) + // and load a set of makelogs data + .then(function loadkibanaVisualizations() { + common.debug('load kibana index with visualizations'); + return elasticDump.elasticLoad('dashboard','.kibana'); + }) + .then(function () { + common.debug('navigateToApp dashboard'); + return common.navigateToApp('dashboard'); + }) + // 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() { + var visualizations = ['Visualization漢字 AreaChart', + 'Visualization☺漢字 DataTable', + 'Visualization漢字 LineChart', + 'Visualization PieChart', + 'Visualization TileMap', + 'Visualization☺ VerticalBarChart', + 'Visualization MetricChart' + ]; + + bdd.it('should be able to add visualizations to dashboard', function addVisualizations() { + function addVisualizations(arr) { + return arr.reduce(function (promise, vizName) { + return promise .then(function () { - common.debug('done adding visualizations'); + return dashboardPage.addVisualization(vizName); }); + }, Promise.resolve()); + } - }); - - bdd.it('set the timepicker time to that which contains our test data', function setTimepicker() { - var fromTime = '2015-09-19 06:31:44.000'; - var toTime = '2015-09-23 18:31:44.000'; - var testSubName = 'Dashboard Test 1'; + return addVisualizations(visualizations) + .then(function () { + common.debug('done adding visualizations'); + }); + }); - // .then(function () { - common.debug('Set absolute time range from \"' + fromTime + '\" to \"' + toTime + '\"'); - return headerPage.setAbsoluteRange(fromTime, toTime) - .then(function sleep() { - return common.sleep(4000); - }) - .then(function takeScreenshot() { - common.debug('Take screenshot'); - common.saveScreenshot('./screenshot-' + testSubName + '.png'); - }) - .catch(common.handleError(this)); - }); + bdd.it('set the timepicker time to that which contains our test data', function setTimepicker() { + var fromTime = '2015-09-19 06:31:44.000'; + var toTime = '2015-09-23 18:31:44.000'; + var testSubName = 'Dashboard Test 1'; + + // .then(function () { + common.debug('Set absolute time range from \"' + fromTime + '\" to \"' + toTime + '\"'); + return headerPage.setAbsoluteRange(fromTime, toTime) + .then(function sleep() { + return common.sleep(4000); + }) + .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() { - var testSubName = 'Dashboard Test 1'; - // TODO: save time on the dashboard and test it - return dashboardPage.saveDashboard(testSubName) - // click New Dashboard just to clear the one we just created - .then(function () { - return dashboardPage.clickNewDashboard(); - }) - .then(function () { - return dashboardPage.loadSavedDashboard(testSubName); - }) - .catch(common.handleError(this)); - }); + bdd.it('should save and load dashboard', function saveAndLoadDashboard() { + var testSubName = 'Dashboard Test 1'; + // TODO: save time on the dashboard and test it + return dashboardPage.saveDashboard(testSubName) + // click New Dashboard just to clear the one we just created + .then(function () { + return dashboardPage.clickNewDashboard(); + }) + .then(function () { + return dashboardPage.loadSavedDashboard(testSubName); + }) + .catch(common.handleError(this)); + }); - bdd.it('should have all the expected visualizations', function checkVisualizations() { - return common.tryForTime(10000, function () { - return dashboardPage.getPanelTitles() - .then(function (panelTitles) { - common.log('visualization titles = ' + panelTitles); - expect(panelTitles).to.eql(visualizations); - }); - }) - .catch(common.handleError(this)); + bdd.it('should have all the expected visualizations', function checkVisualizations() { + return common.tryForTime(10000, function () { + return dashboardPage.getPanelTitles() + .then(function (panelTitles) { + 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() { - var visObjects = [ { dataCol: '1', dataRow: '1', dataSizeX: '3', dataSizeY: '2', title: 'Visualization漢字 AreaChart' }, - { dataCol: '4', dataRow: '1', dataSizeX: '3', dataSizeY: '2', title: 'Visualization☺漢字 DataTable' }, - { dataCol: '7', dataRow: '1', dataSizeX: '3', dataSizeY: '2', title: 'Visualization漢字 LineChart' }, - { dataCol: '10', dataRow: '1', dataSizeX: '3', dataSizeY: '2', title: 'Visualization PieChart' }, - { dataCol: '1', dataRow: '3', dataSizeX: '3', dataSizeY: '2', title: 'Visualization TileMap' }, - { dataCol: '4', dataRow: '3', dataSizeX: '3', dataSizeY: '2', title: 'Visualization☺ VerticalBarChart' }, - { dataCol: '7', dataRow: '3', dataSizeX: '3', dataSizeY: '2', title: 'Visualization MetricChart' } - ]; - return common.tryForTime(10000, function () { - return dashboardPage.getPanelData() - .then(function (panelTitles) { - common.log('visualization titles = ' + panelTitles); - expect(panelTitles).to.eql(visObjects); - }); - }) - .catch(common.handleError(this)); + bdd.it('should have all the expected initial sizes', function checkVisualizationSizes() { + var visObjects = [ { dataCol: '1', dataRow: '1', dataSizeX: '3', dataSizeY: '2', title: 'Visualization漢字 AreaChart' }, + { dataCol: '4', dataRow: '1', dataSizeX: '3', dataSizeY: '2', title: 'Visualization☺漢字 DataTable' }, + { dataCol: '7', dataRow: '1', dataSizeX: '3', dataSizeY: '2', title: 'Visualization漢字 LineChart' }, + { dataCol: '10', dataRow: '1', dataSizeX: '3', dataSizeY: '2', title: 'Visualization PieChart' }, + { dataCol: '1', dataRow: '3', dataSizeX: '3', dataSizeY: '2', title: 'Visualization TileMap' }, + { dataCol: '4', dataRow: '3', dataSizeX: '3', dataSizeY: '2', title: 'Visualization☺ VerticalBarChart' }, + { dataCol: '7', dataRow: '3', dataSizeX: '3', dataSizeY: '2', title: 'Visualization MetricChart' } + ]; + return common.tryForTime(10000, function () { + return dashboardPage.getPanelData() + .then(function (panelTitles) { + common.log('visualization titles = ' + panelTitles); + expect(panelTitles).to.eql(visObjects); }); - - }); - + }) + .catch(common.handleError(this)); }); - }()); -}()); + }); +}); diff --git a/test/functional/apps/dashboard/index.js b/test/functional/apps/dashboard/index.js index 813e03d6698204..1c3ccd9109a416 100644 --- a/test/functional/apps/dashboard/index.js +++ b/test/functional/apps/dashboard/index.js @@ -1,13 +1,11 @@ import { bdd, remote, scenarioManager, defaultTimeout } from '../../../support'; -(function () { - bdd.describe('dashboard app', function () { - this.timeout = defaultTimeout; +bdd.describe('dashboard app', function () { + this.timeout = defaultTimeout; - bdd.before(function () { - return remote.setWindowSize(1200,800); - }); - - require('./_dashboard'); + bdd.before(function () { + return remote.setWindowSize(1200,800); }); -}()); + + require('./_dashboard'); +}); diff --git a/test/functional/apps/discover/_collapse_expand.js b/test/functional/apps/discover/_collapse_expand.js index 864b308cddeeb8..a668b9f82f8e93 100644 --- a/test/functional/apps/discover/_collapse_expand.js +++ b/test/functional/apps/discover/_collapse_expand.js @@ -9,77 +9,68 @@ import { elasticDump } from '../../../support'; -(function () { - var expect = require('expect.js'); +var expect = require('expect.js'); - (function () { - bdd.describe('discover tab', function describeIndexTests() { +bdd.describe('discover tab', function describeIndexTests() { + bdd.before(function () { + var fromTime = '2015-09-19 06:31:44.000'; + var toTime = '2015-09-23 18:31:44.000'; - bdd.before(function () { + // delete .kibana index and update configDoc + return esClient.deleteAndUpdateConfigDoc({'dateFormat:tz':'UTC', 'defaultIndex':'logstash-*'}) + .then(function loadkibanaIndexPattern() { + common.debug('load kibana index with default index pattern'); + return elasticDump.elasticLoad('visualize','.kibana'); + }) + // and load a set of makelogs data + .then(function loadIfEmptyMakelogs() { + return scenarioManager.loadIfEmpty('logstashFunctional'); + }) + .then(function () { + common.debug('discover'); + return common.navigateToApp('discover'); + }) + .then(function () { + common.debug('setAbsoluteRange'); + return headerPage.setAbsoluteRange(fromTime, toTime); + }) + .catch(common.handleError(this)); + }); - var fromTime = '2015-09-19 06:31:44.000'; - var toTime = '2015-09-23 18:31:44.000'; + bdd.describe('field data', function () { + bdd.it('should initially be expanded', function () { + return discoverPage.getSidebarWidth() + .then(function (width) { + common.debug('expanded sidebar width = ' + width); + expect(width > 180).to.be(true); + }) + .catch(common.handleError(this)); + }); - // delete .kibana index and update configDoc - return esClient.deleteAndUpdateConfigDoc({'dateFormat:tz':'UTC', 'defaultIndex':'logstash-*'}) - .then(function loadkibanaIndexPattern() { - common.debug('load kibana index with default index pattern'); - return elasticDump.elasticLoad('visualize','.kibana'); + bdd.it('should collapse when clicked', function () { + return discoverPage.toggleSidebarCollapse() + .then(function () { + common.debug('discoverPage.getSidebarWidth()'); + return discoverPage.getSidebarWidth(); }) - // and load a set of makelogs data - .then(function loadIfEmptyMakelogs() { - return scenarioManager.loadIfEmpty('logstashFunctional'); + .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 () { + return discoverPage.toggleSidebarCollapse() .then(function () { - common.debug('discover'); - return common.navigateToApp('discover'); + common.debug('discoverPage.getSidebarWidth()'); + return discoverPage.getSidebarWidth(); }) - .then(function () { - common.debug('setAbsoluteRange'); - return headerPage.setAbsoluteRange(fromTime, toTime); + .then(function (width) { + common.debug('expanded sidebar width = ' + width); + expect(width > 180).to.be(true); }) .catch(common.handleError(this)); - }); - - bdd.describe('field data', function () { - - bdd.it('should initially be expanded', function () { - return discoverPage.getSidebarWidth() - .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 () { - return discoverPage.toggleSidebarCollapse() - .then(function () { - common.debug('discoverPage.getSidebarWidth()'); - return discoverPage.getSidebarWidth(); - }) - .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 () { - return discoverPage.toggleSidebarCollapse() - .then(function () { - common.debug('discoverPage.getSidebarWidth()'); - return discoverPage.getSidebarWidth(); - }) - .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 9227e041421487..9e9136d7c832cb 100644 --- a/test/functional/apps/discover/_discover.js +++ b/test/functional/apps/discover/_discover.js @@ -9,354 +9,349 @@ import { elasticDump } from '../../../support'; -(function () { - var expect = require('expect.js'); - - (function () { - bdd.describe('discover app', function describeIndexTests() { - bdd.before(function () { - var fromTime = '2015-09-19 06:31:44.000'; - var toTime = '2015-09-23 18:31:44.000'; - - // delete .kibana index and update configDoc - return esClient.deleteAndUpdateConfigDoc({'dateFormat:tz':'UTC', 'defaultIndex':'logstash-*'}) - .then(function loadkibanaIndexPattern() { - common.debug('load kibana index with default index pattern'); - return elasticDump.elasticLoad('visualize','.kibana'); - }) - // and load a set of makelogs data - .then(function loadIfEmptyMakelogs() { - return scenarioManager.loadIfEmpty('logstashFunctional'); - }) - .then(function () { - common.debug('discover'); - return common.navigateToApp('discover'); - }) - .then(function () { - common.debug('setAbsoluteRange'); - return headerPage.setAbsoluteRange(fromTime, toTime); - }) - .catch(common.handleError(this)); - }); +var expect = require('expect.js'); + +bdd.describe('discover app', function describeIndexTests() { + bdd.before(function () { + var fromTime = '2015-09-19 06:31:44.000'; + var toTime = '2015-09-23 18:31:44.000'; + + // delete .kibana index and update configDoc + return esClient.deleteAndUpdateConfigDoc({'dateFormat:tz':'UTC', 'defaultIndex':'logstash-*'}) + .then(function loadkibanaIndexPattern() { + common.debug('load kibana index with default index pattern'); + return elasticDump.elasticLoad('visualize','.kibana'); + }) + // and load a set of makelogs data + .then(function loadIfEmptyMakelogs() { + return scenarioManager.loadIfEmpty('logstashFunctional'); + }) + .then(function () { + common.debug('discover'); + return common.navigateToApp('discover'); + }) + .then(function () { + common.debug('setAbsoluteRange'); + return headerPage.setAbsoluteRange(fromTime, toTime); + }) + .catch(common.handleError(this)); + }); + + + bdd.describe('query', function () { + var queryName1 = 'Query # 1'; + var fromTimeString = 'September 19th 2015, 06:31:44.000'; + var toTimeString = 'September 23rd 2015, 18:31:44.000'; + + bdd.it('should show correct time range string by timepicker', function () { + var expectedTimeRangeString = fromTimeString + ' to ' + toTimeString; + return discoverPage.getTimespanText() + .then(function (actualTimeString) { + expect(actualTimeString).to.be(expectedTimeRangeString); + }) + .catch(common.handleError(this)); + }); - bdd.describe('query', function () { - var queryName1 = 'Query # 1'; - var fromTimeString = 'September 19th 2015, 06:31:44.000'; - var toTimeString = 'September 23rd 2015, 18:31:44.000'; + bdd.it('save query should show toast message and display query name', function () { + var expectedSavedQueryMessage = 'Discover: Saved Data Source "' + queryName1 + '"'; + return discoverPage.saveSearch(queryName1) + .then(function () { + return headerPage.getToastMessage(); + }) + .then(function (toastMessage) { + expect(toastMessage).to.be(expectedSavedQueryMessage); + }) + .then(function () { + return headerPage.waitForToastMessageGone(); + }) + .then(function () { + return discoverPage.getCurrentQueryName(); + }) + .then(function (actualQueryNameString) { + expect(actualQueryNameString).to.be(queryName1); + }) + .catch(common.handleError(this)); + }); - bdd.it('should show correct time range string by timepicker', function () { - var expectedTimeRangeString = fromTimeString + ' to ' + toTimeString; - return discoverPage.getTimespanText() - .then(function (actualTimeString) { - expect(actualTimeString).to.be(expectedTimeRangeString); - }) - .catch(common.handleError(this)); + bdd.it('load query should show query name', function () { + return discoverPage.loadSavedSearch(queryName1) + .then(function () { + return common.sleep(3000); + }) + .then(function () { + return discoverPage.getCurrentQueryName(); + }) + .then(function (actualQueryNameString) { + expect(actualQueryNameString).to.be(queryName1); + }) + .catch(common.handleError(this)); + }); + + bdd.it('should show the correct hit count', function () { + var expectedHitCount = '14,004'; + return common.try(function tryingForTime() { + return discoverPage.getHitCount() + .then(function compareData(hitCount) { + expect(hitCount).to.be(expectedHitCount); }); + }) + .catch(common.handleError(this)); + }); + bdd.it('should show the correct bar chart', function () { + var expectedBarChartData = [ '3.237', + '17.674', '64.75', '125.737', '119.962', '65.712', '16.449', + '2.712', '3.675', '17.674', '59.762', '119.087', '123.812', + '61.862', '15.487', '2.362', '2.800', '15.312', '61.862', '123.2', + '118.562', '63.524', '17.587', '2.537' + ]; + return common.sleep(4000) + .then(function () { + return verifyChartData(expectedBarChartData); + }) + .catch(common.handleError(this)); + }); - bdd.it('save query should show toast message and display query name', function () { - var expectedSavedQueryMessage = 'Discover: Saved Data Source "' + queryName1 + '"'; - return discoverPage.saveSearch(queryName1) - .then(function () { - return headerPage.getToastMessage(); - }) - .then(function (toastMessage) { - expect(toastMessage).to.be(expectedSavedQueryMessage); - }) - .then(function () { - return headerPage.waitForToastMessageGone(); - }) - .then(function () { - return discoverPage.getCurrentQueryName(); - }) - .then(function (actualQueryNameString) { - expect(actualQueryNameString).to.be(queryName1); - }) - .catch(common.handleError(this)); - }); + bdd.it('should show correct time range string in chart', function () { + var expectedTimeRangeString = fromTimeString + ' - ' + toTimeString; + return discoverPage.getChartTimespan() + .then(function (actualTimeString) { + expect(actualTimeString).to.be(expectedTimeRangeString); + }) + .catch(common.handleError(this)); + }); - bdd.it('load query should show query name', function () { - return discoverPage.loadSavedSearch(queryName1) - .then(function () { - return common.sleep(3000); - }) - .then(function () { - return discoverPage.getCurrentQueryName(); - }) - .then(function (actualQueryNameString) { - expect(actualQueryNameString).to.be(queryName1); - }) - .catch(common.handleError(this)); - }); + bdd.it('should show correct initial chart interval of 3 hours', function () { + var expectedChartInterval = 'by 3 hours'; + return discoverPage.getChartInterval() + .then(function (actualInterval) { + expect(actualInterval).to.be(expectedChartInterval); + }) + .catch(common.handleError(this)); + }); - bdd.it('should show the correct hit count', function () { - var expectedHitCount = '14,004'; - return common.try(function tryingForTime() { - return discoverPage.getHitCount() - .then(function compareData(hitCount) { - expect(hitCount).to.be(expectedHitCount); - }); - }) - .catch(common.handleError(this)); - }); + bdd.it('should show correct data for chart interval Hourly', function () { + var chartInterval = 'Hourly'; + var expectedBarChartData = [ '1.527', '2.290', + '5.599', '7.890', '13.236', '30.290', '46.072', '55.490', '86.8', + '112', '122.181', '131.6', '132.872', '113.527', '102.581', + '81.709', '65.672', '43.781', '24.181', '14', '9.672', '6.109', + '0.763', '1.018', '2.800', '3.563', '4.327', '9.672', '12.472', + '29.272', '38.690', '54.981', '80.181', '102.327', '113.527', + '130.581', '132.363', '120.654', '107.163', '78.145', '58.545', + '43.272', '25.199', '12.218', '7.636', '3.818', '2.545', '0.509', + '2.036', '1.781', '4.327', '8.654', '9.418', '26.472', '38.945', + '61.345', '79.672', '102.836', '125.236', '130.327', '128.036', + '120.4', '96.472', '74.581', '70.509', '39.709', '25.199', '13.490', + '12.472', '4.072', '2.290', '1.018' + ]; + return discoverPage.setChartInterval(chartInterval) + .then(function () { + return common.sleep(4000); + }) + .then(function () { + return verifyChartData(expectedBarChartData); + }) + .catch(common.handleError(this)); + }); - bdd.it('should show the correct bar chart', function () { - var expectedBarChartData = [ '3.237', - '17.674', '64.75', '125.737', '119.962', '65.712', '16.449', - '2.712', '3.675', '17.674', '59.762', '119.087', '123.812', - '61.862', '15.487', '2.362', '2.800', '15.312', '61.862', '123.2', - '118.562', '63.524', '17.587', '2.537' - ]; - return common.sleep(4000) - .then(function () { - return verifyChartData(expectedBarChartData); - }) - .catch(common.handleError(this)); - }); + bdd.it('should show correct data for chart interval Daily', function () { + var chartInterval = 'Daily'; + var expectedBarChartData = [ + '133.196', '129.192', '129.724' + ]; + return discoverPage.setChartInterval(chartInterval) + .then(function () { + return common.sleep(4000); + }) + .then(function () { + return verifyChartData(expectedBarChartData); + }) + .catch(common.handleError(this)); + }); - bdd.it('should show correct time range string in chart', function () { - var expectedTimeRangeString = fromTimeString + ' - ' + toTimeString; - return discoverPage.getChartTimespan() - .then(function (actualTimeString) { - expect(actualTimeString).to.be(expectedTimeRangeString); - }) - .catch(common.handleError(this)); - }); + bdd.it('should show correct data for chart interval Weekly', function () { + var chartInterval = 'Weekly'; + var expectedBarChartData = [ '66.598', '129.458']; + return discoverPage.setChartInterval(chartInterval) + .then(function () { + return common.sleep(2000); + }) + .then(function () { + return verifyChartData(expectedBarChartData); + }) + .catch(common.handleError(this)); + }); - bdd.it('should show correct initial chart interval of 3 hours', function () { - var expectedChartInterval = 'by 3 hours'; + bdd.it('browser back button should show previous interval Daily', function () { + var expectedChartInterval = 'Daily'; + var expectedBarChartData = [ + '133.196', '129.192', '129.724' + ]; + return this.remote.goBack() + .then(function () { + return common.try(function tryingForTime() { 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 () { - var chartInterval = 'Hourly'; - var expectedBarChartData = [ '1.527', '2.290', - '5.599', '7.890', '13.236', '30.290', '46.072', '55.490', '86.8', - '112', '122.181', '131.6', '132.872', '113.527', '102.581', - '81.709', '65.672', '43.781', '24.181', '14', '9.672', '6.109', - '0.763', '1.018', '2.800', '3.563', '4.327', '9.672', '12.472', - '29.272', '38.690', '54.981', '80.181', '102.327', '113.527', - '130.581', '132.363', '120.654', '107.163', '78.145', '58.545', - '43.272', '25.199', '12.218', '7.636', '3.818', '2.545', '0.509', - '2.036', '1.781', '4.327', '8.654', '9.418', '26.472', '38.945', - '61.345', '79.672', '102.836', '125.236', '130.327', '128.036', - '120.4', '96.472', '74.581', '70.509', '39.709', '25.199', '13.490', - '12.472', '4.072', '2.290', '1.018' - ]; - return discoverPage.setChartInterval(chartInterval) - .then(function () { - return common.sleep(4000); - }) - .then(function () { - return verifyChartData(expectedBarChartData); - }) - .catch(common.handleError(this)); - }); - - bdd.it('should show correct data for chart interval Daily', function () { - var chartInterval = 'Daily'; - var expectedBarChartData = [ - '133.196', '129.192', '129.724' - ]; - return discoverPage.setChartInterval(chartInterval) - .then(function () { - return common.sleep(4000); - }) - .then(function () { - return verifyChartData(expectedBarChartData); - }) - .catch(common.handleError(this)); - }); - - bdd.it('should show correct data for chart interval Weekly', function () { - var chartInterval = 'Weekly'; - var expectedBarChartData = [ '66.598', '129.458']; - return discoverPage.setChartInterval(chartInterval) - .then(function () { - return common.sleep(2000); - }) - .then(function () { - return verifyChartData(expectedBarChartData); - }) - .catch(common.handleError(this)); + }); }); + }) + .then(function () { + return verifyChartData(expectedBarChartData); + }) + .catch(common.handleError(this)); + }); - bdd.it('browser back button should show previous interval Daily', function () { - var expectedChartInterval = 'Daily'; - var expectedBarChartData = [ - '133.196', '129.192', '129.724' - ]; - return this.remote.goBack() - .then(function () { - return common.try(function tryingForTime() { - return discoverPage.getChartInterval() - .then(function (actualInterval) { - expect(actualInterval).to.be(expectedChartInterval); - }); - }); - }) - .then(function () { - return verifyChartData(expectedBarChartData); - }) - .catch(common.handleError(this)); - }); + bdd.it('should show correct data for chart interval Monthly', function () { + var chartInterval = 'Monthly'; + var expectedBarChartData = [ '122.535']; + return discoverPage.setChartInterval(chartInterval) + .then(function () { + return common.sleep(2000); + }) + .then(function () { + return verifyChartData(expectedBarChartData); + }) + .catch(common.handleError(this)); + }); - bdd.it('should show correct data for chart interval Monthly', function () { - var chartInterval = 'Monthly'; - var expectedBarChartData = [ '122.535']; - return discoverPage.setChartInterval(chartInterval) - .then(function () { - return common.sleep(2000); - }) - .then(function () { - return verifyChartData(expectedBarChartData); - }) - .catch(common.handleError(this)); - }); + bdd.it('should show correct data for chart interval Yearly', function () { + var chartInterval = 'Yearly'; + var expectedBarChartData = [ '122.535']; + return discoverPage.setChartInterval(chartInterval) + .then(function () { + return common.sleep(2000); + }) + .then(function () { + return verifyChartData(expectedBarChartData); + }) + .catch(common.handleError(this)); + }); - bdd.it('should show correct data for chart interval Yearly', function () { - var chartInterval = 'Yearly'; - var expectedBarChartData = [ '122.535']; - return discoverPage.setChartInterval(chartInterval) - .then(function () { - return common.sleep(2000); - }) - .then(function () { - return verifyChartData(expectedBarChartData); - }) - .catch(common.handleError(this)); - }); + bdd.it('should show correct data for chart interval Auto', function () { + var chartInterval = 'Auto'; + var expectedBarChartData = [ '3.237', + '17.674', '64.75', '125.737', '119.962', '65.712', '16.449', + '2.712', '3.675', '17.674', '59.762', '119.087', '123.812', + '61.862', '15.487', '2.362', '2.800', '15.312', '61.862', '123.2', + '118.562', '63.524', '17.587', '2.537' + ]; + return discoverPage.setChartInterval(chartInterval) + .then(function () { + return common.sleep(4000); + }) + .then(function () { + return verifyChartData(expectedBarChartData); + }) + .catch(common.handleError(this)); + }); - bdd.it('should show correct data for chart interval Auto', function () { - var chartInterval = 'Auto'; - var expectedBarChartData = [ '3.237', - '17.674', '64.75', '125.737', '119.962', '65.712', '16.449', - '2.712', '3.675', '17.674', '59.762', '119.087', '123.812', - '61.862', '15.487', '2.362', '2.800', '15.312', '61.862', '123.2', - '118.562', '63.524', '17.587', '2.537' - ]; - return discoverPage.setChartInterval(chartInterval) - .then(function () { - return common.sleep(4000); - }) - .then(function () { - return verifyChartData(expectedBarChartData); - }) - .catch(common.handleError(this)); - }); + bdd.it('should show Auto chart interval of 3 hours', function () { + var expectedChartInterval = 'by 3 hours'; + return discoverPage.getChartInterval() + .then(function (actualInterval) { + expect(actualInterval).to.be(expectedChartInterval); + }) + .catch(common.handleError(this)); + }); - bdd.it('should show Auto chart interval of 3 hours', function () { - var expectedChartInterval = 'by 3 hours'; - 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)); + }); - bdd.it('should not show "no results"', () => { - return discoverPage.hasNoResults().then(visible => { - expect(visible).to.be(false); - }) - .catch(common.handleError(this)); + function verifyChartData(expectedBarChartData) { + return common.try(function tryingForTime() { + return discoverPage.getBarChartData() + .then(function compareData(paths) { + // the largest bars are over 100 pixels high so this is less than 1% tolerance + var barHeightTolerance = 1; + var stringResults = ''; + var hasFailure = false; + for (var y = 0; y < expectedBarChartData.length; y++) { + stringResults += y + ': expected = ' + expectedBarChartData[y] + ', actual = ' + paths[y] + + ', Pass = ' + (Math.abs(expectedBarChartData[y] - paths[y]) < barHeightTolerance) + '\n'; + if ((Math.abs(expectedBarChartData[y] - paths[y]) > barHeightTolerance)) { + hasFailure = true; + }; + }; + if (hasFailure) { + common.log(stringResults); + common.log(paths); + } + for (var x = 0; x < expectedBarChartData.length; x++) { + expect(Math.abs(expectedBarChartData[x] - paths[x]) < barHeightTolerance).to.be.ok(); + } }); + }); - function verifyChartData(expectedBarChartData) { - return common.try(function tryingForTime() { - return discoverPage.getBarChartData() - .then(function compareData(paths) { - // the largest bars are over 100 pixels high so this is less than 1% tolerance - var barHeightTolerance = 1; - var stringResults = ''; - var hasFailure = false; - for (var y = 0; y < expectedBarChartData.length; y++) { - stringResults += y + ': expected = ' + expectedBarChartData[y] + ', actual = ' + paths[y] + - ', Pass = ' + (Math.abs(expectedBarChartData[y] - paths[y]) < barHeightTolerance) + '\n'; - if ((Math.abs(expectedBarChartData[y] - paths[y]) > barHeightTolerance)) { - hasFailure = true; - }; - }; - if (hasFailure) { - common.log(stringResults); - common.log(paths); - } - for (var x = 0; x < expectedBarChartData.length; x++) { - expect(Math.abs(expectedBarChartData[x] - paths[x]) < barHeightTolerance).to.be.ok(); - } - }); - }); - - } + } - }); + }); - bdd.describe('query #2, which has an empty time range', function () { - var fromTime = '1999-06-11 09:22:11.000'; - var toTime = '1999-06-12 11:21:04.000'; + bdd.describe('query #2, which has an empty time range', function () { + var fromTime = '1999-06-11 09:22:11.000'; + var toTime = '1999-06-12 11:21:04.000'; - bdd.before(() => { - common.debug('setAbsoluteRangeForAnotherQuery'); - return headerPage - .setAbsoluteRange(fromTime, toTime) - .catch(common.handleError(this)); - }); + bdd.before(() => { + common.debug('setAbsoluteRangeForAnotherQuery'); + return headerPage + .setAbsoluteRange(fromTime, toTime) + .catch(common.handleError(this)); + }); - bdd.it('should show "no results"', () => { - return discoverPage.hasNoResults().then(visible => { - expect(visible).to.be(true); - }) - .catch(common.handleError(this)); - }); + 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 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', () => { - let i = 0; - - return closeTimepicker() // close - .then(() => isTimepickerOpen(false) - .then(el => el.click()) // open - .then(() => isTimepickerOpen(true)) - .then(el => el.click()) // close - .then(() => isTimepickerOpen(false)) - .catch(common.handleError(this)) - ); - - function closeTimepicker() { - return headerPage.isTimepickerOpen().then(shown => { - if (!shown) { - return; - } - return discoverPage - .getNoResultsTimepicker() - .click(); // close - }); + bdd.it('should open and close the time picker', () => { + let i = 0; + + return closeTimepicker() // close + .then(() => isTimepickerOpen(false) + .then(el => el.click()) // open + .then(() => isTimepickerOpen(true)) + .then(el => el.click()) // close + .then(() => isTimepickerOpen(false)) + .catch(common.handleError(this)) + ); + + function closeTimepicker() { + return headerPage.isTimepickerOpen().then(shown => { + if (!shown) { + return; } - - function isTimepickerOpen(expected) { - return headerPage.isTimepickerOpen().then(shown => { - common.debug(`expect (#${++i}) timepicker to be ${peek(expected)} (is ${peek(shown)}).`); - expect(shown).to.be(expected); - return discoverPage.getNoResultsTimepicker(); - function peek(state) { - return state ? 'open' : 'closed'; - } - }); + return discoverPage + .getNoResultsTimepicker() + .click(); // close + }); + } + + function isTimepickerOpen(expected) { + return headerPage.isTimepickerOpen().then(shown => { + common.debug(`expect (#${++i}) timepicker to be ${peek(expected)} (is ${peek(shown)}).`); + expect(shown).to.be(expected); + return discoverPage.getNoResultsTimepicker(); + function peek(state) { + return state ? 'open' : 'closed'; } }); - }); - + } }); - }()); -}()); + }); +}); diff --git a/test/functional/apps/discover/_field_data.js b/test/functional/apps/discover/_field_data.js index 9dd8993d6daa41..6652021d0b31d0 100644 --- a/test/functional/apps/discover/_field_data.js +++ b/test/functional/apps/discover/_field_data.js @@ -9,253 +9,247 @@ import { elasticDump } from '../../../support'; -(function () { - var expect = require('expect.js'); - - (function () { - bdd.describe('discover app', function describeIndexTests() { - bdd.before(function () { - var fromTime = '2015-09-19 06:31:44.000'; - var toTime = '2015-09-23 18:31:44.000'; - - // delete .kibana index and update configDoc - return esClient.deleteAndUpdateConfigDoc({'dateFormat:tz':'UTC', 'defaultIndex':'logstash-*'}) - .then(function loadkibanaIndexPattern() { - common.debug('load kibana index with default index pattern'); - return elasticDump.elasticLoad('visualize','.kibana'); - }) - // and load a set of makelogs data - .then(function loadIfEmptyMakelogs() { - return scenarioManager.loadIfEmpty('logstashFunctional'); - }) - .then(function () { - common.debug('discover'); - return common.navigateToApp('discover'); - }) - .then(function () { - common.debug('setAbsoluteRange'); - return headerPage.setAbsoluteRange(fromTime, toTime); - }) - .catch(common.handleError(this)); - }); - - - bdd.describe('field data', function () { - var queryName1 = 'Query # 1'; - var fromTimeString = 'September 19th 2015, 06:31:44.000'; - var toTimeString = 'September 23rd 2015, 18:31:44.000'; - - bdd.it('search php should show the correct hit count', function () { - var expectedHitCount = '445'; - return discoverPage.query('php') - .then(function () { - return common.try(function tryingForTime() { - return discoverPage.getHitCount() - .then(function compareData(hitCount) { - expect(hitCount).to.be(expectedHitCount); - }); - }); - }) - .catch(common.handleError(this)); +var expect = require('expect.js'); + +bdd.describe('discover app', function describeIndexTests() { + bdd.before(function () { + var fromTime = '2015-09-19 06:31:44.000'; + var toTime = '2015-09-23 18:31:44.000'; + + // delete .kibana index and update configDoc + return esClient.deleteAndUpdateConfigDoc({'dateFormat:tz':'UTC', 'defaultIndex':'logstash-*'}) + .then(function loadkibanaIndexPattern() { + common.debug('load kibana index with default index pattern'); + return elasticDump.elasticLoad('visualize','.kibana'); + }) + // and load a set of makelogs data + .then(function loadIfEmptyMakelogs() { + return scenarioManager.loadIfEmpty('logstashFunctional'); + }) + .then(function () { + common.debug('discover'); + return common.navigateToApp('discover'); + }) + .then(function () { + common.debug('setAbsoluteRange'); + return headerPage.setAbsoluteRange(fromTime, toTime); + }) + .catch(common.handleError(this)); + }); + + + bdd.describe('field data', function () { + var queryName1 = 'Query # 1'; + var fromTimeString = 'September 19th 2015, 06:31:44.000'; + var toTimeString = 'September 23rd 2015, 18:31:44.000'; + + bdd.it('search php should show the correct hit count', function () { + var expectedHitCount = '445'; + return discoverPage.query('php') + .then(function () { + return common.try(function tryingForTime() { + return discoverPage.getHitCount() + .then(function compareData(hitCount) { + expect(hitCount).to.be(expectedHitCount); + }); }); + }) + .catch(common.handleError(this)); + }); - bdd.it('the search term should be highlighted in the field data', function () { - // marks is the style that highlights the text in yellow - return discoverPage.getMarks() - .then(function (marks) { - expect(marks.length).to.be(50); - expect(marks.indexOf('php')).to.be(0); - }) - .catch(common.handleError(this)); - }); + bdd.it('the search term should be highlighted in the field data', function () { + // marks is the style that highlights the text in yellow + return discoverPage.getMarks() + .then(function (marks) { + expect(marks.length).to.be(50); + expect(marks.indexOf('php')).to.be(0); + }) + .catch(common.handleError(this)); + }); - bdd.it('search _type:apache should show the correct hit count', function () { - var expectedHitCount = '11,156'; - return discoverPage.query('_type:apache') - .then(function () { - return common.try(function tryingForTime() { - return discoverPage.getHitCount() - .then(function compareData(hitCount) { - expect(hitCount).to.be(expectedHitCount); - }); - }); - }) - .catch(common.handleError(this)); + bdd.it('search _type:apache should show the correct hit count', function () { + var expectedHitCount = '11,156'; + return discoverPage.query('_type:apache') + .then(function () { + return common.try(function tryingForTime() { + return discoverPage.getHitCount() + .then(function compareData(hitCount) { + expect(hitCount).to.be(expectedHitCount); + }); }); + }) + .catch(common.handleError(this)); + }); - bdd.it('doc view should show Time and _source columns', function () { - var expectedHeader = 'Time _source'; - return discoverPage.getDocHeader() - .then(function (header) { - expect(header).to.be(expectedHeader); - }) - .catch(common.handleError(this)); - }); + bdd.it('doc view should show Time and _source columns', function () { + var expectedHeader = 'Time _source'; + 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 () { + // Note: Could just check the timestamp, but might as well check that the whole doc is as expected. + var ExpectedDoc = + 'September 22nd 2015, 23:50:13.253 index:logstash-2015.09.22 @timestamp:September 22nd 2015, 23:50:13.253' + + ' ip:238.171.34.42 extension:jpg response:200 geo.coordinates:{ "lat": 38.66494528, "lon": -88.45299556' + + ' } geo.src:FR geo.dest:KH geo.srcdest:FR:KH @tags:success, info utc_time:September 22nd 2015,' + + ' 23:50:13.253 referer:http://twitter.com/success/nancy-currie agent:Mozilla/4.0 (compatible; MSIE 6.0;' + + ' Windows NT 5.1; SV1; .NET CLR 1.1.4322) clientip:238.171.34.42 bytes:7,124' + + ' host:media-for-the-masses.theacademyofperformingartsandscience.org request:/uploads/karl-henize.jpg' + + ' url:https://media-for-the-masses.theacademyofperformingartsandscience.org/uploads/karl-henize.jpg' + + ' @message:238.171.34.42 - - [2015-09-22T23:50:13.253Z] "GET /uploads/karl-henize.jpg HTTP/1.1" 200 7124' + + ' "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)" spaces:this is a' + + ' thing with lots of spaces wwwwoooooo xss:' + + ' headings:

alexander-viktorenko

, http://nytimes.com/warning/michael-massimino' + + ' links:@www.slate.com, http://www.slate.com/security/frederick-w-leslie, www.www.slate.com' + + ' relatedContent:{ "url": "http://www.laweekly.com/music/bjork-at-the-nokia-theatre-12-12-2408191",' + + ' "og:type": "article", "og:title": "Bjork at the Nokia Theatre, 12/12", "og:description": "Bjork at the' + + ' Nokia Theater, December 12 By Randall Roberts Last night’s Bjork show at the Dystopia –' + + ' er, I mean Nokia -- Theatre downtown di...", "og:url": "' + + 'http://www.laweekly.com/music/bjork-at-the-nokia-theatre-12-12-2408191", "article:published_time":' + + ' "2007-12-13T12:19:35-08:00", "article:modified_time": "2014-11-27T08:28:42-08:00", "article:section":' + + ' "Music", "og:image": "' + + 'http://IMAGES1.laweekly.com/imager/bjork-at-the-nokia-theatre-12-12/u/original/2470701/bjorktn003.jpg",' + + ' "og:image:height": "334", "og:image:width": "480", "og:site_name": "LA Weekly", "twitter:title":' + + ' "Bjork at the Nokia Theatre, 12/12", "twitter:description": "Bjork at the Nokia Theater, December 12' + + ' By Randall Roberts Last night’s Bjork show at the Dystopia – er, I mean Nokia -- Theatre' + + ' downtown di...", "twitter:card": "summary", "twitter:image": "' + + 'http://IMAGES1.laweekly.com/imager/bjork-at-the-nokia-theatre-12-12/u/original/2470701/bjorktn003.jpg",' + + ' "twitter:site": "@laweekly" }, { "url": "' + + 'http://www.laweekly.com/music/the-rapture-at-the-mayan-7-25-2401011", "og:type": "article", "og:title":' + + ' "The Rapture at the Mayan, 7/25", "og:description": "If you haven’t yet experienced the' + + ' phenomenon of people walk-dancing, apparently the best place to witness this is at a Rapture show.' + + ' Here’s...", "og:url": "http://www.laweekly.com/music/the-rapture-at-the-mayan-7-25-2401011",' + + ' "article:published_time": "2007-07-26T12:42:30-07:00", "article:modified_time":' + + ' "2014-11-27T08:00:51-08:00", "article:section": "Music", "og:image": "' + + 'http://IMAGES1.laweekly.com/imager/the-rapture-at-the-mayan-7-25/u/original/2463272/rapturetn05.jpg",' + + ' "og:image:height": "321", "og:image:width": "480", "og:site_name": "LA Weekly", "twitter:title": "The' + + ' Rapture at the Mayan, 7/25", "twitter:description": "If you haven’t yet experienced the' + + ' phenomenon of people walk-dancing, apparently the best place to witness this is at a Rapture show.' + + ' Here’s...", "twitter:card": "summary", "twitter:image": "' + + 'http://IMAGES1.laweekly.com/imager/the-rapture-at-the-mayan-7-25/u/original/2463272/rapturetn05.jpg",' + + ' "twitter:site": "@laweekly" } machine.os:win 7 machine.ram:7,516,192,768 _id:AU_x3_g4GFA8no6QjkYX' + + ' _type:apache _index:logstash-2015.09.22 _score: - relatedContent.article:modified_time:November 27th' + + ' 2014, 16:00:51.000, November 27th 2014, 16:28:42.000 relatedContent.article:published_time:July 26th' + + ' 2007, 19:42:30.000, December 13th 2007, 20:19:35.000'; + return discoverPage.getDocTableIndex(1) + .then(function (rowData) { + expect(rowData).to.be(ExpectedDoc); + }) + .catch(common.handleError(this)); + }); - bdd.it('doc view should show oldest time first', function () { - // Note: Could just check the timestamp, but might as well check that the whole doc is as expected. - var ExpectedDoc = - 'September 22nd 2015, 23:50:13.253 index:logstash-2015.09.22 @timestamp:September 22nd 2015, 23:50:13.253' - + ' ip:238.171.34.42 extension:jpg response:200 geo.coordinates:{ "lat": 38.66494528, "lon": -88.45299556' - + ' } geo.src:FR geo.dest:KH geo.srcdest:FR:KH @tags:success, info utc_time:September 22nd 2015,' - + ' 23:50:13.253 referer:http://twitter.com/success/nancy-currie agent:Mozilla/4.0 (compatible; MSIE 6.0;' - + ' Windows NT 5.1; SV1; .NET CLR 1.1.4322) clientip:238.171.34.42 bytes:7,124' - + ' host:media-for-the-masses.theacademyofperformingartsandscience.org request:/uploads/karl-henize.jpg' - + ' url:https://media-for-the-masses.theacademyofperformingartsandscience.org/uploads/karl-henize.jpg' - + ' @message:238.171.34.42 - - [2015-09-22T23:50:13.253Z] "GET /uploads/karl-henize.jpg HTTP/1.1" 200 7124' - + ' "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)" spaces:this is a' - + ' thing with lots of spaces wwwwoooooo xss:' - + ' headings:

alexander-viktorenko

, http://nytimes.com/warning/michael-massimino' - + ' links:@www.slate.com, http://www.slate.com/security/frederick-w-leslie, www.www.slate.com' - + ' relatedContent:{ "url": "http://www.laweekly.com/music/bjork-at-the-nokia-theatre-12-12-2408191",' - + ' "og:type": "article", "og:title": "Bjork at the Nokia Theatre, 12/12", "og:description": "Bjork at the' - + ' Nokia Theater, December 12 By Randall Roberts Last night’s Bjork show at the Dystopia –' - + ' er, I mean Nokia -- Theatre downtown di...", "og:url": "' - + 'http://www.laweekly.com/music/bjork-at-the-nokia-theatre-12-12-2408191", "article:published_time":' - + ' "2007-12-13T12:19:35-08:00", "article:modified_time": "2014-11-27T08:28:42-08:00", "article:section":' - + ' "Music", "og:image": "' - + 'http://IMAGES1.laweekly.com/imager/bjork-at-the-nokia-theatre-12-12/u/original/2470701/bjorktn003.jpg",' - + ' "og:image:height": "334", "og:image:width": "480", "og:site_name": "LA Weekly", "twitter:title":' - + ' "Bjork at the Nokia Theatre, 12/12", "twitter:description": "Bjork at the Nokia Theater, December 12' - + ' By Randall Roberts Last night’s Bjork show at the Dystopia – er, I mean Nokia -- Theatre' - + ' downtown di...", "twitter:card": "summary", "twitter:image": "' - + 'http://IMAGES1.laweekly.com/imager/bjork-at-the-nokia-theatre-12-12/u/original/2470701/bjorktn003.jpg",' - + ' "twitter:site": "@laweekly" }, { "url": "' - + 'http://www.laweekly.com/music/the-rapture-at-the-mayan-7-25-2401011", "og:type": "article", "og:title":' - + ' "The Rapture at the Mayan, 7/25", "og:description": "If you haven’t yet experienced the' - + ' phenomenon of people walk-dancing, apparently the best place to witness this is at a Rapture show.' - + ' Here’s...", "og:url": "http://www.laweekly.com/music/the-rapture-at-the-mayan-7-25-2401011",' - + ' "article:published_time": "2007-07-26T12:42:30-07:00", "article:modified_time":' - + ' "2014-11-27T08:00:51-08:00", "article:section": "Music", "og:image": "' - + 'http://IMAGES1.laweekly.com/imager/the-rapture-at-the-mayan-7-25/u/original/2463272/rapturetn05.jpg",' - + ' "og:image:height": "321", "og:image:width": "480", "og:site_name": "LA Weekly", "twitter:title": "The' - + ' Rapture at the Mayan, 7/25", "twitter:description": "If you haven’t yet experienced the' - + ' phenomenon of people walk-dancing, apparently the best place to witness this is at a Rapture show.' - + ' Here’s...", "twitter:card": "summary", "twitter:image": "' - + 'http://IMAGES1.laweekly.com/imager/the-rapture-at-the-mayan-7-25/u/original/2463272/rapturetn05.jpg",' - + ' "twitter:site": "@laweekly" } machine.os:win 7 machine.ram:7,516,192,768 _id:AU_x3_g4GFA8no6QjkYX' - + ' _type:apache _index:logstash-2015.09.22 _score: - relatedContent.article:modified_time:November 27th' - + ' 2014, 16:00:51.000, November 27th 2014, 16:28:42.000 relatedContent.article:published_time:July 26th' - + ' 2007, 19:42:30.000, December 13th 2007, 20:19:35.000'; + bdd.it('doc view should sort ascending', function () { + // Note: Could just check the timestamp, but might as well check that the whole doc is as expected. + var ExpectedDoc = + 'September 20th 2015, 00:00:00.000 index:logstash-2015.09.20 @timestamp:September 20th 2015, 00:00:00.000' + + ' ip:143.84.142.7 extension:jpg response:200 geo.coordinates:{ "lat": 38.68407028, "lon": -120.9871642 }' + + ' geo.src:ES geo.dest:US geo.srcdest:ES:US @tags:error, info utc_time:September 20th 2015, 00:00:00.000' + + ' referer:http://www.slate.com/success/vladimir-kovalyonok agent:Mozilla/4.0 (compatible; MSIE 6.0;' + + ' Windows NT 5.1; SV1; .NET CLR 1.1.4322) clientip:143.84.142.7 bytes:1,623' + + ' host:media-for-the-masses.theacademyofperformingartsandscience.org request:/uploads/steven-hawley.jpg' + + ' url:https://media-for-the-masses.theacademyofperformingartsandscience.org/uploads/steven-hawley.jpg' + + ' @message:143.84.142.7 - - [2015-09-20T00:00:00.000Z] "GET /uploads/steven-hawley.jpg HTTP/1.1" 200' + + ' 1623 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)" spaces:this is a' + + ' thing with lots of spaces wwwwoooooo xss:' + + ' headings:

kimiya-yui

, http://www.slate.com/success/koichi-wakata' + + ' links:thomas-marshburn@twitter.com, http://www.slate.com/info/michael-p-anderson, www.twitter.com' + + ' relatedContent:{ "url":' + + ' "http://www.laweekly.com/music/jay-electronica-much-better-than-his-name-would-suggest-2412364",' + + ' "og:type": "article", "og:title": "Jay Electronica: Much Better Than His Name Would Suggest",' + + ' "og:description": "You may not know who Jay Electronica is yet, but I'm willing to bet that you' + + ' would had he chosen a better name. Jay Electronica does not sound like the ...", "og:url":' + + ' "http://www.laweekly.com/music/jay-electronica-much-better-than-his-name-would-suggest-2412364",' + + ' "article:published_time": "2008-04-04T16:00:00-07:00", "article:modified_time":' + + ' "2014-11-27T08:01:03-08:00", "article:section": "Music", "og:site_name": "LA Weekly", "twitter:title":' + + ' "Jay Electronica: Much Better Than His Name Would Suggest", "twitter:description": "You may not know' + + ' who Jay Electronica is yet, but I'm willing to bet that you would had he chosen a better name.' + + ' Jay Electronica does not sound like the ...", "twitter:card": "summary", "twitter:site": "@laweekly"' + + ' }, { "url": "http://www.laweekly.com/news/mandoe-on-gower-near-fountain-2368123", "og:type":' + + ' "article", "og:title": "MANDOE On Gower Near Fountain", "og:description": "MANDOE has a stunner on a' + + ' wall north of an east-west street crossing Gower around Fountain (but not on Fountain). MADNOE, PROSE' + + ' and FUKM are listed on t...", "og:url": "' + + 'http://www.laweekly.com/news/mandoe-on-gower-near-fountain-2368123", "article:published_time":' + + ' "2008-04-25T07:26:41-07:00", "article:modified_time": "2014-10-28T15:00:08-07:00", "article:section":' + + ' "News", "og:image": "' + + 'http://images1.laweekly.com/imager/mandoe-on-gower-near-fountain/u/original/2430891/img_6648.jpg",' + + ' "og:image:height": "640", "og:image:width": "480", "og:site_name": "LA Weekly", "twitter:title": ' + + '"MANDOE On Gower Near Fountain", "twitter:description": "MANDOE has a stunner on a wall north of an' + + ' east-west street crossing Gower around Fountain (but not on Fountain). MADNOE, PROSE and FUKM are' + + ' listed on t...", "twitter:card": "summary", "twitter:image": "' + + 'http://images1.laweekly.com/imager/mandoe-on-gower-near-fountain/u/original/2430891/img_6648.jpg", ' + + '"twitter:site": "@laweekly" }, { "url": "http://www.laweekly.com/arts/meghan-finds-the-love-2373346",' + + ' "og:type": "article", "og:title": "Meghan Finds The Love", "og:description": "LA Weekly is the' + + ' definitive source of information for news, music, movies, restaurants, reviews, and events in Los' + + ' Angeles.", "og:url": "http://www.laweekly.com/arts/meghan-finds-the-love-2373346",' + + ' "article:published_time": "2005-10-20T18:10:25-07:00", "article:modified_time":' + + ' "2014-11-25T19:52:35-08:00", "article:section": "Arts", "og:site_name": "LA Weekly", "twitter:title":' + + ' "Meghan Finds The Love", "twitter:description": "LA Weekly is the definitive source of information for' + + ' news, music, movies, restaurants, reviews, and events in Los Angeles.", "twitter:card": "summary",' + + ' "twitter:site": "@laweekly" }, { "url": "http://www.laweekly.com/arts/these-clowns-are-with-me-2371051' + + '", "og:type": "article", "og:title": "These Clowns Are With Me", "og:description": "    I' + + ' didn't mean to blow off all my responsibilities yesterday, but when a schmoozy Hollywood luncheon' + + ' turns into a full-on party by 3pm, and...", "og:url": "' + + 'http://www.laweekly.com/arts/these-clowns-are-with-me-2371051", "article:published_time": ' + + '"2006-03-04T17:03:42-08:00", "article:modified_time": "2014-11-25T17:05:47-08:00", "article:section":' + + ' "Arts", "og:image": "' + + 'http://images1.laweekly.com/imager/these-clowns-are-with-me/u/original/2434556/e4b8scd.jpg",' + + ' "og:image:height": "375", "og:image:width": "500", "og:site_name": "LA Weekly", "twitter:title":' + + ' "These Clowns Are With Me", "twitter:description": "    I didn't mean to blow off all' + + ' my responsibilities yesterday, but when a schmoozy Hollywood luncheon turns into a full-on party by' + + ' 3pm, and...", "twitter:card": "summary", "twitter:image": "' + + 'http://images1.laweekly.com/imager/these-clowns-are-with-me/u/original/2434556/e4b8scd.jpg",' + + ' "twitter:site": "@laweekly" }, { "url": "http://www.laweekly.com/arts/shopping-daze-2373807",' + + ' "og:type": "article", "og:title": "Shopping Daze", "og:description": "LA Weekly is the definitive ' + + 'source of information for news, music, movies, restaurants, reviews, and events in Los Angeles.",' + + ' "og:url": "http://www.laweekly.com/arts/shopping-daze-2373807", "article:published_time":' + + ' "2006-12-13T12:12:04-08:00", "article:modified_time": "2014-11-25T20:15:21-08:00", "article:section":' + + ' "Arts", "og:site_name": "LA Weekly", "twitter:title": "Shopping Daze", "twitter:description": "LA' + + ' Weekly is the definitive source of information for news, music, movies, restaurants, reviews, and' + + ' events in Los Angeles.", "twitter:card": "summary", "twitter:site": "@laweekly" } machine.os:osx' + + ' machine.ram:15,032,385,536 _id:AU_x3_g3GFA8no6QjkFm _type:apache _index:logstash-2015.09.20 _score: -' + + ' relatedContent.article:modified_time:October 28th 2014, 22:00:08.000, November 26th 2014,' + + ' 01:05:47.000, November 26th 2014, 03:52:35.000, November 26th 2014, 04:15:21.000, November 27th 2014,' + + ' 16:01:03.000 relatedContent.article:published_time:October 21st 2005, 01:10:25.000, March 5th 2006,' + + ' 01:03:42.000, December 13th 2006, 20:12:04.000, April 4th 2008, 23:00:00.000, April 25th 2008,' + + ' 14:26:41.000'; + return discoverPage.clickDocSortDown() + .then(function () { + // we don't technically need this sleep here because the tryForTime will retry and the + // results will match on the 2nd or 3rd attempt, but that debug output is huge in this + // case and it can be avoided with just a few seconds sleep. + return common.sleep(2000); + }) + .then(function () { + return common.try(function tryingForTime() { return discoverPage.getDocTableIndex(1) .then(function (rowData) { expect(rowData).to.be(ExpectedDoc); - }) - .catch(common.handleError(this)); - }); - - bdd.it('doc view should sort ascending', function () { - // Note: Could just check the timestamp, but might as well check that the whole doc is as expected. - var ExpectedDoc = - 'September 20th 2015, 00:00:00.000 index:logstash-2015.09.20 @timestamp:September 20th 2015, 00:00:00.000' - + ' ip:143.84.142.7 extension:jpg response:200 geo.coordinates:{ "lat": 38.68407028, "lon": -120.9871642 }' - + ' geo.src:ES geo.dest:US geo.srcdest:ES:US @tags:error, info utc_time:September 20th 2015, 00:00:00.000' - + ' referer:http://www.slate.com/success/vladimir-kovalyonok agent:Mozilla/4.0 (compatible; MSIE 6.0;' - + ' Windows NT 5.1; SV1; .NET CLR 1.1.4322) clientip:143.84.142.7 bytes:1,623' - + ' host:media-for-the-masses.theacademyofperformingartsandscience.org request:/uploads/steven-hawley.jpg' - + ' url:https://media-for-the-masses.theacademyofperformingartsandscience.org/uploads/steven-hawley.jpg' - + ' @message:143.84.142.7 - - [2015-09-20T00:00:00.000Z] "GET /uploads/steven-hawley.jpg HTTP/1.1" 200' - + ' 1623 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)" spaces:this is a' - + ' thing with lots of spaces wwwwoooooo xss:' - + ' headings:

kimiya-yui

, http://www.slate.com/success/koichi-wakata' - + ' links:thomas-marshburn@twitter.com, http://www.slate.com/info/michael-p-anderson, www.twitter.com' - + ' relatedContent:{ "url":' - + ' "http://www.laweekly.com/music/jay-electronica-much-better-than-his-name-would-suggest-2412364",' - + ' "og:type": "article", "og:title": "Jay Electronica: Much Better Than His Name Would Suggest",' - + ' "og:description": "You may not know who Jay Electronica is yet, but I'm willing to bet that you' - + ' would had he chosen a better name. Jay Electronica does not sound like the ...", "og:url":' - + ' "http://www.laweekly.com/music/jay-electronica-much-better-than-his-name-would-suggest-2412364",' - + ' "article:published_time": "2008-04-04T16:00:00-07:00", "article:modified_time":' - + ' "2014-11-27T08:01:03-08:00", "article:section": "Music", "og:site_name": "LA Weekly", "twitter:title":' - + ' "Jay Electronica: Much Better Than His Name Would Suggest", "twitter:description": "You may not know' - + ' who Jay Electronica is yet, but I'm willing to bet that you would had he chosen a better name.' - + ' Jay Electronica does not sound like the ...", "twitter:card": "summary", "twitter:site": "@laweekly"' - + ' }, { "url": "http://www.laweekly.com/news/mandoe-on-gower-near-fountain-2368123", "og:type":' - + ' "article", "og:title": "MANDOE On Gower Near Fountain", "og:description": "MANDOE has a stunner on a' - + ' wall north of an east-west street crossing Gower around Fountain (but not on Fountain). MADNOE, PROSE' - + ' and FUKM are listed on t...", "og:url": "' - + 'http://www.laweekly.com/news/mandoe-on-gower-near-fountain-2368123", "article:published_time":' - + ' "2008-04-25T07:26:41-07:00", "article:modified_time": "2014-10-28T15:00:08-07:00", "article:section":' - + ' "News", "og:image": "' - + 'http://images1.laweekly.com/imager/mandoe-on-gower-near-fountain/u/original/2430891/img_6648.jpg",' - + ' "og:image:height": "640", "og:image:width": "480", "og:site_name": "LA Weekly", "twitter:title": ' - + '"MANDOE On Gower Near Fountain", "twitter:description": "MANDOE has a stunner on a wall north of an' - + ' east-west street crossing Gower around Fountain (but not on Fountain). MADNOE, PROSE and FUKM are' - + ' listed on t...", "twitter:card": "summary", "twitter:image": "' - + 'http://images1.laweekly.com/imager/mandoe-on-gower-near-fountain/u/original/2430891/img_6648.jpg", ' - + '"twitter:site": "@laweekly" }, { "url": "http://www.laweekly.com/arts/meghan-finds-the-love-2373346",' - + ' "og:type": "article", "og:title": "Meghan Finds The Love", "og:description": "LA Weekly is the' - + ' definitive source of information for news, music, movies, restaurants, reviews, and events in Los' - + ' Angeles.", "og:url": "http://www.laweekly.com/arts/meghan-finds-the-love-2373346",' - + ' "article:published_time": "2005-10-20T18:10:25-07:00", "article:modified_time":' - + ' "2014-11-25T19:52:35-08:00", "article:section": "Arts", "og:site_name": "LA Weekly", "twitter:title":' - + ' "Meghan Finds The Love", "twitter:description": "LA Weekly is the definitive source of information for' - + ' news, music, movies, restaurants, reviews, and events in Los Angeles.", "twitter:card": "summary",' - + ' "twitter:site": "@laweekly" }, { "url": "http://www.laweekly.com/arts/these-clowns-are-with-me-2371051' - + '", "og:type": "article", "og:title": "These Clowns Are With Me", "og:description": "    I' - + ' didn't mean to blow off all my responsibilities yesterday, but when a schmoozy Hollywood luncheon' - + ' turns into a full-on party by 3pm, and...", "og:url": "' - + 'http://www.laweekly.com/arts/these-clowns-are-with-me-2371051", "article:published_time": ' - + '"2006-03-04T17:03:42-08:00", "article:modified_time": "2014-11-25T17:05:47-08:00", "article:section":' - + ' "Arts", "og:image": "' - + 'http://images1.laweekly.com/imager/these-clowns-are-with-me/u/original/2434556/e4b8scd.jpg",' - + ' "og:image:height": "375", "og:image:width": "500", "og:site_name": "LA Weekly", "twitter:title":' - + ' "These Clowns Are With Me", "twitter:description": "    I didn't mean to blow off all' - + ' my responsibilities yesterday, but when a schmoozy Hollywood luncheon turns into a full-on party by' - + ' 3pm, and...", "twitter:card": "summary", "twitter:image": "' - + 'http://images1.laweekly.com/imager/these-clowns-are-with-me/u/original/2434556/e4b8scd.jpg",' - + ' "twitter:site": "@laweekly" }, { "url": "http://www.laweekly.com/arts/shopping-daze-2373807",' - + ' "og:type": "article", "og:title": "Shopping Daze", "og:description": "LA Weekly is the definitive ' - + 'source of information for news, music, movies, restaurants, reviews, and events in Los Angeles.",' - + ' "og:url": "http://www.laweekly.com/arts/shopping-daze-2373807", "article:published_time":' - + ' "2006-12-13T12:12:04-08:00", "article:modified_time": "2014-11-25T20:15:21-08:00", "article:section":' - + ' "Arts", "og:site_name": "LA Weekly", "twitter:title": "Shopping Daze", "twitter:description": "LA' - + ' Weekly is the definitive source of information for news, music, movies, restaurants, reviews, and' - + ' events in Los Angeles.", "twitter:card": "summary", "twitter:site": "@laweekly" } machine.os:osx' - + ' machine.ram:15,032,385,536 _id:AU_x3_g3GFA8no6QjkFm _type:apache _index:logstash-2015.09.20 _score: -' - + ' relatedContent.article:modified_time:October 28th 2014, 22:00:08.000, November 26th 2014,' - + ' 01:05:47.000, November 26th 2014, 03:52:35.000, November 26th 2014, 04:15:21.000, November 27th 2014,' - + ' 16:01:03.000 relatedContent.article:published_time:October 21st 2005, 01:10:25.000, March 5th 2006,' - + ' 01:03:42.000, December 13th 2006, 20:12:04.000, April 4th 2008, 23:00:00.000, April 25th 2008,' - + ' 14:26:41.000'; - return discoverPage.clickDocSortDown() - .then(function () { - // we don't technically need this sleep here because the tryForTime will retry and the - // results will match on the 2nd or 3rd attempt, but that debug output is huge in this - // case and it can be avoided with just a few seconds sleep. - return common.sleep(2000); - }) - .then(function () { - return common.try(function tryingForTime() { - return discoverPage.getDocTableIndex(1) - .then(function (rowData) { - expect(rowData).to.be(ExpectedDoc); - }); - }); - }) - .catch(common.handleError(this)); - }); - - - bdd.it('a bad syntax query should show an error message', function () { - var expectedHitCount = '1011,156'; - var expectedError = 'Discover: Failed to parse query [xxx(yyy]'; - return discoverPage.query('xxx(yyy') - .then(function () { - return headerPage.getToastMessage(); - }) - .then(function (toastMessage) { - expect(toastMessage).to.be(expectedError); - }) - .then(function () { - return headerPage.clickToastOK(); - }) - .catch(common.handleError(this)); + }); }); + }) + .catch(common.handleError(this)); + }); - }); + bdd.it('a bad syntax query should show an error message', function () { + var expectedHitCount = '1011,156'; + var expectedError = 'Discover: Failed to parse query [xxx(yyy]'; + return discoverPage.query('xxx(yyy') + .then(function () { + return headerPage.getToastMessage(); + }) + .then(function (toastMessage) { + expect(toastMessage).to.be(expectedError); + }) + .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 5607253511943c..0fd461b550fa0e 100644 --- a/test/functional/apps/discover/_shared_links.js +++ b/test/functional/apps/discover/_shared_links.js @@ -9,131 +9,121 @@ import { elasticDump } from '../../../support'; -(function () { - var expect = require('expect.js'); - - (function () { - bdd.describe('shared links', function describeIndexTests() { - var baseUrl; - // The message changes for Firefox < 41 and Firefox >= 41 - // var expectedToastMessage = 'Share search: URL selected. Press Ctrl+C to copy.'; - // var expectedToastMessage = 'Share search: URL copied to clipboard.'; - // Pass either one. - var expectedToastMessage = /Share search: URL (selected\. Press Ctrl\+C to copy\.|copied to clipboard\.)/; - - bdd.before(function () { - baseUrl = common.getHostPort(); - - var fromTime = '2015-09-19 06:31:44.000'; - var toTime = '2015-09-23 18:31:44.000'; - - // delete .kibana index and update configDoc - return esClient.deleteAndUpdateConfigDoc({'dateFormat:tz':'UTC', 'defaultIndex':'logstash-*'}) - .then(function loadkibanaIndexPattern() { - common.debug('load kibana index with default index pattern'); - return elasticDump.elasticLoad('visualize','.kibana'); - }) - // and load a set of makelogs data - .then(function loadIfEmptyMakelogs() { - return scenarioManager.loadIfEmpty('logstashFunctional'); - }) - .then(function () { - common.debug('discover'); - return common.navigateToApp('discover'); - }) - .then(function () { - common.debug('setAbsoluteRange'); - return headerPage.setAbsoluteRange(fromTime, toTime); - }) - .then(function () { - //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)); - }); - - - bdd.describe('shared link', function () { +var expect = require('expect.js'); + +bdd.describe('shared links', function describeIndexTests() { + var baseUrl; + // The message changes for Firefox < 41 and Firefox >= 41 + // var expectedToastMessage = 'Share search: URL selected. Press Ctrl+C to copy.'; + // var expectedToastMessage = 'Share search: URL copied to clipboard.'; + // Pass either one. + var expectedToastMessage = /Share search: URL (selected\. Press Ctrl\+C to copy\.|copied to clipboard\.)/; + + bdd.before(function () { + baseUrl = common.getHostPort(); + + var fromTime = '2015-09-19 06:31:44.000'; + var toTime = '2015-09-23 18:31:44.000'; + + // delete .kibana index and update configDoc + return esClient.deleteAndUpdateConfigDoc({'dateFormat:tz':'UTC', 'defaultIndex':'logstash-*'}) + .then(function loadkibanaIndexPattern() { + common.debug('load kibana index with default index pattern'); + return elasticDump.elasticLoad('visualize','.kibana'); + }) + // and load a set of makelogs data + .then(function loadIfEmptyMakelogs() { + return scenarioManager.loadIfEmpty('logstashFunctional'); + }) + .then(function () { + common.debug('discover'); + return common.navigateToApp('discover'); + }) + .then(function () { + common.debug('setAbsoluteRange'); + return headerPage.setAbsoluteRange(fromTime, toTime); + }) + .then(function () { + //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)); + }); + + + bdd.describe('shared link', function () { + bdd.it('should show "Share a link" caption', function () { + var expectedCaption = 'Share a link'; + return discoverPage.clickShare() + .then(function () { + return discoverPage.getShareCaption(); + }) + .then(function (actualCaption) { + expect(actualCaption).to.be(expectedCaption); + }) + .catch(common.handleError(this)); + }); - bdd.it('should show "Share a link" caption', function () { - var expectedCaption = 'Share a link'; - return discoverPage.clickShare() - .then(function () { - return discoverPage.getShareCaption(); - }) - .then(function (actualCaption) { - expect(actualCaption).to.be(expectedCaption); - }) - .catch(common.handleError(this)); - }); + bdd.it('should show the correct formatted URL', function () { + var expectedUrl = baseUrl + + '/app/kibana?_t=1453775307251#' + + '/discover?_g=(refreshInterval:(display:Off,pause:!f,value:0),time' + + ':(from:\'2015-09-19T06:31:44.000Z\',mode:absolute,to:\'2015-09' + + '-23T18:31:44.000Z\'))&_a=(columns:!(_source),index:\'logstash-' + + '*\',interval:auto,query:(query_string:(analyze_wildcard:!t,query' + + ':\'*\')),sort:!(\'@timestamp\',desc))'; + return discoverPage.getSharedUrl() + .then(function (actualUrl) { + // 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 () { + return discoverPage.clickCopyToClipboard() + .then(function () { + return headerPage.getToastMessage(); + }) + .then(function (toastMessage) { + expect(toastMessage).to.match(expectedToastMessage); + }) + .then(function () { + return headerPage.waitForToastMessageGone(); + }) + .catch(common.handleError(this)); + }); - bdd.it('should show the correct formatted URL', function () { - var expectedUrl = baseUrl - + '/app/kibana?_t=1453775307251#' - + '/discover?_g=(refreshInterval:(display:Off,pause:!f,value:0),time' - + ':(from:\'2015-09-19T06:31:44.000Z\',mode:absolute,to:\'2015-09' - + '-23T18:31:44.000Z\'))&_a=(columns:!(_source),index:\'logstash-' - + '*\',interval:auto,query:(query_string:(analyze_wildcard:!t,query' - + ':\'*\')),sort:!(\'@timestamp\',desc))'; - return discoverPage.getSharedUrl() + // TODO: verify clipboard contents + bdd.it('shorten URL button should produce a short URL', function () { + var re = new RegExp(baseUrl + '/goto/[0-9a-f]{32}$'); + return discoverPage.clickShortenUrl() + .then(function () { + return common.try(function tryingForTime() { + return discoverPage.getShortenedUrl() .then(function (actualUrl) { - // 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 () { - return discoverPage.clickCopyToClipboard() - .then(function () { - return headerPage.getToastMessage(); - }) - .then(function (toastMessage) { - expect(toastMessage).to.match(expectedToastMessage); - }) - .then(function () { - return headerPage.waitForToastMessageGone(); - }) - .catch(common.handleError(this)); - }); - - // TODO: verify clipboard contents - - bdd.it('shorten URL button should produce a short URL', function () { - var re = new RegExp(baseUrl + '/goto/[0-9a-f]{32}$'); - return discoverPage.clickShortenUrl() - .then(function () { - return common.try(function tryingForTime() { - return discoverPage.getShortenedUrl() - .then(function (actualUrl) { - expect(actualUrl).to.match(re); - }); - }); - }) - .catch(common.handleError(this)); - }); - - // NOTE: This test has to run immediately after the test above - bdd.it('should show toast message for copy to clipboard', function () { - return discoverPage.clickCopyToClipboard() - .then(function () { - return headerPage.getToastMessage(); - }) - .then(function (toastMessage) { - expect(toastMessage).to.match(expectedToastMessage); - }) - .then(function () { - return headerPage.waitForToastMessageGone(); - }) - .catch(common.handleError(this)); + expect(actualUrl).to.match(re); + }); }); + }) + .catch(common.handleError(this)); + }); - - }); + // NOTE: This test has to run immediately after the test above + bdd.it('should show toast message for copy to clipboard', function () { + return discoverPage.clickCopyToClipboard() + .then(function () { + return headerPage.getToastMessage(); + }) + .then(function (toastMessage) { + expect(toastMessage).to.match(expectedToastMessage); + }) + .then(function () { + return headerPage.waitForToastMessageGone(); + }) + .catch(common.handleError(this)); }); - }()); -}()); + }); +}); diff --git a/test/functional/apps/discover/index.js b/test/functional/apps/discover/index.js index 2ff0de86952056..13bf91fd52ab28 100644 --- a/test/functional/apps/discover/index.js +++ b/test/functional/apps/discover/index.js @@ -1,20 +1,18 @@ import { bdd, remote, scenarioManager, defaultTimeout } from '../../../support'; -(function () { - bdd.describe('discover app', function () { - this.timeout = defaultTimeout; +bdd.describe('discover app', function () { + this.timeout = defaultTimeout; - bdd.before(function () { - return remote.setWindowSize(1200,800); - }); - - bdd.after(function unloadMakelogs() { - return scenarioManager.unload('logstashFunctional'); - }); + bdd.before(function () { + return remote.setWindowSize(1200,800); + }); - require('./_discover'); - require('./_field_data'); - require('./_shared_links'); - require('./_collapse_expand'); + bdd.after(function unloadMakelogs() { + return scenarioManager.unload('logstashFunctional'); }); -}()); + + require('./_discover'); + require('./_field_data'); + require('./_shared_links'); + require('./_collapse_expand'); +}); diff --git a/test/functional/apps/settings/_advanced_settings.js b/test/functional/apps/settings/_advanced_settings.js index 3cef8d61b37e1a..50c815aafe3e83 100644 --- a/test/functional/apps/settings/_advanced_settings.js +++ b/test/functional/apps/settings/_advanced_settings.js @@ -6,40 +6,36 @@ import { esClient } from '../../../support'; -(function () { - var expect = require('expect.js'); +var expect = require('expect.js'); - (function () { - bdd.describe('creating and deleting default index', function describeIndexTests() { - bdd.before(function () { - // delete .kibana index and then wait for Kibana to re-create it - return esClient.deleteAndUpdateConfigDoc() - .then(function () { - return settingsPage.navigateTo(); - }); - }); - - bdd.describe('index pattern creation', function indexPatternCreation() { - bdd.before(function () { - return settingsPage.createIndexPattern(); - }); +bdd.describe('creating and deleting default index', function describeIndexTests() { + bdd.before(function () { + // delete .kibana index and then wait for Kibana to re-create it + return esClient.deleteAndUpdateConfigDoc() + .then(function () { + return settingsPage.navigateTo(); + }); + }); - bdd.it('should allow setting advanced settings', function () { - return settingsPage.clickAdvancedTab() - .then(function TestCallSetAdvancedSettingsForTimezone() { - common.debug('calling setAdvancedSetting'); - return settingsPage.setAdvancedSettings('dateFormat:tz', 'America/Phoenix'); - }) - .then(function GetAdvancedSetting() { - return settingsPage.getAdvancedSettings('dateFormat:tz'); - }) - .then(function (advancedSetting) { - expect(advancedSetting).to.be('America/Phoenix'); - }) - .catch(common.handleError(this)); - }); + bdd.describe('index pattern creation', function indexPatternCreation() { + bdd.before(function () { + return settingsPage.createIndexPattern(); + }); - }); + bdd.it('should allow setting advanced settings', function () { + return settingsPage.clickAdvancedTab() + .then(function TestCallSetAdvancedSettingsForTimezone() { + common.debug('calling setAdvancedSetting'); + return settingsPage.setAdvancedSettings('dateFormat:tz', 'America/Phoenix'); + }) + .then(function GetAdvancedSetting() { + return settingsPage.getAdvancedSettings('dateFormat:tz'); + }) + .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 ffbe9db41472b6..d5fd4727b18eac 100644 --- a/test/functional/apps/settings/_creation_form_changes.js +++ b/test/functional/apps/settings/_creation_form_changes.js @@ -6,54 +6,50 @@ import { esClient } from '../../../support'; -(function () { - var expect = require('expect.js'); +var expect = require('expect.js'); - (function () { - bdd.describe('user input reactions', function () { - bdd.beforeEach(function () { - // delete .kibana index and then wait for Kibana to re-create it - return esClient.deleteAndUpdateConfigDoc() - .then(function () { - return settingsPage.navigateTo(); - }); - }); +bdd.describe('user input reactions', function () { + bdd.beforeEach(function () { + // delete .kibana index and then wait for Kibana to re-create it + return esClient.deleteAndUpdateConfigDoc() + .then(function () { + return settingsPage.navigateTo(); + }); + }); - bdd.it('should hide time-based index pattern when time-based option is unchecked', function () { - var self = this; - return settingsPage.getTimeBasedEventsCheckbox() - .then(function (selected) { - // uncheck the 'time-based events' checkbox - return selected.click(); - }) - // try to find the checkbox (this shouldn fail) - .then(function () { - var waitTime = 10000; - return settingsPage.getTimeBasedIndexPatternCheckbox(waitTime); - }) - .then(function () { - // we expect the promise above to fail - var handler = common.handleError(self); - var msg = 'Found time based index pattern checkbox'; - handler(msg); - }) - .catch(function () { - // we expect this failure since checkbox should be hidden - return; - }); - }); + bdd.it('should hide time-based index pattern when time-based option is unchecked', function () { + var self = this; + return settingsPage.getTimeBasedEventsCheckbox() + .then(function (selected) { + // uncheck the 'time-based events' checkbox + return selected.click(); + }) + // try to find the checkbox (this shouldn fail) + .then(function () { + var waitTime = 10000; + return settingsPage.getTimeBasedIndexPatternCheckbox(waitTime); + }) + .then(function () { + // we expect the promise above to fail + var handler = common.handleError(self); + var msg = 'Found time based index pattern checkbox'; + handler(msg); + }) + .catch(function () { + // we expect this failure since checkbox should be hidden + return; + }); + }); - bdd.it('should enable creation after selecting time field', function () { - // select a time field and check that Create button is enabled - return settingsPage.selectTimeFieldOption('@timestamp') - .then(function () { - return settingsPage.getCreateButton().isEnabled() - .then(function (enabled) { - expect(enabled).to.be.ok(); - }); - }) - .catch(common.handleError(this)); + bdd.it('should enable creation after selecting time field', function () { + // select a time field and check that Create button is enabled + return settingsPage.selectTimeFieldOption('@timestamp') + .then(function () { + return settingsPage.getCreateButton().isEnabled() + .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 d6050fea15f62a..3cbcffc1e4c0fe 100644 --- a/test/functional/apps/settings/_index_pattern_create_delete.js +++ b/test/functional/apps/settings/_index_pattern_create_delete.js @@ -7,99 +7,95 @@ import { esClient } from '../../../support'; -(function () { - var expect = require('expect.js'); +var expect = require('expect.js'); - (function () { - bdd.describe('creating and deleting default index', function describeIndexTests() { - bdd.before(function () { - // delete .kibana index and then wait for Kibana to re-create it - return esClient.deleteAndUpdateConfigDoc() - .then(function () { - return settingsPage.navigateTo(); - }); - }); +bdd.describe('creating and deleting default index', function describeIndexTests() { + bdd.before(function () { + // delete .kibana index and then wait for Kibana to re-create it + return esClient.deleteAndUpdateConfigDoc() + .then(function () { + return settingsPage.navigateTo(); + }); + }); - bdd.describe('index pattern creation', function indexPatternCreation() { - bdd.before(function () { - return settingsPage.createIndexPattern(); - }); + bdd.describe('index pattern creation', function indexPatternCreation() { + bdd.before(function () { + return settingsPage.createIndexPattern(); + }); - bdd.it('should have index pattern in page header', function pageHeader() { - return settingsPage.getIndexPageHeading().getVisibleText() - .then(function (patternName) { - expect(patternName).to.be('logstash-*'); - }) - .catch(common.handleError(this)); - }); + bdd.it('should have index pattern in page header', function pageHeader() { + 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() { - return common.try(function tryingForTime() { - return remote.getCurrentUrl() - .then(function (currentUrl) { - expect(currentUrl).to.contain('logstash-*'); - }); - }) - .catch(common.handleError(this)); + bdd.it('should have index pattern in url', function url() { + return common.try(function tryingForTime() { + return remote.getCurrentUrl() + .then(function (currentUrl) { + expect(currentUrl).to.contain('logstash-*'); }); + }) + .catch(common.handleError(this)); + }); - bdd.it('should have expected table headers', function checkingHeader() { - return settingsPage.getTableHeader() - .then(function (headers) { - common.debug('header.length = ' + headers.length); - var expectedHeaders = [ - 'name', - 'type', - 'format', - 'analyzed', - 'indexed', - 'controls' - ]; - - // 6 name type format analyzed indexed controls - expect(headers.length).to.be(expectedHeaders.length); - - var comparedHeaders = headers.map(function compareHead(header, i) { - return header.getVisibleText() - .then(function (text) { - expect(text).to.be(expectedHeaders[i]); - }); - }); + bdd.it('should have expected table headers', function checkingHeader() { + return settingsPage.getTableHeader() + .then(function (headers) { + common.debug('header.length = ' + headers.length); + var expectedHeaders = [ + 'name', + 'type', + 'format', + 'analyzed', + 'indexed', + 'controls' + ]; - return Promise.all(comparedHeaders); - }) - .catch(common.handleError(this)); - }); - }); + // 6 name type format analyzed indexed controls + expect(headers.length).to.be(expectedHeaders.length); - bdd.describe('index pattern deletion', function indexDelete() { - bdd.before(function () { - var expectedAlertText = 'Are you sure you want to remove this index pattern?'; - return settingsPage.removeIndexPattern() - .then(function (alertText) { - expect(alertText).to.be(expectedAlertText); + var comparedHeaders = headers.map(function compareHead(header, i) { + return header.getVisibleText() + .then(function (text) { + expect(text).to.be(expectedHeaders[i]); }); }); - bdd.it('should return to index pattern creation page', function returnToPage() { - return common.try(function tryingForTime() { - return settingsPage.getCreateButton(); - }) - .catch(common.handleError(this)); - }); + return Promise.all(comparedHeaders); + }) + .catch(common.handleError(this)); + }); + }); - bdd.it('should remove index pattern from url', function indexNotInUrl() { - // give the url time to settle - return common.try(function tryingForTime() { - return remote.getCurrentUrl() - .then(function (currentUrl) { - common.debug('currentUrl = ' + currentUrl); - expect(currentUrl).to.not.contain('logstash-*'); - }); - }) - .catch(common.handleError(this)); - }); + bdd.describe('index pattern deletion', function indexDelete() { + bdd.before(function () { + var expectedAlertText = 'Are you sure you want to remove this index pattern?'; + return settingsPage.removeIndexPattern() + .then(function (alertText) { + expect(alertText).to.be(expectedAlertText); }); }); - }()); -}()); + + 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() { + // give the url time to settle + return common.try(function tryingForTime() { + return remote.getCurrentUrl() + .then(function (currentUrl) { + 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 3da9830c8a5e24..3ab47d6c6aa9a8 100644 --- a/test/functional/apps/settings/_index_pattern_popularity.js +++ b/test/functional/apps/settings/_index_pattern_popularity.js @@ -6,109 +6,105 @@ import { esClient } from '../../../support'; -(function () { - var expect = require('expect.js'); +var expect = require('expect.js'); - (function () { - bdd.describe('index result popularity', function describeIndexTests() { - bdd.before(function () { - // delete .kibana index and then wait for Kibana to re-create it - return esClient.deleteAndUpdateConfigDoc() - .then(function () { - return settingsPage.navigateTo(); - }); - }); +bdd.describe('index result popularity', function describeIndexTests() { + bdd.before(function () { + // delete .kibana index and then wait for Kibana to re-create it + return esClient.deleteAndUpdateConfigDoc() + .then(function () { + return settingsPage.navigateTo(); + }); + }); - bdd.beforeEach(function be() { - return settingsPage.createIndexPattern(); - }); + bdd.beforeEach(function be() { + return settingsPage.createIndexPattern(); + }); - bdd.afterEach(function ae() { - return settingsPage.removeIndexPattern(); - }); + bdd.afterEach(function ae() { + return settingsPage.removeIndexPattern(); + }); - bdd.describe('change popularity', function indexPatternCreation() { - var fieldName = 'geo.coordinates'; + bdd.describe('change popularity', function indexPatternCreation() { + var fieldName = 'geo.coordinates'; - // set the page size to All again, https://github.com/elastic/kibana/issues/5030 - // TODO: remove this after issue #5030 is closed - function fix5030() { - return settingsPage.setPageSize('All') - .then(function () { - return common.sleep(1000); - }); - } + // set the page size to All again, https://github.com/elastic/kibana/issues/5030 + // TODO: remove this after issue #5030 is closed + function fix5030() { + return settingsPage.setPageSize('All') + .then(function () { + return common.sleep(1000); + }); + } - bdd.beforeEach(function () { - // increase Popularity of geo.coordinates - return settingsPage.setPageSize('All') - .then(function () { - return common.sleep(1000); - }) - .then(function openControlsByName() { - common.debug('Starting openControlsByName (' + fieldName + ')'); - return settingsPage.openControlsByName(fieldName); - }) - .then(function increasePopularity() { - common.debug('increasePopularity'); - return settingsPage.increasePopularity(); - }); - }); + bdd.beforeEach(function () { + // increase Popularity of geo.coordinates + return settingsPage.setPageSize('All') + .then(function () { + return common.sleep(1000); + }) + .then(function openControlsByName() { + common.debug('Starting openControlsByName (' + fieldName + ')'); + return settingsPage.openControlsByName(fieldName); + }) + .then(function increasePopularity() { + common.debug('increasePopularity'); + return settingsPage.increasePopularity(); + }); + }); - bdd.afterEach(function () { - // Cancel saving the popularity change (we didn't make a change in this case, just checking the value) - return settingsPage.controlChangeCancel(); - }); + bdd.afterEach(function () { + // Cancel saving the popularity change (we didn't make a change in this case, just checking the value) + return settingsPage.controlChangeCancel(); + }); - bdd.it('should update the popularity input', function () { - return settingsPage.getPopularity() - .then(function (popularity) { - common.debug('popularity = ' + popularity); - expect(popularity).to.be('1'); - }) - .catch(common.handleError(this)); - }); + bdd.it('should update the popularity input', function () { + return settingsPage.getPopularity() + .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() { - // Cancel saving the popularity change - return settingsPage.controlChangeCancel() - .then(function () { - return fix5030(); - }) - .then(function openControlsByName() { - return settingsPage.openControlsByName(fieldName); - }) - // check that its 0 (previous increase was cancelled) - .then(function getPopularity() { - return settingsPage.getPopularity(); - }) - .then(function (popularity) { - common.debug('popularity = ' + popularity); - expect(popularity).to.be('0'); - }) - .catch(common.handleError(this)); - }); + bdd.it('should be reset on cancel', function pageHeader() { + // Cancel saving the popularity change + return settingsPage.controlChangeCancel() + .then(function () { + return fix5030(); + }) + .then(function openControlsByName() { + return settingsPage.openControlsByName(fieldName); + }) + // check that its 0 (previous increase was cancelled) + .then(function getPopularity() { + return settingsPage.getPopularity(); + }) + .then(function (popularity) { + common.debug('popularity = ' + popularity); + expect(popularity).to.be('0'); + }) + .catch(common.handleError(this)); + }); - bdd.it('can be saved', function pageHeader() { - // Saving the popularity change - return settingsPage.controlChangeSave() - .then(function () { - return fix5030(); - }) - .then(function openControlsByName() { - return settingsPage.openControlsByName(fieldName); - }) - // check that its 0 (previous increase was cancelled) - .then(function getPopularity() { - return settingsPage.getPopularity(); - }) - .then(function (popularity) { - common.debug('popularity = ' + popularity); - expect(popularity).to.be('1'); - }) - .catch(common.handleError(this)); - }); - }); // end 'change popularity' - }); // end index result popularity - }()); -}()); + bdd.it('can be saved', function pageHeader() { + // Saving the popularity change + return settingsPage.controlChangeSave() + .then(function () { + return fix5030(); + }) + .then(function openControlsByName() { + return settingsPage.openControlsByName(fieldName); + }) + // check that its 0 (previous increase was cancelled) + .then(function getPopularity() { + return settingsPage.getPopularity(); + }) + .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 bd69ffa0a44f8b..2f8a4a88aa55a2 100644 --- a/test/functional/apps/settings/_index_pattern_results_sort.js +++ b/test/functional/apps/settings/_index_pattern_results_sort.js @@ -7,129 +7,125 @@ import { esClient } from '../../../support'; -(function () { - var expect = require('expect.js'); +var expect = require('expect.js'); - (function () { - bdd.describe('index result field sort', function describeIndexTests() { +bdd.describe('index result field sort', function describeIndexTests() { + bdd.before(function () { + // delete .kibana index and then wait for Kibana to re-create it + return esClient.deleteAndUpdateConfigDoc(); + }); + + var columns = [{ + heading: 'name', + first: '@message', + last: 'xss.raw', + selector: function () { + return settingsPage.getTableRow(0, 0).getVisibleText(); + } + }, { + heading: 'type', + first: '_source', + last: 'string', + selector: function () { + return settingsPage.getTableRow(0, 1).getVisibleText(); + } + }]; + + columns.forEach(function (col) { + bdd.describe('sort by heading - ' + col.heading, function indexPatternCreation() { bdd.before(function () { - // delete .kibana index and then wait for Kibana to re-create it - return esClient.deleteAndUpdateConfigDoc(); + return settingsPage.navigateTo(); }); - var columns = [{ - heading: 'name', - first: '@message', - last: 'xss.raw', - selector: function () { - return settingsPage.getTableRow(0, 0).getVisibleText(); - } - }, { - heading: 'type', - first: '_source', - last: 'string', - selector: function () { - return settingsPage.getTableRow(0, 1).getVisibleText(); - } - }]; + bdd.beforeEach(function () { + return settingsPage.createIndexPattern(); + }); - columns.forEach(function (col) { - bdd.describe('sort by heading - ' + col.heading, function indexPatternCreation() { - bdd.before(function () { - return settingsPage.navigateTo(); - }); + bdd.afterEach(function () { + return settingsPage.removeIndexPattern(); + }); - bdd.beforeEach(function () { - return settingsPage.createIndexPattern(); - }); + bdd.it('should sort ascending', function pageHeader() { + return settingsPage.sortBy(col.heading) + .then(function getText() { + return col.selector(); + }) + .then(function (rowText) { + expect(rowText).to.be(col.first); + }) + .catch(common.handleError(this)); + }); - bdd.afterEach(function () { - return settingsPage.removeIndexPattern(); - }); + bdd.it('should sort descending', function pageHeader() { + return settingsPage.sortBy(col.heading) + .then(function sortAgain() { + return settingsPage.sortBy(col.heading); + }) + .then(function getText() { + return col.selector(); + }) + .then(function (rowText) { + expect(rowText).to.be(col.last); + }) + .catch(common.handleError(this)); + }); + }); + }); - bdd.it('should sort ascending', function pageHeader() { - return settingsPage.sortBy(col.heading) - .then(function getText() { - return col.selector(); - }) - .then(function (rowText) { - expect(rowText).to.be(col.first); - }) - .catch(common.handleError(this)); - }); + bdd.describe('field list pagination', function () { + var expectedDefaultPageSize = 25; + var expectedFieldCount = 85; + var expectedLastPageCount = 10; + var pages = [1, 2, 3, 4]; - bdd.it('should sort descending', function pageHeader() { - return settingsPage.sortBy(col.heading) - .then(function sortAgain() { - return settingsPage.sortBy(col.heading); - }) - .then(function getText() { - return col.selector(); - }) - .then(function (rowText) { - expect(rowText).to.be(col.last); - }) - .catch(common.handleError(this)); - }); - }); + bdd.before(function () { + return settingsPage.navigateTo() + .then(function () { + return settingsPage.createIndexPattern(); }); + }); - bdd.describe('field list pagination', function () { - var expectedDefaultPageSize = 25; - var expectedFieldCount = 85; - var expectedLastPageCount = 10; - var pages = [1, 2, 3, 4]; + bdd.after(function () { + return settingsPage.removeIndexPattern(); + }); - bdd.before(function () { - return settingsPage.navigateTo() - .then(function () { - return settingsPage.createIndexPattern(); - }); + bdd.it('makelogs data should have expected number of fields', function () { + return common.try(function () { + return settingsPage.getFieldsTabCount() + .then(function (tabCount) { + expect(tabCount).to.be('' + expectedFieldCount); }); + }) + .catch(common.handleError(this)); + }); - bdd.after(function () { - return settingsPage.removeIndexPattern(); - }); + 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('makelogs data should have expected number of fields', function () { - return common.try(function () { - return settingsPage.getFieldsTabCount() - .then(function (tabCount) { - expect(tabCount).to.be('' + expectedFieldCount); - }); + bdd.it('should have the correct number of rows per page', function () { + var pageCount = Math.ceil(expectedFieldCount / expectedDefaultPageSize); + var chain = pages.reduce(function (chain, val) { + return chain.then(function () { + return settingsPage.goToPage(val) + .then(function () { + return common.sleep(1000); }) - .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); + .then(function () { + return settingsPage.getPageFieldCount(); }) - .catch(common.handleError(this)); + .then(function (pageCount) { + var expectedSize = (val < 4) ? expectedDefaultPageSize : expectedLastPageCount; + expect(pageCount.length).to.be(expectedSize); + }); }); + }, Promise.resolve()); - bdd.it('should have the correct number of rows per page', function () { - var pageCount = Math.ceil(expectedFieldCount / expectedDefaultPageSize); - var chain = pages.reduce(function (chain, val) { - return chain.then(function () { - return settingsPage.goToPage(val) - .then(function () { - return common.sleep(1000); - }) - .then(function () { - return settingsPage.getPageFieldCount(); - }) - .then(function (pageCount) { - var expectedSize = (val < 4) ? expectedDefaultPageSize : expectedLastPageCount; - expect(pageCount.length).to.be(expectedSize); - }); - }); - }, Promise.resolve()); - - return chain.catch(common.handleError(this)); - }); - }); // end describe pagination - }); // end index result field sort - }()); -}()); + return chain.catch(common.handleError(this)); + }); + }); // end describe pagination +}); // end index result field sort diff --git a/test/functional/apps/settings/_initial_state.js b/test/functional/apps/settings/_initial_state.js index 674bf60813b92f..a283ac97d44888 100644 --- a/test/functional/apps/settings/_initial_state.js +++ b/test/functional/apps/settings/_initial_state.js @@ -6,61 +6,57 @@ import { esClient } from '../../../support'; -(function () { - var expect = require('expect.js'); - - (function () { - bdd.describe('initial state', function () { - bdd.before(function () { - // delete .kibana index and then wait for Kibana to re-create it - return esClient.deleteAndUpdateConfigDoc() - .then(function () { - return settingsPage.navigateTo(); - }); - }); - - bdd.it('should load with time pattern checked', 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 () { - var defaultPattern = 'logstash-*'; - - 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 () { - return settingsPage.getTimeFieldNameField().isSelected() - .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)); - }); +var expect = require('expect.js'); + +bdd.describe('initial state', function () { + bdd.before(function () { + // delete .kibana index and then wait for Kibana to re-create it + return esClient.deleteAndUpdateConfigDoc() + .then(function () { + return settingsPage.navigateTo(); }); - }()); -}()); + }); + + bdd.it('should load with time pattern checked', 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 () { + var defaultPattern = 'logstash-*'; + + 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 () { + return settingsPage.getTimeFieldNameField().isSelected() + .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/settings/index.js b/test/functional/apps/settings/index.js index ad2a22785cbc3b..08a7fc86a1eff3 100644 --- a/test/functional/apps/settings/index.js +++ b/test/functional/apps/settings/index.js @@ -1,27 +1,25 @@ import { bdd, defaultTimeout, scenarioManager, esClient, common } from '../../../support'; -(function () { - bdd.describe('settings app', function () { - this.timeout = defaultTimeout; +bdd.describe('settings app', function () { + this.timeout = defaultTimeout; - // on setup, we create an settingsPage instance - // that we will use for all the tests - bdd.before(function () { - return scenarioManager.loadIfEmpty('makelogs'); - }); + // on setup, we create an settingsPage instance + // that we will use for all the tests + bdd.before(function () { + return scenarioManager.loadIfEmpty('makelogs'); + }); - bdd.after(function () { - return scenarioManager.unload('makelogs') - .then(function () { - return esClient.delete('.kibana'); - }); + bdd.after(function () { + return scenarioManager.unload('makelogs') + .then(function () { + return esClient.delete('.kibana'); }); - - require('./_initial_state'); - require('./_creation_form_changes'); - require('./_index_pattern_create_delete'); - require('./_index_pattern_results_sort'); - require('./_index_pattern_popularity'); - require('./_advanced_settings'); }); -}()); + + require('./_initial_state'); + require('./_creation_form_changes'); + require('./_index_pattern_create_delete'); + require('./_index_pattern_results_sort'); + require('./_index_pattern_popularity'); + require('./_advanced_settings'); +}); diff --git a/test/functional/apps/visualize/_area_chart.js b/test/functional/apps/visualize/_area_chart.js index 323f9cf6ece6e4..c933acc54b6ef7 100644 --- a/test/functional/apps/visualize/_area_chart.js +++ b/test/functional/apps/visualize/_area_chart.js @@ -7,175 +7,171 @@ import { visualizePage } from '../../../support'; -(function () { - var expect = require('expect.js'); +var expect = require('expect.js'); - (function () { - bdd.describe('visualize app', function describeIndexTests() { - bdd.before(function () { - var fromTime = '2015-09-19 06:31:44.000'; - var toTime = '2015-09-23 18:31:44.000'; +bdd.describe('visualize app', function describeIndexTests() { + bdd.before(function () { + var fromTime = '2015-09-19 06:31:44.000'; + var toTime = '2015-09-23 18:31:44.000'; - common.debug('navigateToApp visualize'); - return common.navigateToApp('visualize') - .then(function () { - common.debug('clickAreaChart'); - return visualizePage.clickAreaChart(); - }) - .then(function clickNewSearch() { - common.debug('clickNewSearch'); - return visualizePage.clickNewSearch(); - }) - .then(function setAbsoluteRange() { - common.debug('Set absolute time range from \"' + fromTime + '\" to \"' + toTime + '\"'); - return headerPage.setAbsoluteRange(fromTime, toTime); - }) - .then(function clickBucket() { - common.debug('Click X-Axis'); - return visualizePage.clickBucket('X-Axis'); - }) - .then(function selectAggregation() { - common.debug('Click Date Histogram'); - return visualizePage.selectAggregation('Date Histogram'); - }) - .then(function getField() { - common.debug('Check field value'); - return visualizePage.getField(); - }) - .then(function (fieldValue) { - common.debug('fieldValue = ' + fieldValue); - expect(fieldValue).to.be('@timestamp'); - }) - .then(function getInterval() { - return visualizePage.getInterval(); - }) - .then(function (intervalValue) { - common.debug('intervalValue = ' + intervalValue); - expect(intervalValue).to.be('Auto'); - }) - .then(function clickGo() { - return visualizePage.clickGo(); - }) - .then(function getSpinnerDone() { - common.debug('Waiting...'); - return headerPage.getSpinnerDone(); - }) - .catch(common.handleError(this)); - }); + common.debug('navigateToApp visualize'); + return common.navigateToApp('visualize') + .then(function () { + common.debug('clickAreaChart'); + return visualizePage.clickAreaChart(); + }) + .then(function clickNewSearch() { + common.debug('clickNewSearch'); + return visualizePage.clickNewSearch(); + }) + .then(function setAbsoluteRange() { + common.debug('Set absolute time range from \"' + fromTime + '\" to \"' + toTime + '\"'); + return headerPage.setAbsoluteRange(fromTime, toTime); + }) + .then(function clickBucket() { + common.debug('Click X-Axis'); + return visualizePage.clickBucket('X-Axis'); + }) + .then(function selectAggregation() { + common.debug('Click Date Histogram'); + return visualizePage.selectAggregation('Date Histogram'); + }) + .then(function getField() { + common.debug('Check field value'); + return visualizePage.getField(); + }) + .then(function (fieldValue) { + common.debug('fieldValue = ' + fieldValue); + expect(fieldValue).to.be('@timestamp'); + }) + .then(function getInterval() { + return visualizePage.getInterval(); + }) + .then(function (intervalValue) { + common.debug('intervalValue = ' + intervalValue); + expect(intervalValue).to.be('Auto'); + }) + .then(function clickGo() { + return visualizePage.clickGo(); + }) + .then(function getSpinnerDone() { + common.debug('Waiting...'); + return headerPage.getSpinnerDone(); + }) + .catch(common.handleError(this)); + }); - bdd.describe('area charts', function indexPatternCreation() { - var testSubName = 'AreaChart'; - var vizName1 = 'Visualization ' + testSubName; + bdd.describe('area charts', function indexPatternCreation() { + 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); - expect(message).to.be('Visualization Editor: Saved Visualization \"' + vizName1 + '\"'); - }) - .then(function testVisualizeWaitForToastMessageGone() { - return visualizePage.waitForToastMessageGone(); - }) - .then(function loadSavedVisualization() { - return visualizePage.loadSavedVisualization(vizName1); - }) - .then(function () { - return visualizePage.waitForVisualization(); - }) - // We have to sleep sometime between loading the saved visTitle - // and trying to access the chart below with getXAxisLabels - // otherwise it hangs. - .then(function sleep() { - return common.sleep(2000); - }) - .catch(common.handleError(this)); - }); + bdd.it('should save and load', function pageHeader() { + return visualizePage.saveVisualization(vizName1) + .then(function (message) { + common.debug('Saved viz message = ' + message); + expect(message).to.be('Visualization Editor: Saved Visualization \"' + vizName1 + '\"'); + }) + .then(function testVisualizeWaitForToastMessageGone() { + return visualizePage.waitForToastMessageGone(); + }) + .then(function loadSavedVisualization() { + return visualizePage.loadSavedVisualization(vizName1); + }) + .then(function () { + return visualizePage.waitForVisualization(); + }) + // We have to sleep sometime between loading the saved visTitle + // and trying to access the chart below with getXAxisLabels + // otherwise it hangs. + .then(function sleep() { + return common.sleep(2000); + }) + .catch(common.handleError(this)); + }); - 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' - ]; - var yAxisLabels = ['0','200','400','600','800','1,000','1,200','1,400','1,600']; - var expectedAreaChartData = [37, 202, 740, 1437, 1371, 751, 188, 31, 42, 202, - 683, 1361, 1415, 707, 177, 27, 32, 175, 707, 1408, 1355, 726, 201, 29 - ]; + 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' + ]; + var yAxisLabels = ['0','200','400','600','800','1,000','1,200','1,400','1,600']; + var expectedAreaChartData = [37, 202, 740, 1437, 1371, 751, 188, 31, 42, 202, + 683, 1361, 1415, 707, 177, 27, 32, 175, 707, 1408, 1355, 726, 201, 29 + ]; - return common.try(function tryingForTime() { - return visualizePage.getXAxisLabels() - .then(function compareLabels(labels) { - common.debug('X-Axis labels = ' + labels); - expect(labels).to.eql(xAxisLabels); - }); - }) - .then(function getYAxisLabels() { - return visualizePage.getYAxisLabels(); - }) - .then(function (labels) { - common.debug('Y-Axis labels = ' + labels); - expect(labels).to.eql(yAxisLabels); - }) - .then(function getAreaChartData() { - return visualizePage.getAreaChartData('Count'); - }) - .then(function (paths) { - common.debug('expectedAreaChartData = ' + expectedAreaChartData); - 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)); + return common.try(function tryingForTime() { + return visualizePage.getXAxisLabels() + .then(function compareLabels(labels) { + common.debug('X-Axis labels = ' + labels); + expect(labels).to.eql(xAxisLabels); }); + }) + .then(function getYAxisLabels() { + return visualizePage.getYAxisLabels(); + }) + .then(function (labels) { + common.debug('Y-Axis labels = ' + labels); + expect(labels).to.eql(yAxisLabels); + }) + .then(function getAreaChartData() { + return visualizePage.getAreaChartData('Count'); + }) + .then(function (paths) { + common.debug('expectedAreaChartData = ' + expectedAreaChartData); + 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', - 'September 20th 2015, 09:00:00.000 1,437', - 'September 20th 2015, 12:00:00.000 1,371', - 'September 20th 2015, 15:00:00.000 751', - 'September 20th 2015, 18:00:00.000 188', - 'September 20th 2015, 21:00:00.000 31', - 'September 21st 2015, 00:00:00.000 42', - 'September 21st 2015, 03:00:00.000 202', - 'September 21st 2015, 06:00:00.000 683', - 'September 21st 2015, 09:00:00.000 1,361', - 'September 21st 2015, 12:00:00.000 1,415', - 'September 21st 2015, 15:00:00.000 707', - 'September 21st 2015, 18:00:00.000 177', - 'September 21st 2015, 21:00:00.000 27', - 'September 22nd 2015, 00:00:00.000 32', - 'September 22nd 2015, 03:00:00.000 175', - 'September 22nd 2015, 06:00:00.000 707', - 'September 22nd 2015, 09:00:00.000 1,408', - 'September 22nd 2015, 12:00:00.000 1,355', - 'September 22nd 2015, 15:00:00.000 726', - 'September 22nd 2015, 18:00:00.000 201', - 'September 22nd 2015, 21:00:00.000 29' - ]; + 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', + 'September 20th 2015, 09:00:00.000 1,437', + 'September 20th 2015, 12:00:00.000 1,371', + 'September 20th 2015, 15:00:00.000 751', + 'September 20th 2015, 18:00:00.000 188', + 'September 20th 2015, 21:00:00.000 31', + 'September 21st 2015, 00:00:00.000 42', + 'September 21st 2015, 03:00:00.000 202', + 'September 21st 2015, 06:00:00.000 683', + 'September 21st 2015, 09:00:00.000 1,361', + 'September 21st 2015, 12:00:00.000 1,415', + 'September 21st 2015, 15:00:00.000 707', + 'September 21st 2015, 18:00:00.000 177', + 'September 21st 2015, 21:00:00.000 27', + 'September 22nd 2015, 00:00:00.000 32', + 'September 22nd 2015, 03:00:00.000 175', + 'September 22nd 2015, 06:00:00.000 707', + 'September 22nd 2015, 09:00:00.000 1,408', + 'September 22nd 2015, 12:00:00.000 1,355', + 'September 22nd 2015, 15:00:00.000 726', + 'September 22nd 2015, 18:00:00.000 201', + 'September 22nd 2015, 21:00:00.000 29' + ]; - return visualizePage.collapseChart() - .then(function setPageSize() { - return settingsPage.setPageSize('All'); - }) - .then(function getDataTableData() { - return visualizePage.getDataTableData(); - }) - .then(function showData(data) { - common.debug('getDataTableData = ' + data.split('\n')); - expect(data.trim().split('\n')).to.eql(expectedTableData); - }) - .catch(common.handleError(this)); - }); + return visualizePage.collapseChart() + .then(function setPageSize() { + return settingsPage.setPageSize('All'); + }) + .then(function getDataTableData() { + return visualizePage.getDataTableData(); + }) + .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 8a1abb790232e4..a352a5bc197cc7 100644 --- a/test/functional/apps/visualize/_chart_types.js +++ b/test/functional/apps/visualize/_chart_types.js @@ -6,35 +6,31 @@ import { visualizePage } from '../../../support'; -(function () { - var expect = require('expect.js'); +var expect = require('expect.js'); - (function () { - bdd.describe('visualize app', function describeIndexTests() { +bdd.describe('visualize app', function describeIndexTests() { - bdd.before(function () { - common.debug('navigateToApp visualize'); - return common.navigateToApp('visualize'); - }); + bdd.before(function () { + common.debug('navigateToApp visualize'); + return common.navigateToApp('visualize'); + }); - bdd.describe('chart types', function indexPatternCreation() { + bdd.describe('chart types', function indexPatternCreation() { - bdd.it('should show the correct chart types', function pageHeader() { + bdd.it('should show the correct chart types', function pageHeader() { - var expectedChartTypes = [ - 'Area chart', 'Data table', 'Line chart', 'Markdown widget', - 'Metric', 'Pie chart', 'Tile map', 'Vertical bar chart' - ]; - // find all the chart types and make sure there all there - return visualizePage.getChartTypes() - .then(function testChartTypes(chartTypes) { - common.debug('returned chart types = ' + chartTypes); - common.debug('expected chart types = ' + expectedChartTypes); - expect(chartTypes).to.eql(expectedChartTypes); - }) - .catch(common.handleError(this)); - }); - }); + var expectedChartTypes = [ + 'Area chart', 'Data table', 'Line chart', 'Markdown widget', + 'Metric', 'Pie chart', 'Tile map', 'Vertical bar chart' + ]; + // find all the chart types and make sure there all there + return visualizePage.getChartTypes() + .then(function testChartTypes(chartTypes) { + 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 521ceec8ee4e2a..ad5753c0f0f20e 100644 --- a/test/functional/apps/visualize/_data_table.js +++ b/test/functional/apps/visualize/_data_table.js @@ -7,98 +7,94 @@ import { visualizePage } from '../../../support'; -(function () { - var expect = require('expect.js'); +var expect = require('expect.js'); - (function () { - bdd.describe('visualize app', function describeIndexTests() { - var fromTime = '2015-09-19 06:31:44.000'; - var toTime = '2015-09-23 18:31:44.000'; +bdd.describe('visualize app', function describeIndexTests() { + var fromTime = '2015-09-19 06:31:44.000'; + var toTime = '2015-09-23 18:31:44.000'; - bdd.before(function () { - common.debug('navigateToApp visualize'); - return common.navigateToApp('visualize') - .then(function () { - common.debug('clickDataTable'); - return visualizePage.clickDataTable(); - }) - .then(function clickNewSearch() { - common.debug('clickNewSearch'); - return visualizePage.clickNewSearch(); - }) - .then(function setAbsoluteRange() { - common.debug('Set absolute time range from \"' + fromTime + '\" to \"' + toTime + '\"'); - return headerPage.setAbsoluteRange(fromTime, toTime); - }) - .then(function clickBucket() { - common.debug('Bucket = Split Rows'); - return visualizePage.clickBucket('Split Rows'); - }) - .then(function selectAggregation() { - common.debug('Aggregation = Histogram'); - return visualizePage.selectAggregation('Histogram'); - }) - .then(function selectField() { - common.debug('Field = bytes'); - return visualizePage.selectField('bytes'); - }) - .then(function setInterval() { - common.debug('Interval = 2000'); - return visualizePage.setNumericInterval('2000'); - }) - .then(function clickGo() { - return visualizePage.clickGo(); - }) - .then(function () { - return headerPage.getSpinnerDone(); - }) - .catch(common.handleError(this)); - }); + bdd.before(function () { + common.debug('navigateToApp visualize'); + return common.navigateToApp('visualize') + .then(function () { + common.debug('clickDataTable'); + return visualizePage.clickDataTable(); + }) + .then(function clickNewSearch() { + common.debug('clickNewSearch'); + return visualizePage.clickNewSearch(); + }) + .then(function setAbsoluteRange() { + common.debug('Set absolute time range from \"' + fromTime + '\" to \"' + toTime + '\"'); + return headerPage.setAbsoluteRange(fromTime, toTime); + }) + .then(function clickBucket() { + common.debug('Bucket = Split Rows'); + return visualizePage.clickBucket('Split Rows'); + }) + .then(function selectAggregation() { + common.debug('Aggregation = Histogram'); + return visualizePage.selectAggregation('Histogram'); + }) + .then(function selectField() { + common.debug('Field = bytes'); + return visualizePage.selectField('bytes'); + }) + .then(function setInterval() { + common.debug('Interval = 2000'); + return visualizePage.setNumericInterval('2000'); + }) + .then(function clickGo() { + return visualizePage.clickGo(); + }) + .then(function () { + return headerPage.getSpinnerDone(); + }) + .catch(common.handleError(this)); + }); - bdd.describe('data table', function indexPatternCreation() { - var testSubName = 'DataTable'; - var vizName1 = 'Visualization ' + testSubName; + bdd.describe('data table', function indexPatternCreation() { + var testSubName = 'DataTable'; + var vizName1 = 'Visualization ' + testSubName; - bdd.it('should be able to save and load', function pageHeader() { - return visualizePage.saveVisualization(vizName1) - .then(function (message) { - 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 () { - return visualizePage.waitForVisualization(); - }) - .catch(common.handleError(this)); - }); + bdd.it('should be able to save and load', function pageHeader() { + return visualizePage.saveVisualization(vizName1) + .then(function (message) { + 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 () { + return visualizePage.waitForVisualization(); + }) + .catch(common.handleError(this)); + }); - bdd.it('should show correct data, take screenshot', function pageHeader() { - var chartHeight = 0; - var expectedChartData = [ '0 2,088', '2,000 2,748', '4,000 2,707', '6,000 2,876', - '8,000 2,863', '10,000 147', '12,000 148', '14,000 129', '16,000 161', '18,000 137' - ]; + bdd.it('should show correct data, take screenshot', function pageHeader() { + var chartHeight = 0; + var expectedChartData = [ '0 2,088', '2,000 2,748', '4,000 2,707', '6,000 2,876', + '8,000 2,863', '10,000 147', '12,000 148', '14,000 129', '16,000 161', '18,000 137' + ]; - return visualizePage.getDataTableData() - .then(function showData(data) { - common.debug(data.split('\n')); - expect(data.split('\n')).to.eql(expectedChartData); - }) - .then(function takeScreenshot() { - common.debug('Take screenshot'); - common.saveScreenshot('./screenshot-' + testSubName + '.png'); - }) - .catch(common.handleError(this)); - }); + return visualizePage.getDataTableData() + .then(function showData(data) { + common.debug(data.split('\n')); + expect(data.split('\n')).to.eql(expectedChartData); + }) + .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 8868aa0d58f077..0b89c289f570df 100644 --- a/test/functional/apps/visualize/_line_chart.js +++ b/test/functional/apps/visualize/_line_chart.js @@ -7,129 +7,125 @@ import { visualizePage } from '../../../support'; -(function () { - var expect = require('expect.js'); - - (function () { - bdd.describe('visualize app', function describeIndexTests() { - bdd.before(function () { - var fromTime = '2015-09-19 06:31:44.000'; - var toTime = '2015-09-23 18:31:44.000'; - - common.debug('navigateToApp visualize'); - return common.navigateToApp('visualize') - .then(function () { - common.debug('clickLineChart'); - return visualizePage.clickLineChart(); - }) - .then(function clickNewSearch() { - return visualizePage.clickNewSearch(); - }) - .then(function setAbsoluteRange() { - common.debug('Set absolute time range from \"' + fromTime + '\" to \"' + toTime + '\"'); - return headerPage.setAbsoluteRange(fromTime, toTime); - }) - .then(function clickBucket() { - common.debug('Bucket = Split Chart'); - return visualizePage.clickBucket('Split Chart'); - }) - .then(function selectAggregation() { - common.debug('Aggregation = Terms'); - return visualizePage.selectAggregation('Terms'); - }) - .then(function selectField() { - common.debug('Field = extension'); - return visualizePage.selectField('extension.raw'); - }) - .then(function setInterval() { - common.debug('switch from Rows to Columns'); - return visualizePage.clickColumns(); - }) - .then(function clickGo() { - return visualizePage.clickGo(); - }) - .then(function () { - return headerPage.getSpinnerDone(); // only matches the hidden spinner - }) - .catch(common.handleError(this)); - }); - - bdd.describe('line charts', function indexPatternCreation() { - var testSubName = 'LineChart'; - var vizName1 = 'Visualization ' + testSubName; - - bdd.it('should be able to save and load', function pageHeader() { - - common.debug('Start of test' + testSubName + 'Visualization'); - var remote = this.remote; - - return visualizePage.saveVisualization(vizName1) - .then(function (message) { - 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() { - return visualizePage.waitForVisualization(); - }) - .catch(common.handleError(this)); - }); +var expect = require('expect.js'); + +bdd.describe('visualize app', function describeIndexTests() { + bdd.before(function () { + var fromTime = '2015-09-19 06:31:44.000'; + var toTime = '2015-09-23 18:31:44.000'; + + common.debug('navigateToApp visualize'); + return common.navigateToApp('visualize') + .then(function () { + common.debug('clickLineChart'); + return visualizePage.clickLineChart(); + }) + .then(function clickNewSearch() { + return visualizePage.clickNewSearch(); + }) + .then(function setAbsoluteRange() { + common.debug('Set absolute time range from \"' + fromTime + '\" to \"' + toTime + '\"'); + return headerPage.setAbsoluteRange(fromTime, toTime); + }) + .then(function clickBucket() { + common.debug('Bucket = Split Chart'); + return visualizePage.clickBucket('Split Chart'); + }) + .then(function selectAggregation() { + common.debug('Aggregation = Terms'); + return visualizePage.selectAggregation('Terms'); + }) + .then(function selectField() { + common.debug('Field = extension'); + return visualizePage.selectField('extension.raw'); + }) + .then(function setInterval() { + common.debug('switch from Rows to Columns'); + return visualizePage.clickColumns(); + }) + .then(function clickGo() { + return visualizePage.clickGo(); + }) + .then(function () { + return headerPage.getSpinnerDone(); // only matches the hidden spinner + }) + .catch(common.handleError(this)); + }); + + bdd.describe('line charts', function indexPatternCreation() { + var testSubName = 'LineChart'; + var vizName1 = 'Visualization ' + testSubName; + + bdd.it('should be able to save and load', function pageHeader() { + + common.debug('Start of test' + testSubName + 'Visualization'); + var remote = this.remote; + + return visualizePage.saveVisualization(vizName1) + .then(function (message) { + 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() { + return visualizePage.waitForVisualization(); + }) + .catch(common.handleError(this)); + }); - bdd.it('should show correct chart, take screenshot', function pageHeader() { - - var remote = this.remote; - - // this test only verifies the numerical part of this data - // it could also check the legend to verify the extensions - var expectedChartData = ['jpg 9,109', 'css 2,159', 'png 1,373', 'gif 918', 'php 445']; - - // sleep a bit before trying to get the chart data - return common.sleep(3000) - .then(function () { - return visualizePage.getLineChartData('fill="#57c17b"') - .then(function showData(data) { - var tolerance = 10; // the y-axis scale is 10000 so 10 is 0.1% - for (var x = 0; x < data.length; x++) { - common.debug('x=' + x + ' expectedChartData[x].split(\' \')[1] = ' + - (expectedChartData[x].split(' ')[1]).replace(',', '') + ' data[x]=' + data[x] + - ' diff=' + Math.abs(expectedChartData[x].split(' ')[1].replace(',', '') - data[x])); - expect(Math.abs(expectedChartData[x].split(' ')[1].replace(',', '') - data[x]) < tolerance).to.be.ok(); - } - 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)); - }); + bdd.it('should show correct chart, take screenshot', function pageHeader() { - bdd.it('should show correct data', function pageHeader() { + var remote = this.remote; - var remote = this.remote; - var expectedChartData = ['jpg 9,109', 'css 2,159', 'png 1,373', 'gif 918', 'php 445']; + // this test only verifies the numerical part of this data + // it could also check the legend to verify the extensions + var expectedChartData = ['jpg 9,109', 'css 2,159', 'png 1,373', 'gif 918', 'php 445']; - return visualizePage.collapseChart() - .then(function getDataTableData() { - return visualizePage.getDataTableData(); - }) - .then(function showData(data) { - common.debug(data.split('\n')); - expect(data.trim().split('\n')).to.eql(expectedChartData); - }) - .catch(common.handleError(this)); + // sleep a bit before trying to get the chart data + return common.sleep(3000) + .then(function () { + return visualizePage.getLineChartData('fill="#57c17b"') + .then(function showData(data) { + var tolerance = 10; // the y-axis scale is 10000 so 10 is 0.1% + for (var x = 0; x < data.length; x++) { + common.debug('x=' + x + ' expectedChartData[x].split(\' \')[1] = ' + + (expectedChartData[x].split(' ')[1]).replace(',', '') + ' data[x]=' + data[x] + + ' diff=' + Math.abs(expectedChartData[x].split(' ')[1].replace(',', '') - data[x])); + expect(Math.abs(expectedChartData[x].split(' ')[1].replace(',', '') - data[x]) < tolerance).to.be.ok(); + } + 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)); + }); + bdd.it('should show correct data', function pageHeader() { - }); + var remote = this.remote; + var expectedChartData = ['jpg 9,109', 'css 2,159', 'png 1,373', 'gif 918', 'php 445']; + + return visualizePage.collapseChart() + .then(function getDataTableData() { + return visualizePage.getDataTableData(); + }) + .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 c4a628f81626fe..fd026b601f858f 100644 --- a/test/functional/apps/visualize/_metric_chart.js +++ b/test/functional/apps/visualize/_metric_chart.js @@ -7,279 +7,275 @@ import { visualizePage } from '../../../support'; -(function () { - var expect = require('expect.js'); +var expect = require('expect.js'); - (function () { - bdd.describe('visualize app', function describeIndexTests() { - var fromTime = '2015-09-19 06:31:44.000'; - var toTime = '2015-09-23 18:31:44.000'; +bdd.describe('visualize app', function describeIndexTests() { + var fromTime = '2015-09-19 06:31:44.000'; + var toTime = '2015-09-23 18:31:44.000'; - bdd.before(function () { + bdd.before(function () { - var testSubName = 'MetricChart'; - common.debug('Start of test' + testSubName + 'Visualization'); - var vizName1 = 'Visualization ' + testSubName; + var testSubName = 'MetricChart'; + common.debug('Start of test' + testSubName + 'Visualization'); + var vizName1 = 'Visualization ' + testSubName; - common.debug('navigateToApp visualize'); - return common.navigateToApp('visualize') - .then(function () { - common.debug('clickMetric'); - return visualizePage.clickMetric(); - }) - .then(function clickNewSearch() { - return visualizePage.clickNewSearch(); - }) - .then(function setAbsoluteRange() { - common.debug('Set absolute time range from \"' + fromTime + '\" to \"' + toTime + '\"'); - return headerPage.setAbsoluteRange(fromTime, toTime); - }) - .catch(common.handleError(this)); - }); + common.debug('navigateToApp visualize'); + return common.navigateToApp('visualize') + .then(function () { + common.debug('clickMetric'); + return visualizePage.clickMetric(); + }) + .then(function clickNewSearch() { + return visualizePage.clickNewSearch(); + }) + .then(function setAbsoluteRange() { + common.debug('Set absolute time range from \"' + fromTime + '\" to \"' + toTime + '\"'); + return headerPage.setAbsoluteRange(fromTime, toTime); + }) + .catch(common.handleError(this)); + }); - bdd.describe('metric chart', function indexPatternCreation() { + bdd.describe('metric chart', function indexPatternCreation() { - bdd.it('should show Count', function pageHeader() { - var expectedCount = ['14,004', 'Count']; + bdd.it('should show Count', function pageHeader() { + var expectedCount = ['14,004', 'Count']; - // initial metric of "Count" is selected by default - return common.try(function tryingForTime() { - return visualizePage.getMetric() - .then(function (metricValue) { - expect(expectedCount).to.eql(metricValue.split('\n')); - }); - }); + // initial metric of "Count" is selected by default + return common.try(function tryingForTime() { + return visualizePage.getMetric() + .then(function (metricValue) { + expect(expectedCount).to.eql(metricValue.split('\n')); }); + }); + }); - bdd.it('should show Average', function pageHeader() { - var avgMachineRam = ['13,104,036,080.615', 'Average machine.ram']; - return visualizePage.clickMetricEditor() - .then(function () { - common.debug('Aggregation = Average'); - return visualizePage.selectAggregation('Average'); - }) - .then(function selectField() { - common.debug('Field = machine.ram'); - return visualizePage.selectField('machine.ram'); - }) - .then(function clickGo() { - return visualizePage.clickGo(); - }) - .then(function () { - return common.try(function tryingForTime() { - return visualizePage.getMetric() - .then(function (metricValue) { - expect(avgMachineRam).to.eql(metricValue.split('\n')); - }); + bdd.it('should show Average', function pageHeader() { + var avgMachineRam = ['13,104,036,080.615', 'Average machine.ram']; + return visualizePage.clickMetricEditor() + .then(function () { + common.debug('Aggregation = Average'); + return visualizePage.selectAggregation('Average'); + }) + .then(function selectField() { + common.debug('Field = machine.ram'); + return visualizePage.selectField('machine.ram'); + }) + .then(function clickGo() { + return visualizePage.clickGo(); + }) + .then(function () { + return common.try(function tryingForTime() { + return visualizePage.getMetric() + .then(function (metricValue) { + expect(avgMachineRam).to.eql(metricValue.split('\n')); }); - }) - .catch(common.handleError(this)); }); + }) + .catch(common.handleError(this)); + }); - bdd.it('should show Sum', function pageHeader() { - var sumPhpMemory = ['85,865,880', 'Sum of phpmemory']; - common.debug('Aggregation = Sum'); - return visualizePage.selectAggregation('Sum') - .then(function selectField() { - common.debug('Field = phpmemory'); - return visualizePage.selectField('phpmemory'); - }) - .then(function clickGo() { - return visualizePage.clickGo(); - }) - .then(function () { - return common.try(function tryingForTime() { - return visualizePage.getMetric() - .then(function (metricValue) { - expect(sumPhpMemory).to.eql(metricValue.split('\n')); - }); + bdd.it('should show Sum', function pageHeader() { + var sumPhpMemory = ['85,865,880', 'Sum of phpmemory']; + common.debug('Aggregation = Sum'); + return visualizePage.selectAggregation('Sum') + .then(function selectField() { + common.debug('Field = phpmemory'); + return visualizePage.selectField('phpmemory'); + }) + .then(function clickGo() { + return visualizePage.clickGo(); + }) + .then(function () { + return common.try(function tryingForTime() { + return visualizePage.getMetric() + .then(function (metricValue) { + expect(sumPhpMemory).to.eql(metricValue.split('\n')); }); - }) - .catch(common.handleError(this)); }); + }) + .catch(common.handleError(this)); + }); - bdd.it('should show Median', function pageHeader() { - var medianBytes = ['5,565.263', '50th percentile of bytes']; - // For now, only comparing the text label part of the metric - common.debug('Aggregation = Median'); - return visualizePage.selectAggregation('Median') - .then(function selectField() { - common.debug('Field = bytes'); - return visualizePage.selectField('bytes'); - }) - .then(function clickGo() { - return visualizePage.clickGo(); - }) - .then(function () { - return common.try(function tryingForTime() { - return visualizePage.getMetric() - .then(function (metricValue) { - // only comparing the text label! - expect(medianBytes[1]).to.eql(metricValue.split('\n')[1]); - }); + bdd.it('should show Median', function pageHeader() { + var medianBytes = ['5,565.263', '50th percentile of bytes']; + // For now, only comparing the text label part of the metric + common.debug('Aggregation = Median'); + return visualizePage.selectAggregation('Median') + .then(function selectField() { + common.debug('Field = bytes'); + return visualizePage.selectField('bytes'); + }) + .then(function clickGo() { + return visualizePage.clickGo(); + }) + .then(function () { + return common.try(function tryingForTime() { + return visualizePage.getMetric() + .then(function (metricValue) { + // only comparing the text label! + expect(medianBytes[1]).to.eql(metricValue.split('\n')[1]); }); - }) - .catch(common.handleError(this)); }); + }) + .catch(common.handleError(this)); + }); - bdd.it('should show Min', function pageHeader() { - var minTimestamp = ['September 20th 2015, 00:00:00.000', 'Min @timestamp']; - common.debug('Aggregation = Min'); - return visualizePage.selectAggregation('Min') - .then(function selectField() { - common.debug('Field = @timestamp'); - return visualizePage.selectField('@timestamp'); - }) - .then(function clickGo() { - return visualizePage.clickGo(); - }) - .then(function () { - return common.try(function tryingForTime() { - return visualizePage.getMetric() - .then(function (metricValue) { - expect(minTimestamp).to.eql(metricValue.split('\n')); - }); + bdd.it('should show Min', function pageHeader() { + var minTimestamp = ['September 20th 2015, 00:00:00.000', 'Min @timestamp']; + common.debug('Aggregation = Min'); + return visualizePage.selectAggregation('Min') + .then(function selectField() { + common.debug('Field = @timestamp'); + return visualizePage.selectField('@timestamp'); + }) + .then(function clickGo() { + return visualizePage.clickGo(); + }) + .then(function () { + return common.try(function tryingForTime() { + return visualizePage.getMetric() + .then(function (metricValue) { + expect(minTimestamp).to.eql(metricValue.split('\n')); }); - }) - .catch(common.handleError(this)); }); + }) + .catch(common.handleError(this)); + }); - bdd.it('should show Max', function pageHeader() { - var maxRelatedContentArticleModifiedTime = ['April 4th 2015, 00:54:41.000', 'Max relatedContent.article:modified_time']; - common.debug('Aggregation = Max'); - return visualizePage.selectAggregation('Max') - .then(function selectField() { - common.debug('Field = relatedContent.article:modified_time'); - return visualizePage.selectField('relatedContent.article:modified_time'); - }) - .then(function clickGo() { - return visualizePage.clickGo(); - }) - .then(function () { - return common.try(function tryingForTime() { - return visualizePage.getMetric() - .then(function (metricValue) { - expect(maxRelatedContentArticleModifiedTime).to.eql(metricValue.split('\n')); - }); + bdd.it('should show Max', function pageHeader() { + var maxRelatedContentArticleModifiedTime = ['April 4th 2015, 00:54:41.000', 'Max relatedContent.article:modified_time']; + common.debug('Aggregation = Max'); + return visualizePage.selectAggregation('Max') + .then(function selectField() { + common.debug('Field = relatedContent.article:modified_time'); + return visualizePage.selectField('relatedContent.article:modified_time'); + }) + .then(function clickGo() { + return visualizePage.clickGo(); + }) + .then(function () { + return common.try(function tryingForTime() { + return visualizePage.getMetric() + .then(function (metricValue) { + expect(maxRelatedContentArticleModifiedTime).to.eql(metricValue.split('\n')); }); - }) - .catch(common.handleError(this)); }); + }) + .catch(common.handleError(this)); + }); - bdd.it('should show Standard Deviation', function pageHeader() { - var standardDeviationBytes = [ - '-1,435.138', 'Lower Standard Deviation of bytes', - '5,727.314', 'Average of bytes', - '12,889.766', 'Upper Standard Deviation of bytes' - ]; - common.debug('Aggregation = Standard Deviation'); - return visualizePage.selectAggregation('Standard Deviation') - .then(function selectField() { - common.debug('Field = bytes'); - return visualizePage.selectField('bytes'); - }) - .then(function clickGo() { - return visualizePage.clickGo(); - }) - .then(function () { - return common.try(function tryingForTime() { - return visualizePage.getMetric() - .then(function (metricValue) { - expect(standardDeviationBytes).to.eql(metricValue.split('\n')); - }); + bdd.it('should show Standard Deviation', function pageHeader() { + var standardDeviationBytes = [ + '-1,435.138', 'Lower Standard Deviation of bytes', + '5,727.314', 'Average of bytes', + '12,889.766', 'Upper Standard Deviation of bytes' + ]; + common.debug('Aggregation = Standard Deviation'); + return visualizePage.selectAggregation('Standard Deviation') + .then(function selectField() { + common.debug('Field = bytes'); + return visualizePage.selectField('bytes'); + }) + .then(function clickGo() { + return visualizePage.clickGo(); + }) + .then(function () { + return common.try(function tryingForTime() { + return visualizePage.getMetric() + .then(function (metricValue) { + expect(standardDeviationBytes).to.eql(metricValue.split('\n')); }); - }) - .catch(common.handleError(this)); }); + }) + .catch(common.handleError(this)); + }); - bdd.it('should show Unique Count', function pageHeader() { - var uniqueCountClientip = ['1,000', 'Unique count of clientip']; - common.debug('Aggregation = Unique Count'); - return visualizePage.selectAggregation('Unique Count') - .then(function selectField() { - common.debug('Field = clientip'); - return visualizePage.selectField('clientip'); - }) - .then(function clickGo() { - return visualizePage.clickGo(); - }) - .then(function () { - return common.try(function tryingForTime() { - return visualizePage.getMetric() - .then(function (metricValue) { - expect(uniqueCountClientip).to.eql(metricValue.split('\n')); - }); + bdd.it('should show Unique Count', function pageHeader() { + var uniqueCountClientip = ['1,000', 'Unique count of clientip']; + common.debug('Aggregation = Unique Count'); + return visualizePage.selectAggregation('Unique Count') + .then(function selectField() { + common.debug('Field = clientip'); + return visualizePage.selectField('clientip'); + }) + .then(function clickGo() { + return visualizePage.clickGo(); + }) + .then(function () { + return common.try(function tryingForTime() { + return visualizePage.getMetric() + .then(function (metricValue) { + expect(uniqueCountClientip).to.eql(metricValue.split('\n')); }); - }) - .then(function () { - return visualizePage.getMetric() - .then(function (metricValue) { - common.debug('metricValue=' + metricValue.split('\n')); - expect(uniqueCountClientip).to.eql(metricValue.split('\n')); - }); - }) - .catch(common.handleError(this)); }); + }) + .then(function () { + return visualizePage.getMetric() + .then(function (metricValue) { + common.debug('metricValue=' + metricValue.split('\n')); + expect(uniqueCountClientip).to.eql(metricValue.split('\n')); + }); + }) + .catch(common.handleError(this)); + }); - bdd.it('should show Percentiles', function pageHeader() { - var percentileMachineRam = [ - '2,147,483,648', '1st percentile of machine.ram', - '3,221,225,472', '5th percentile of machine.ram', - '7,516,192,768', '25th percentile of machine.ram', - '12,884,901,888', '50th percentile of machine.ram', - '18,253,611,008', '75th percentile of machine.ram', - '32,212,254,720', '95th percentile of machine.ram', - '32,212,254,720', '99th percentile of machine.ram' - ]; + bdd.it('should show Percentiles', function pageHeader() { + var percentileMachineRam = [ + '2,147,483,648', '1st percentile of machine.ram', + '3,221,225,472', '5th percentile of machine.ram', + '7,516,192,768', '25th percentile of machine.ram', + '12,884,901,888', '50th percentile of machine.ram', + '18,253,611,008', '75th percentile of machine.ram', + '32,212,254,720', '95th percentile of machine.ram', + '32,212,254,720', '99th percentile of machine.ram' + ]; - common.debug('Aggregation = Percentiles'); - return visualizePage.selectAggregation('Percentiles') - .then(function selectField() { - common.debug('Field = machine.ram'); - return visualizePage.selectField('machine.ram'); - }) - .then(function clickGo() { - return visualizePage.clickGo(); - }) - .then(function () { - return common.try(function tryingForTime() { - return visualizePage.getMetric() - .then(function (metricValue) { - expect(percentileMachineRam).to.eql(metricValue.split('\n')); - }); + common.debug('Aggregation = Percentiles'); + return visualizePage.selectAggregation('Percentiles') + .then(function selectField() { + common.debug('Field = machine.ram'); + return visualizePage.selectField('machine.ram'); + }) + .then(function clickGo() { + return visualizePage.clickGo(); + }) + .then(function () { + return common.try(function tryingForTime() { + return visualizePage.getMetric() + .then(function (metricValue) { + expect(percentileMachineRam).to.eql(metricValue.split('\n')); }); - }) - .catch(common.handleError(this)); }); + }) + .catch(common.handleError(this)); + }); - bdd.it('should show Percentile Ranks', function pageHeader() { - var percentileRankBytes = [ '2.036%', 'Percentile rank 99 of "memory"']; - common.debug('Aggregation = Percentile Ranks'); - return visualizePage.selectAggregation('Percentile Ranks') - .then(function selectField() { - common.debug('Field = bytes'); - return visualizePage.selectField('memory'); - }) - .then(function selectField() { - common.debug('Values = 99'); - return visualizePage.setValue('99'); - }) - .then(function clickGo() { - return visualizePage.clickGo(); - }) - .then(function () { - return common.try(function tryingForTime() { - return visualizePage.getMetric() - .then(function (metricValue) { - expect(percentileRankBytes).to.eql(metricValue.split('\n')); - }); + bdd.it('should show Percentile Ranks', function pageHeader() { + var percentileRankBytes = [ '2.036%', 'Percentile rank 99 of "memory"']; + common.debug('Aggregation = Percentile Ranks'); + return visualizePage.selectAggregation('Percentile Ranks') + .then(function selectField() { + common.debug('Field = bytes'); + return visualizePage.selectField('memory'); + }) + .then(function selectField() { + common.debug('Values = 99'); + return visualizePage.setValue('99'); + }) + .then(function clickGo() { + return visualizePage.clickGo(); + }) + .then(function () { + return common.try(function tryingForTime() { + return visualizePage.getMetric() + .then(function (metricValue) { + expect(percentileRankBytes).to.eql(metricValue.split('\n')); }); - }) - .catch(common.handleError(this)); }); - - }); + }) + .catch(common.handleError(this)); }); - }()); -}()); + + }); +}); diff --git a/test/functional/apps/visualize/_pie_chart.js b/test/functional/apps/visualize/_pie_chart.js index aa17a7966c8e1a..7b06e4c433cb9a 100644 --- a/test/functional/apps/visualize/_pie_chart.js +++ b/test/functional/apps/visualize/_pie_chart.js @@ -7,129 +7,125 @@ import { visualizePage } from '../../../support'; -(function () { - var expect = require('expect.js'); +var expect = require('expect.js'); - (function () { - bdd.describe('visualize app', function describeIndexTests() { - bdd.before(function () { - var fromTime = '2015-09-19 06:31:44.000'; - var toTime = '2015-09-23 18:31:44.000'; +bdd.describe('visualize app', function describeIndexTests() { + bdd.before(function () { + var fromTime = '2015-09-19 06:31:44.000'; + var toTime = '2015-09-23 18:31:44.000'; - common.debug('navigateToApp visualize'); - return common.navigateToApp('visualize') - .then(function () { - common.debug('clickPieChart'); - return visualizePage.clickPieChart(); - }) - .then(function clickNewSearch() { - return visualizePage.clickNewSearch(); - }) - .then(function setAbsoluteRange() { - common.debug('Set absolute time range from \"' + fromTime + '\" to \"' + toTime + '\"'); - return headerPage.setAbsoluteRange(fromTime, toTime); - }) - .then(function () { - common.debug('select bucket Split Slices'); - return visualizePage.clickBucket('Split Slices'); - }) - .then(function () { - common.debug('Click aggregation Histogram'); - return visualizePage.selectAggregation('Histogram'); - }) - .then(function () { - common.debug('Click field memory'); - return visualizePage.selectField('memory'); - }) - .then(function () { - return headerPage.getSpinnerDone(); - }) - .then(function sleep() { - return common.sleep(1003); - }) - .then(function () { - common.debug('setNumericInterval 4000'); - return visualizePage.setNumericInterval('40000'); - }) - .then(function () { - common.debug('clickGo'); - return visualizePage.clickGo(); - }) - .then(function () { - return headerPage.getSpinnerDone(); - }); - }); + common.debug('navigateToApp visualize'); + return common.navigateToApp('visualize') + .then(function () { + common.debug('clickPieChart'); + return visualizePage.clickPieChart(); + }) + .then(function clickNewSearch() { + return visualizePage.clickNewSearch(); + }) + .then(function setAbsoluteRange() { + common.debug('Set absolute time range from \"' + fromTime + '\" to \"' + toTime + '\"'); + return headerPage.setAbsoluteRange(fromTime, toTime); + }) + .then(function () { + common.debug('select bucket Split Slices'); + return visualizePage.clickBucket('Split Slices'); + }) + .then(function () { + common.debug('Click aggregation Histogram'); + return visualizePage.selectAggregation('Histogram'); + }) + .then(function () { + common.debug('Click field memory'); + return visualizePage.selectField('memory'); + }) + .then(function () { + return headerPage.getSpinnerDone(); + }) + .then(function sleep() { + return common.sleep(1003); + }) + .then(function () { + common.debug('setNumericInterval 4000'); + return visualizePage.setNumericInterval('40000'); + }) + .then(function () { + common.debug('clickGo'); + return visualizePage.clickGo(); + }) + .then(function () { + return headerPage.getSpinnerDone(); + }); + }); - bdd.describe('pie chart', function indexPatternCreation() { - var testSubName = 'PieChart'; - var vizName1 = 'Visualization ' + testSubName; + bdd.describe('pie chart', function indexPatternCreation() { + var testSubName = 'PieChart'; + var vizName1 = 'Visualization ' + testSubName; - bdd.it('should save and load', function pageHeader() { - common.debug('Start of test' + testSubName + 'Visualization'); - var remote = this.remote; + bdd.it('should save and load', function pageHeader() { + common.debug('Start of test' + testSubName + 'Visualization'); + var remote = this.remote; - return visualizePage.saveVisualization(vizName1) - .then(function (message) { - 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() { - return visualizePage.waitForVisualization(); - }) - // sleep a bit before trying to get the pie chart data below - .then(function sleep() { - return common.sleep(2000); - }) - .catch(common.handleError(this)); - }); + return visualizePage.saveVisualization(vizName1) + .then(function (message) { + 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() { + return visualizePage.waitForVisualization(); + }) + // 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() { - var remote = this.remote; - var expectedPieChartSliceCount = 10; + 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'); - }) - .catch(common.handleError(this)); - }); + 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'); + }) + .catch(common.handleError(this)); + }); - bdd.it('should show correct data', function pageHeader() { - var remote = this.remote; - var expectedTableData = [ '0 55', '40,000 50', '80,000 41', '120,000 43', - '160,000 44', '200,000 40', '240,000 46', '280,000 39', '320,000 40', '360,000 47' - ]; + bdd.it('should show correct data', function pageHeader() { + var remote = this.remote; + var expectedTableData = [ '0 55', '40,000 50', '80,000 41', '120,000 43', + '160,000 44', '200,000 40', '240,000 46', '280,000 39', '320,000 40', '360,000 47' + ]; - return visualizePage.collapseChart() - .then(function () { - return settingsPage.setPageSize('All'); - }) - .then(function getDataTableData() { - return visualizePage.getDataTableData(); - }) - .then(function showData(data) { - common.debug(data.split('\n')); - expect(data.trim().split('\n')).to.eql(expectedTableData); - }) - .catch(common.handleError(this)); - }); + return visualizePage.collapseChart() + .then(function () { + return settingsPage.setPageSize('All'); + }) + .then(function getDataTableData() { + return visualizePage.getDataTableData(); + }) + .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 32bc6e33b25f32..dd7b2c0471e365 100644 --- a/test/functional/apps/visualize/_tile_map.js +++ b/test/functional/apps/visualize/_tile_map.js @@ -7,114 +7,110 @@ import { visualizePage } from '../../../support'; -(function () { - var expect = require('expect.js'); +var expect = require('expect.js'); - (function () { - bdd.describe('visualize app', function describeIndexTests() { - var fromTime = '2015-09-19 06:31:44.000'; - var toTime = '2015-09-23 18:31:44.000'; +bdd.describe('visualize app', function describeIndexTests() { + var fromTime = '2015-09-19 06:31:44.000'; + var toTime = '2015-09-23 18:31:44.000'; - bdd.before(function () { + bdd.before(function () { - common.debug('navigateToApp visualize'); - return common.navigateToApp('visualize') - .then(function () { - common.debug('clickTileMap'); - return visualizePage.clickTileMap(); - }) - .then(function () { - return visualizePage.clickNewSearch(); - }) - .then(function () { - common.debug('Set absolute time range from \"' + fromTime + '\" to \"' + toTime + '\"'); - return headerPage.setAbsoluteRange(fromTime, toTime); - }) - .then(function () { - common.debug('select bucket Geo Coordinates'); - return visualizePage.clickBucket('Geo Coordinates'); - }) - .then(function () { - common.debug('Click aggregation Geohash'); - return visualizePage.selectAggregation('Geohash'); - }) - .then(function () { - common.debug('Click field geo.coordinates'); - return common.try(function tryingForTime() { - return visualizePage.selectField('geo.coordinates'); - }); - }) - .then(function () { - return visualizePage.clickGo(); - }) - .then(function () { - return headerPage.getSpinnerDone(); - }) - .catch(common.handleError(this)); + common.debug('navigateToApp visualize'); + return common.navigateToApp('visualize') + .then(function () { + common.debug('clickTileMap'); + return visualizePage.clickTileMap(); + }) + .then(function () { + return visualizePage.clickNewSearch(); + }) + .then(function () { + common.debug('Set absolute time range from \"' + fromTime + '\" to \"' + toTime + '\"'); + return headerPage.setAbsoluteRange(fromTime, toTime); + }) + .then(function () { + common.debug('select bucket Geo Coordinates'); + return visualizePage.clickBucket('Geo Coordinates'); + }) + .then(function () { + common.debug('Click aggregation Geohash'); + return visualizePage.selectAggregation('Geohash'); + }) + .then(function () { + common.debug('Click field geo.coordinates'); + return common.try(function tryingForTime() { + return visualizePage.selectField('geo.coordinates'); }); + }) + .then(function () { + return visualizePage.clickGo(); + }) + .then(function () { + return headerPage.getSpinnerDone(); + }) + .catch(common.handleError(this)); + }); - bdd.describe('tile map chart', function indexPatternCreation() { + bdd.describe('tile map chart', function indexPatternCreation() { - bdd.it('should save and load, take screenshot', function pageHeader() { - var testSubName = 'TileMap'; - common.debug('Start of test' + testSubName + 'Visualization'); - var vizName1 = 'Visualization ' + testSubName; - // var remote = this.remote; + bdd.it('should save and load, take screenshot', function pageHeader() { + var testSubName = 'TileMap'; + common.debug('Start of test' + testSubName + 'Visualization'); + var vizName1 = 'Visualization ' + testSubName; + // var remote = this.remote; - return visualizePage.saveVisualization(vizName1) - .then(function (message) { - 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() { - return visualizePage.waitForVisualization(); - }) - // sleep a bit before taking the screenshot or it won't show data - .then(function sleep() { - return common.sleep(4000); - }) - .then(function takeScreenshot() { - common.debug('Take screenshot'); - common.saveScreenshot('./screenshot-' + testSubName + '.png'); - }) - .catch(common.handleError(this)); - }); + return visualizePage.saveVisualization(vizName1) + .then(function (message) { + 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() { + return visualizePage.waitForVisualization(); + }) + // sleep a bit before taking the screenshot or it won't show data + .then(function sleep() { + return common.sleep(4000); + }) + .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() { - var testSubName = 'TileMap'; - common.debug('Start of test' + testSubName + 'Visualization'); - // var remote = this.remote; - var expectedTableData = [ 'dn 1,429', 'dp 1,418', '9y 1,215', '9z 1,099', 'dr 1,076', - 'dj 982', '9v 938', '9q 722', '9w 475', 'cb 457', 'c2 453', '9x 420', 'dq 399', - '9r 396', '9t 274', 'c8 271', 'dh 214', 'b6 207', 'bd 206', 'b7 167', 'f0 141', - 'be 128', '9m 126', 'bf 85', 'de 73', 'bg 71', '9p 71', 'c1 57', 'c4 50', '9u 48', - 'f2 46', '8e 45', 'b3 38', 'bs 36', 'c0 31', '87 28', 'bk 23', '8f 18', 'b5 14', - '84 14', 'dx 9', 'bu 9', 'b1 9', 'b4 6', '9n 3', '8g 3' - ]; + bdd.it('should show correct tile map data', function pageHeader() { + var testSubName = 'TileMap'; + common.debug('Start of test' + testSubName + 'Visualization'); + // var remote = this.remote; + var expectedTableData = [ 'dn 1,429', 'dp 1,418', '9y 1,215', '9z 1,099', 'dr 1,076', + 'dj 982', '9v 938', '9q 722', '9w 475', 'cb 457', 'c2 453', '9x 420', 'dq 399', + '9r 396', '9t 274', 'c8 271', 'dh 214', 'b6 207', 'bd 206', 'b7 167', 'f0 141', + 'be 128', '9m 126', 'bf 85', 'de 73', 'bg 71', '9p 71', 'c1 57', 'c4 50', '9u 48', + 'f2 46', '8e 45', 'b3 38', 'bs 36', 'c0 31', '87 28', 'bk 23', '8f 18', 'b5 14', + '84 14', 'dx 9', 'bu 9', 'b1 9', 'b4 6', '9n 3', '8g 3' + ]; - return visualizePage.collapseChart() - .then(function () { - return settingsPage.setPageSize('All'); - }) - .then(function getDataTableData() { - return visualizePage.getDataTableData() - .then(function showData(data) { - common.debug(data.split('\n')); - expect(data.trim().split('\n')).to.eql(expectedTableData); - }); - }) - .catch(common.handleError(this)); + return visualizePage.collapseChart() + .then(function () { + return settingsPage.setPageSize('All'); + }) + .then(function getDataTableData() { + return visualizePage.getDataTableData() + .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/_vertical_bar_chart.js b/test/functional/apps/visualize/_vertical_bar_chart.js index 81b362f68bd909..4e5586397e884d 100644 --- a/test/functional/apps/visualize/_vertical_bar_chart.js +++ b/test/functional/apps/visualize/_vertical_bar_chart.js @@ -7,135 +7,125 @@ import { visualizePage } from '../../../support'; -(function () { - var expect = require('expect.js'); - - (function () { - bdd.describe('visualize app', function describeIndexTests() { - var fromTime = '2015-09-19 06:31:44.000'; - var toTime = '2015-09-23 18:31:44.000'; - - bdd.before(function () { - common.debug('navigateToApp visualize'); - return common.navigateToApp('visualize') - .then(function () { - common.debug('clickVerticalBarChart'); - return visualizePage.clickVerticalBarChart(); - }) - .then(function clickNewSearch() { - return visualizePage.clickNewSearch(); - }) - .then(function setAbsoluteRange() { - common.debug('Set absolute time range from \"' + fromTime + '\" to \"' + toTime + '\"'); - return headerPage.setAbsoluteRange(fromTime, toTime); - }) - .then(function clickBucket() { - common.debug('Bucket = X-Axis'); - return visualizePage.clickBucket('X-Axis'); - }) - .then(function selectAggregation() { - common.debug('Aggregation = Date Histogram'); - return visualizePage.selectAggregation('Date Histogram'); - }) - .then(function selectField() { - common.debug('Field = @timestamp'); - return visualizePage.selectField('@timestamp'); - }) - // leaving Interval set to Auto - .then(function clickGo() { - return visualizePage.clickGo(); - }) - .then(function () { - return headerPage.getSpinnerDone(); // only matches the hidden spinner - }) - .then(function waitForVisualization() { - return visualizePage.waitForVisualization(); - }); - }); - - bdd.describe('vertical bar chart', function indexPatternCreation() { - var testSubName = 'VerticalBarChart'; - 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); - expect(message).to.be('Visualization Editor: Saved Visualization \"' + vizName1 + '\"'); - }) - .then(function testVisualizeWaitForToastMessageGone() { - return visualizePage.waitForToastMessageGone(); - }) - .then(function () { - return visualizePage.loadSavedVisualization(vizName1); - }) - .then(function () { - return headerPage.getSpinnerDone(); // only matches the hidden spinner - }) - .then(function waitForVisualization() { - return visualizePage.waitForVisualization(); - }) - .catch(common.handleError(this)); - }); - - - bdd.it('should show correct chart, take screenshot', function pageHeader() { - - var expectedChartValues = [37, 202, 740, 1437, 1371, 751, 188, 31, 42, 202, 683, - 1361, 1415, 707, 177, 27, 32, 175, 707, 1408, 1355, 726, 201, 29 - ]; - - // Most recent failure on Jenkins usually indicates the bar chart is still being drawn? - // return arguments[0].getAttribute(arguments[1]);","args":[{"ELEMENT":"592"},"fill"]}] arguments[0].getAttribute is not a function - // try sleeping a bit before getting that data - return common.sleep(5000) - .then(function () { - return visualizePage.getBarChartData(); - }) - .then(function showData(data) { - common.debug('data=' + data); - common.debug('data.length=' + data.length); - expect(data).to.eql(expectedChartValues); - }) - .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 testSubName = 'VerticalBarChart'; - // this is only the first page of the tabular data. - var expectedChartData = [ 'September 20th 2015, 00:00:00.000 37', - 'September 20th 2015, 03:00:00.000 202', - 'September 20th 2015, 06:00:00.000 740', - 'September 20th 2015, 09:00:00.000 1,437', - 'September 20th 2015, 12:00:00.000 1,371', - 'September 20th 2015, 15:00:00.000 751', - 'September 20th 2015, 18:00:00.000 188', - 'September 20th 2015, 21:00:00.000 31', - 'September 21st 2015, 00:00:00.000 42', - 'September 21st 2015, 03:00:00.000 202' - ]; +var expect = require('expect.js'); + +bdd.describe('visualize app', function describeIndexTests() { + var fromTime = '2015-09-19 06:31:44.000'; + var toTime = '2015-09-23 18:31:44.000'; + + bdd.before(function () { + common.debug('navigateToApp visualize'); + return common.navigateToApp('visualize') + .then(function () { + common.debug('clickVerticalBarChart'); + return visualizePage.clickVerticalBarChart(); + }) + .then(function clickNewSearch() { + return visualizePage.clickNewSearch(); + }) + .then(function setAbsoluteRange() { + common.debug('Set absolute time range from \"' + fromTime + '\" to \"' + toTime + '\"'); + return headerPage.setAbsoluteRange(fromTime, toTime); + }) + .then(function clickBucket() { + common.debug('Bucket = X-Axis'); + return visualizePage.clickBucket('X-Axis'); + }) + .then(function selectAggregation() { + common.debug('Aggregation = Date Histogram'); + return visualizePage.selectAggregation('Date Histogram'); + }) + .then(function selectField() { + common.debug('Field = @timestamp'); + return visualizePage.selectField('@timestamp'); + }) + // leaving Interval set to Auto + .then(function clickGo() { + return visualizePage.clickGo(); + }) + .then(function () { + return headerPage.getSpinnerDone(); // only matches the hidden spinner + }) + .then(function waitForVisualization() { + return visualizePage.waitForVisualization(); + }); + }); + + bdd.describe('vertical bar chart', function indexPatternCreation() { + var testSubName = 'VerticalBarChart'; + 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); + expect(message).to.be('Visualization Editor: Saved Visualization \"' + vizName1 + '\"'); + }) + .then(function testVisualizeWaitForToastMessageGone() { + return visualizePage.waitForToastMessageGone(); + }) + .then(function () { + return visualizePage.loadSavedVisualization(vizName1); + }) + .then(function () { + return headerPage.getSpinnerDone(); // only matches the hidden spinner + }) + .then(function waitForVisualization() { + return visualizePage.waitForVisualization(); + }) + .catch(common.handleError(this)); + }); - return visualizePage.collapseChart() - .then(function showData(data) { - return visualizePage.getDataTableData(); - }) - .then(function showData(data) { - common.debug(data.split('\n')); - expect(data.trim().split('\n')).to.eql(expectedChartData); - }) - .catch(common.handleError(this)); - }); + bdd.it('should show correct chart, take screenshot', function pageHeader() { + var expectedChartValues = [37, 202, 740, 1437, 1371, 751, 188, 31, 42, 202, 683, + 1361, 1415, 707, 177, 27, 32, 175, 707, 1408, 1355, 726, 201, 29 + ]; + + // Most recent failure on Jenkins usually indicates the bar chart is still being drawn? + // return arguments[0].getAttribute(arguments[1]);","args":[{"ELEMENT":"592"},"fill"]}] arguments[0].getAttribute is not a function + // try sleeping a bit before getting that data + return common.sleep(5000) + .then(function () { + return visualizePage.getBarChartData(); + }) + .then(function showData(data) { + common.debug('data=' + data); + common.debug('data.length=' + data.length); + expect(data).to.eql(expectedChartValues); + }) + .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 testSubName = 'VerticalBarChart'; + // this is only the first page of the tabular data. + var expectedChartData = [ 'September 20th 2015, 00:00:00.000 37', + 'September 20th 2015, 03:00:00.000 202', + 'September 20th 2015, 06:00:00.000 740', + 'September 20th 2015, 09:00:00.000 1,437', + 'September 20th 2015, 12:00:00.000 1,371', + 'September 20th 2015, 15:00:00.000 751', + 'September 20th 2015, 18:00:00.000 188', + 'September 20th 2015, 21:00:00.000 31', + 'September 21st 2015, 00:00:00.000 42', + 'September 21st 2015, 03:00:00.000 202' + ]; + + return visualizePage.collapseChart() + .then(function showData(data) { + return visualizePage.getDataTableData(); + }) + .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 e02ce4c51f01de..ac4a12b95aa001 100644 --- a/test/functional/apps/visualize/index.js +++ b/test/functional/apps/visualize/index.js @@ -8,36 +8,34 @@ import { elasticDump } from '../../../support'; -(function () { - bdd.describe('visualize app', function () { - this.timeout = defaultTimeout; +bdd.describe('visualize app', function () { + this.timeout = defaultTimeout; - bdd.before(function () { - var self = this; - remote.setWindowSize(1200,800); + bdd.before(function () { + var self = this; + remote.setWindowSize(1200,800); - common.debug('Starting visualize before method'); - var logstash = scenarioManager.loadIfEmpty('logstashFunctional'); - // delete .kibana index and update configDoc - return esClient.deleteAndUpdateConfigDoc({'dateFormat:tz':'UTC', 'defaultIndex':'logstash-*'}) - .then(function loadkibanaIndexPattern() { - common.debug('load kibana index with default index pattern'); - return elasticDump.elasticLoad('visualize','.kibana'); - }) - // wait for the logstash data load to finish if it hasn't already - .then(function () { - return logstash; - }) - .catch(common.handleError(this)); - }); - - require('./_chart_types'); - require('./_area_chart'); - require('./_line_chart'); - require('./_data_table'); - require('./_metric_chart'); - require('./_pie_chart'); - require('./_tile_map'); - require('./_vertical_bar_chart'); + common.debug('Starting visualize before method'); + var logstash = scenarioManager.loadIfEmpty('logstashFunctional'); + // delete .kibana index and update configDoc + return esClient.deleteAndUpdateConfigDoc({'dateFormat:tz':'UTC', 'defaultIndex':'logstash-*'}) + .then(function loadkibanaIndexPattern() { + common.debug('load kibana index with default index pattern'); + return elasticDump.elasticLoad('visualize','.kibana'); + }) + // wait for the logstash data load to finish if it hasn't already + .then(function () { + return logstash; + }) + .catch(common.handleError(this)); }); -}()); + + require('./_chart_types'); + require('./_area_chart'); + require('./_line_chart'); + require('./_data_table'); + require('./_metric_chart'); + require('./_pie_chart'); + require('./_tile_map'); + require('./_vertical_bar_chart'); +}); diff --git a/test/functional/status_page/index.js b/test/functional/status_page/index.js index 79a440c8d80b19..492e1742a56bea 100644 --- a/test/functional/status_page/index.js +++ b/test/functional/status_page/index.js @@ -1,25 +1,23 @@ import { bdd, common } from '../../support'; -(function () { - var expect = require('expect.js'); +var expect = require('expect.js'); - bdd.describe('status page', function () { - bdd.before(function () { - return common.navigateToApp('status_page', false); - }); +bdd.describe('status page', function () { + bdd.before(function () { + return common.navigateToApp('status_page', false); + }); - bdd.it('should show the kibana plugin as ready', function () { - var self = this; + bdd.it('should show the kibana plugin as ready', function () { + var self = this; - return common.tryForTime(6000, function () { - return self.remote - .findByCssSelector('.plugin_status_breakdown') - .getVisibleText() - .then(function (text) { - expect(text.indexOf('kibana 1.0.0 Ready')).to.be.above(-1); - }); - }) - .catch(common.handleError(self)); - }); + return common.tryForTime(6000, function () { + return self.remote + .findByCssSelector('.plugin_status_breakdown') + .getVisibleText() + .then(function (text) { + expect(text.indexOf('kibana 1.0.0 Ready')).to.be.above(-1); + }); + }) + .catch(common.handleError(self)); }); -}()); +});