mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
A couple of simple console tests to make sure its there and works.
This commit is contained in:
parent
9f5fc16f62
commit
ee3119e678
8 changed files with 166 additions and 4 deletions
68
test/functional/apps/console/_console.js
Normal file
68
test/functional/apps/console/_console.js
Normal file
|
@ -0,0 +1,68 @@
|
|||
import {
|
||||
bdd,
|
||||
scenarioManager,
|
||||
common,
|
||||
// settingsPage,
|
||||
// headerPage,
|
||||
consolePage
|
||||
} from '../../../support';
|
||||
|
||||
(function () {
|
||||
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.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 reponse should contain .kibana' , function () {
|
||||
var expectedResponseContains = '"_index": ".kibana",';
|
||||
var elasticsearch = common.getEsHostPort();
|
||||
return consolePage.setServer(elasticsearch)
|
||||
.then(function () {
|
||||
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));
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
||||
}());
|
||||
}());
|
17
test/functional/apps/console/index.js
Normal file
17
test/functional/apps/console/index.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
import { bdd, remote, scenarioManager, defaultTimeout } from '../../../support';
|
||||
|
||||
(function () {
|
||||
bdd.describe('console app', function () {
|
||||
this.timeout = defaultTimeout;
|
||||
|
||||
bdd.before(function () {
|
||||
return remote.setWindowSize(1200,800);
|
||||
});
|
||||
|
||||
bdd.after(function unloadMakelogs() {
|
||||
return scenarioManager.unload('logstashFunctional');
|
||||
});
|
||||
|
||||
require('./_console');
|
||||
});
|
||||
}());
|
|
@ -12,10 +12,8 @@ import {
|
|||
|
||||
(function () {
|
||||
bdd.describe('discover tab', function describeIndexTests() {
|
||||
var baseUrl;
|
||||
|
||||
bdd.before(function () {
|
||||
baseUrl = common.getHostPort();
|
||||
|
||||
var fromTime = '2015-09-19 06:31:44.000';
|
||||
var toTime = '2015-09-23 18:31:44.000';
|
||||
|
@ -26,7 +24,7 @@ import {
|
|||
.then(function loadIfEmptyMakelogs() {
|
||||
return scenarioManager.loadIfEmpty('logstashFunctional');
|
||||
})
|
||||
.then(function (navigateTo) {
|
||||
.then(function () {
|
||||
common.debug('navigateTo');
|
||||
return settingsPage.navigateTo();
|
||||
})
|
||||
|
|
|
@ -23,7 +23,8 @@ define(function (require) {
|
|||
'intern/dojo/node!./apps/discover',
|
||||
'intern/dojo/node!./status_page',
|
||||
'intern/dojo/node!./apps/settings',
|
||||
'intern/dojo/node!./apps/visualize'
|
||||
'intern/dojo/node!./apps/visualize',
|
||||
'intern/dojo/node!./apps/console'
|
||||
], function () {});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -41,6 +41,9 @@ module.exports = {
|
|||
settings: {
|
||||
pathname: kibanaURL,
|
||||
hash: '/settings'
|
||||
},
|
||||
console: {
|
||||
pathname: 'app/console',
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -6,6 +6,7 @@ import SettingsPage from './pages/settings_page';
|
|||
import HeaderPage from './pages/header_page';
|
||||
import VisualizePage from './pages/visualize_page';
|
||||
import ShieldPage from './pages/shield_page';
|
||||
import ConsolePage from './pages/console_page';
|
||||
|
||||
const kbnInternVars = global.__kibana__intern__;
|
||||
|
||||
|
@ -23,6 +24,7 @@ defineDelayedExport('headerPage', () => new HeaderPage());
|
|||
defineDelayedExport('settingsPage', () => new SettingsPage());
|
||||
defineDelayedExport('visualizePage', () => new VisualizePage());
|
||||
defineDelayedExport('shieldPage', () => new ShieldPage());
|
||||
defineDelayedExport('consolePage', () => new ConsolePage());
|
||||
|
||||
// creates an export for values that aren't actually avaialable until
|
||||
// until tests start to run. These getters will throw errors if the export
|
||||
|
|
|
@ -52,6 +52,10 @@ export default (function () {
|
|||
return getUrl.baseUrl(config.servers.kibana);
|
||||
},
|
||||
|
||||
getEsHostPort: function getHostPort() {
|
||||
return getUrl.baseUrl(config.servers.elasticsearch);
|
||||
},
|
||||
|
||||
navigateToApp: function (appName, testStatusPage) {
|
||||
var self = this;
|
||||
// navUrl includes user:password@ for use with Shield
|
||||
|
|
69
test/support/pages/console_page.js
Normal file
69
test/support/pages/console_page.js
Normal file
|
@ -0,0 +1,69 @@
|
|||
import { remote, defaultFindTimeout } from '../';
|
||||
|
||||
// in test/support/pages/shield_page.js
|
||||
export default (function (require) {
|
||||
// the page object is created as a constructor
|
||||
// so we can provide the remote Command object
|
||||
// at runtime
|
||||
var thisTime;
|
||||
|
||||
function ConsolePage() {
|
||||
this.remote = remote;
|
||||
thisTime = this.remote.setFindTimeout(defaultFindTimeout);
|
||||
}
|
||||
|
||||
ConsolePage.prototype = {
|
||||
constructor: ConsolePage,
|
||||
|
||||
|
||||
getServer: function getServer() {
|
||||
return thisTime
|
||||
.findByCssSelector('#kibana-body > div.content > div > div')
|
||||
.getVisibleText();
|
||||
},
|
||||
|
||||
setServer: function setServer(server) {
|
||||
return thisTime
|
||||
.findByCssSelector('input[aria-label="Server Name"]')
|
||||
.clearValue()
|
||||
.type(server);
|
||||
},
|
||||
|
||||
getRequest: function getRequest() {
|
||||
return thisTime
|
||||
.findAllByCssSelector('div.ace_line_group')
|
||||
.then(function (editorData) {
|
||||
|
||||
function getEditorData(line) {
|
||||
return line.getVisibleText();
|
||||
}
|
||||
|
||||
var getEditorDataPromises = editorData.map(getEditorData);
|
||||
return Promise.all(getEditorDataPromises);
|
||||
});
|
||||
},
|
||||
|
||||
getResponse: function getResponse() {
|
||||
return thisTime
|
||||
.findByCssSelector('#output > div.ace_scroller > div')
|
||||
.getVisibleText();
|
||||
},
|
||||
|
||||
clickPlay: function clickPlay() {
|
||||
return thisTime
|
||||
.findByCssSelector('#editor_actions > span.ng-scope > a > i')
|
||||
.click();
|
||||
},
|
||||
|
||||
collapseHelp: function collapseHelp() {
|
||||
return thisTime
|
||||
.findByCssSelector('div.config-close.remove > i')
|
||||
.click();
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
return ConsolePage;
|
||||
}());
|
Loading…
Add table
Add a link
Reference in a new issue