Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-implement most of PR #7024 switch to Chrome browser #7442

Merged
merged 20 commits into from
Jun 17, 2016
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"Jon Budzenski <jonathan.budzenski@elastic.co>",
"Juan Thomassie <juan.thomassie@elastic.co>",
"Khalah Jones-Golden <khalah.jones@elastic.co>",
"Lee Drengenberg <lee.drengenberg@elastic.co>",
"Lukas Olson <lukas.olson@elastic.co>",
"Matt Bargar <matt.bargar@elastic.co>",
"Nicolás Bevacqua <nico@elastic.co>",
Expand Down Expand Up @@ -151,6 +152,7 @@
"auto-release-sinon": "1.0.3",
"babel-eslint": "4.1.8",
"chokidar": "1.4.3",
"chromedriver": "2.21.2",
"dot": "1.0.3",
"elasticdump": "2.1.1",
"eslint": "1.10.3",
Expand All @@ -172,7 +174,7 @@
"html-entities": "1.1.3",
"husky": "0.8.1",
"image-diff": "1.6.0",
"intern": "3.0.1",
"intern": "3.2.3",
"istanbul-instrumenter-loader": "0.1.3",
"karma": "0.13.9",
"karma-chrome-launcher": "0.2.0",
Expand Down
20 changes: 0 additions & 20 deletions tasks/config/downloadSelenium.js

This file was deleted.

1 change: 1 addition & 0 deletions tasks/config/intern.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module.exports = function (grunt) {
options: {
runType: 'runner',
config: 'test/intern',
bail: true,
reporters: ['Console']
},
dev: {},
Expand Down
27 changes: 12 additions & 15 deletions tasks/config/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module.exports = function (grunt) {
let binScript = /^win/.test(platform) ? '.\\bin\\kibana.bat' : './bin/kibana';
let buildScript = /^win/.test(platform) ? '.\\build\\kibana\\bin\\kibana.bat' : './build/kibana/bin/kibana';
let uiConfig = require(root('test/server_config'));
let chromedriver = require('chromedriver');

const stdDevArgs = [
'--env.name=development',
Expand Down Expand Up @@ -113,35 +114,31 @@ module.exports = function (grunt) {
]
},

seleniumServer: {
chromeDriver: {
options: {
wait: false,
ready: /Selenium Server is up and running/,
quiet: true,
ready: /Starting ChromeDriver/,
quiet: false,
failOnError: false
},
cmd: 'java',
cmd: chromedriver.path,
args: [
'-jar',
'<%= downloadSelenium.options.selenium.path %>',
'-port',
uiConfig.servers.webdriver.port,
`--port=${uiConfig.servers.webdriver.port}`,
'--url-base=wd/hub',
]
},

devSeleniumServer: {
devChromeDriver: {
options: {
wait: false,
ready: /Selenium Server is up and running/,
ready: /Starting ChromeDriver/,
quiet: false,
failOnError: false
},
cmd: 'java',
cmd: chromedriver.path,
args: [
'-jar',
'<%= downloadSelenium.options.selenium.path %>',
'-port',
uiConfig.servers.webdriver.port,
`--port=${uiConfig.servers.webdriver.port}`,
'--url-base=wd/hub',
]
},

Expand Down
61 changes: 0 additions & 61 deletions tasks/download_selenium.js

This file was deleted.

8 changes: 3 additions & 5 deletions tasks/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,18 @@ module.exports = function (grunt) {
grunt.registerTask('test:ui', [
'esvm:ui',
'run:testUIServer',
'downloadSelenium',
'run:seleniumServer',
'run:chromeDriver',
'clean:screenshots',
'intern:dev',
'esvm_shutdown:ui',
'stop:seleniumServer',
'stop:chromeDriver',
'stop:testUIServer'
]);

grunt.registerTask('test:ui:server', [
'esvm:ui',
'run:testUIServer',
'downloadSelenium',
'run:devSeleniumServer:keepalive'
'run:devChromeDriver:keepalive'
]);

grunt.registerTask('test:ui:runner', [
Expand Down
14 changes: 10 additions & 4 deletions test/functional/apps/dashboard/_dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ bdd.describe('dashboard tab', function describeIndexTests() {
// .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 () {
return headerPage.getSpinnerDone();
})
.then(function takeScreenshot() {
common.saveScreenshot('Dashboard-set-timepicker');
Expand All @@ -81,10 +81,16 @@ bdd.describe('dashboard tab', function describeIndexTests() {
return dashboardPage.saveDashboard(dashboardName)
// click New Dashboard just to clear the one we just created
.then(function () {
return dashboardPage.clickNewDashboard();
return common.try(function () {
common.debug('saved Dashboard, now click New Dashboard');
return dashboardPage.clickNewDashboard();
});
})
.then(function () {
return dashboardPage.loadSavedDashboard(dashboardName);
return common.try(function () {
common.debug('now re-load previously saved dashboard');
return dashboardPage.loadSavedDashboard(dashboardName);
});
})
.then(function () {
common.saveScreenshot('Dashboard-load-saved');
Expand Down
37 changes: 16 additions & 21 deletions test/functional/apps/management/_kibana_settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,28 @@ 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.createIndexPattern();
})
.then(function () {
return settingsPage.navigateTo();
});
});

bdd.describe('index pattern creation', function indexPatternCreation() {
bdd.before(function () {
return settingsPage.createIndexPattern()
.then(function () {
return settingsPage.navigateTo();
});
});

bdd.it('should allow setting advanced settings', function () {
return settingsPage.clickKibanaSettings()
.then(function TestCallSetAdvancedSettingsForTimezone() {
common.saveScreenshot('Settings-advanced-tab');
common.debug('calling setAdvancedSetting');
return settingsPage.setAdvancedSettings('dateFormat:tz', 'America/Phoenix');
})
.then(function GetAdvancedSetting() {
common.saveScreenshot('Settings-set-timezone');
return settingsPage.getAdvancedSettings('dateFormat:tz');
})
.then(function (advancedSetting) {
expect(advancedSetting).to.be('America/Phoenix');
});
bdd.it('should allow setting advanced settings', function () {
return settingsPage.clickKibanaSettings()
.then(function TestCallSetAdvancedSettingsForTimezone() {
common.saveScreenshot('Settings-advanced-tab');
common.debug('calling setAdvancedSetting');
return settingsPage.setAdvancedSettings('dateFormat:tz', 'America/Phoenix');
})
.then(function GetAdvancedSetting() {
common.saveScreenshot('Settings-set-timezone');
return settingsPage.getAdvancedSettings('dateFormat:tz');
})
.then(function (advancedSetting) {
expect(advancedSetting).to.be('America/Phoenix');
});
});
});
2 changes: 1 addition & 1 deletion test/intern.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ define(function (require) {
'idle-timeout': 99
},
environments: [{
browserName: 'firefox'
browserName: 'chrome'
}],
tunnelOptions: serverConfig.servers.webdriver,
functionalSuites: [
Expand Down
25 changes: 19 additions & 6 deletions test/support/pages/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,17 @@ export default (function () {

navigateToApp: function (appName, testStatusPage) {
var self = this;
// 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);
self.debug('navigating to ' + appName + ' url: ' + appUrl);

var doNavigation = function (url) {
return self.try(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.sleep(700);
})
.then(function () {
self.debug('returned from get, calling refresh');
return self.remote.refresh();
Expand Down Expand Up @@ -113,7 +113,20 @@ export default (function () {
})
.then(function (currentUrl) {
currentUrl = currentUrl.replace(/\/\/\w+:\w+@/, '//');
var navSuccessful = new RegExp(appUrl).test(currentUrl);
var maxAdditionalLengthOnNavUrl = 230;
// On several test failures at the end of the TileMap test we try to navigate back to
// Visualize so we can create the next Vertical Bar Chart, but we can see from the
// logging and the screenshot that it's still on the TileMap page. Why didn't the "get"
// with a new timestamped URL go? I thought that sleep(700) between the get and the
// refresh would solve the problem but didn't seem to always work.
// So this hack fails the navSuccessful check if the currentUrl doesn't match the
// appUrl plus up to 230 other chars.
// Navigating to Settings when there is a default index pattern has a URL length of 196
// (from debug output). Some other tabs may also be long. But a rather simple configured
// visualization is about 1000 chars long. So at least we catch that case.
var navSuccessful = new RegExp(appUrl + '.{0,' + maxAdditionalLengthOnNavUrl + '}$')
.test(currentUrl);

if (!navSuccessful) {
var msg = 'App failed to load: ' + appName +
' in ' + defaultFindTimeout + 'ms' +
Expand All @@ -128,7 +141,7 @@ export default (function () {
});
};

return doNavigation(navUrl)
return doNavigation(appUrl)
.then(function (currentUrl) {
var lastUrl = currentUrl;
return self.try(function () {
Expand Down
Loading