Initial changes (only the UI automation changes) to support running tests with Shield (works without Shield also).

This commit is contained in:
LeeDr 2015-12-16 15:57:43 -06:00
parent e6257c7f6a
commit d01db9334b
3 changed files with 21 additions and 6 deletions

View file

@ -10,12 +10,14 @@ module.exports = {
kibana: {
protocol: process.env.TEST_UI_KIBANA_PROTOCOL || 'http',
hostname: process.env.TEST_UI_KIBANA_HOSTNAME || 'localhost',
port: parseInt(process.env.TEST_UI_KIBANA_PORT, 10) || 5620
port: parseInt(process.env.TEST_UI_KIBANA_PORT, 10) || 5601,
auth: 'user:notsecure'
},
elasticsearch: {
protocol: process.env.TEST_UI_ES_PROTOCOL || 'http',
hostname: process.env.TEST_UI_ES_HOSTNAME || 'localhost',
port: parseInt(process.env.TEST_UI_ES_PORT, 10) || 9220
port: parseInt(process.env.TEST_UI_ES_PORT, 10) || 9200,
auth: 'admin:notsecure'
}
},
apps: {

View file

@ -19,12 +19,16 @@ define(function (require) {
navigateToApp: function (appName, testStatusPage) {
var self = this;
var appUrl = getUrl(config.servers.kibana, config.apps[appName]);
self.debug('navigating to ' + appName + ' url: ' + appUrl);
// navUrl includes user:password@ for use with Shield
// appUrl excludes user:password@ to match what getCurrentUrl returns
var navUrl = getUrl(config.servers.kibana, config.apps[appName]);
var appUrl = getUrl.noAuth(config.servers.kibana, config.apps[appName]);
self.debug('navigating to ' + appName + ' url: ' + navUrl);
var doNavigation = function (url) {
return self.tryForTime(defaultTimeout, function () {
// since we're using hash URLs, always reload first to force re-render
self.debug('navigate to: ' + url);
return self.remote.get(url)
.then(function () {
return self.remote.refresh();
@ -49,6 +53,7 @@ define(function (require) {
if (!navSuccessful) {
var msg = 'App failed to load: ' + appName +
' in ' + defaultTimeout + 'ms' +
' appUrl = ' + appUrl +
' currentUrl = ' + currentUrl;
self.debug(msg);
throw new Error(msg);
@ -59,7 +64,7 @@ define(function (require) {
});
};
return doNavigation(appUrl)
return doNavigation(navUrl)
.then(function (currentUrl) {
var lastUrl = currentUrl;
return self.tryForTime(defaultTimeout, function () {

View file

@ -18,6 +18,14 @@ var url = require('url');
* }
* @return {string}
*/
module.exports = function getPage(config, app) {
module.exports = getUrl;
function getUrl(config, app) {
return url.format(_.assign(config, app));
};
getUrl.noAuth = function getUrlNoAuth(config, app) {
var configUrl = _.pick(config, function (val, param) { return param !== 'auth'; });
return url.format(_.assign(configUrl, app));
};