Skip to content

Commit

Permalink
Merge pull request #7434 from spalger/transform/removeFunctionalIIFEW…
Browse files Browse the repository at this point in the history
…rappers

[functional tests] remove extra IIFE wappers
  • Loading branch information
spalger authored Jun 12, 2016
2 parents a80287f + ac00863 commit 8294487
Show file tree
Hide file tree
Showing 26 changed files with 2,265 additions and 2,387 deletions.
90 changes: 42 additions & 48 deletions test/functional/apps/console/_console.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
});
});
16 changes: 7 additions & 9 deletions test/functional/apps/console/index.js
Original file line number Diff line number Diff line change
@@ -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');
});
218 changes: 103 additions & 115 deletions test/functional/apps/dashboard/_dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
});
}());
}());
});
});
16 changes: 7 additions & 9 deletions test/functional/apps/dashboard/index.js
Original file line number Diff line number Diff line change
@@ -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');
});
Loading

0 comments on commit 8294487

Please sign in to comment.