mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Add url configs and util to get pages
This commit is contained in:
parent
c9cc607230
commit
7153162af4
5 changed files with 53 additions and 3 deletions
|
@ -7,6 +7,7 @@ module.exports = {
|
|||
},
|
||||
all: {
|
||||
src: [
|
||||
'test/**/__tests__/**/*.js',
|
||||
'src/**/__tests__/**/*.js',
|
||||
'test/fixtures/__tests__/*.js',
|
||||
'!src/**/public/**',
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
define(function (require) {
|
||||
var registerSuite = require('intern!object');
|
||||
var expect = require('intern/dojo/node!expect.js');
|
||||
var config = require('intern').config;
|
||||
var getPage = require('intern/dojo/node!../utils/getPage');
|
||||
|
||||
registerSuite(function () {
|
||||
var url = 'http://localhost:5620/status';
|
||||
return {
|
||||
'status': function () {
|
||||
return this.remote
|
||||
.get(url)
|
||||
.refresh()
|
||||
.get(getPage(config.kibana, 'status'))
|
||||
.setFindTimeout(60000)
|
||||
.findByCssSelector('.plugin_status_breakdown')
|
||||
.getVisibleText()
|
||||
|
|
|
@ -12,6 +12,16 @@ define({
|
|||
host: 'localhost',
|
||||
port: 4444
|
||||
},
|
||||
kibana: {
|
||||
protocol: 'http',
|
||||
hostname: 'localhost',
|
||||
port: 5620
|
||||
},
|
||||
elasticsearch: {
|
||||
protocol: 'http',
|
||||
hostname: 'localhost',
|
||||
port: 9220
|
||||
},
|
||||
functionalSuites: ['test/functional/status.js'],
|
||||
excludeInstrumentation: /(fixtures|node_modules)\//
|
||||
});
|
||||
|
|
18
test/utils/__tests__/getPage.js
Normal file
18
test/utils/__tests__/getPage.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
var expect = require('expect.js');
|
||||
var getPage = require('../getPage');
|
||||
|
||||
describe('getPage', function () {
|
||||
it('should be able to convert a config and a path to a url', function() {
|
||||
expect(getPage({
|
||||
protocol: 'http',
|
||||
hostname: 'localhost',
|
||||
port: 9220
|
||||
}, 'foo')).to.be('http://localhost:9220/foo');
|
||||
|
||||
expect(getPage({
|
||||
protocol: 'https',
|
||||
hostname: 'localhost',
|
||||
}, 'foo')).to.be('https://localhost/foo');
|
||||
|
||||
});
|
||||
});
|
21
test/utils/getPage.js
Normal file
21
test/utils/getPage.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
var _ = require('lodash');
|
||||
var url = require('url');
|
||||
|
||||
|
||||
/**
|
||||
* Converts a config and a pathname to a url
|
||||
* @param {object} config A url config
|
||||
* example:
|
||||
* {
|
||||
* protocol: 'http',
|
||||
* hostname: 'localhost',
|
||||
* port: 9220
|
||||
* }
|
||||
* @param {string} pathname The requested path
|
||||
* @return {string}
|
||||
*/
|
||||
module.exports = function getPage(config, pathname) {
|
||||
return url.format(_.assign(config, {
|
||||
pathname: pathname
|
||||
}));
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue