Skip to content

Commit

Permalink
Switch from Firefox to Chrome
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeDr committed Jun 17, 2016
1 parent 8bbbfe4 commit 677a6c1
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 102 deletions.
14 changes: 3 additions & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,26 +111,18 @@ The standard `npm run test` task runs several sub tasks and can take several min

#### Running tests using npm task:

*The Selenium server that is started currently only runs the tests in Firefox*
*The ChromeDriver that is started currently only runs the tests in Chrome browser*

To runt the functional UI tests, execute the following command:
To run the functional UI tests, execute the following command:

`npm run test:ui`

The task above takes a little time to start the servers. You can also start the servers and leave them running, and then run the tests separately:

`npm run test:ui:server` will start the server required to run the selenium tests, leave this open
`npm run test:ui:server` will start the server required to run the UI tests, leave this open

`npm run test:ui:runner` will run the frontend tests and close when complete

#### Running tests locally with your existing (and already running) ElasticSearch, Kibana, and Selenium Server:

Set your es and kibana ports in `test/intern.js` to 9220 and 5620, respectively. You can configure your Selenium server to run the tests on Chrome,IE, or other browsers here.

Once you've got the services running, execute the following:

`npm run test:ui:runner`

#### General notes:

- Using Page Objects pattern (https://theintern.github.io/intern/#writing-functional-test)
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"Court Ewing <court@elastic.co>",
"Joe Fleming <joe.fleming@elastic.co>",
"Khalah Jones-Golden <khalah.jones@elastic.co>",
"Lee Drengenberg <lee.drengenberg@elastic.co>",
"Lukas Olson <lukas.olson@elastic.co>",
"Juan Thomassie <juan.thomassie@elastic.co>",
"Shelby Sturgis <shelby@elastic.co>",
Expand Down Expand Up @@ -142,6 +143,7 @@
"auto-release-sinon": "1.0.3",
"babel-eslint": "4.1.7",
"chokidar": "1.0.5",
"chromedriver": "2.21.2",
"eslint": "1.5.1",
"eslint-plugin-mocha": "1.0.0",
"expect.js": "0.3.1",
Expand All @@ -160,7 +162,7 @@
"gruntify-eslint": "1.0.1",
"html-entities": "1.1.3",
"husky": "0.8.1",
"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
27 changes: 12 additions & 15 deletions tasks/config/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module.exports = function (grunt) {
let root = p => resolve(__dirname, '../../', p);
let binScript = /^win/.test(platform) ? '.\\bin\\kibana.bat' : './bin/kibana';
let uiConfig = require(root('test/serverConfig'));
let chromedriver = require('chromedriver');

return {
testServer: {
Expand Down Expand Up @@ -78,35 +79,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',
'selenium/selenium-server-standalone-2.53.0.jar',
'-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',
'selenium/selenium-server-standalone-2.53.0.jar',
'-port',
uiConfig.servers.webdriver.port
`--port=${uiConfig.servers.webdriver.port}`,
'--url-base=wd/hub'
]
},

Expand Down
60 changes: 0 additions & 60 deletions tasks/downloadSelenium.js

This file was deleted.

7 changes: 2 additions & 5 deletions tasks/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ module.exports = function (grunt) {
grunt.registerTask('test:ui', [
'esvm:ui',
'run:testUIServer',
'downloadSelenium',
'run:seleniumServer',
'intern:dev',
'run:chromeDriver',
'esvm_shutdown:ui',
'stop:seleniumServer',
'stop:testUIServer'
Expand All @@ -29,8 +27,7 @@ module.exports = function (grunt) {
grunt.registerTask('test:ui:server', [
'esvm:ui',
'run:testUIServer',
'downloadSelenium',
'run:devSeleniumServer:keepalive'
'run:devChromeDriver:keepalive'
]);

grunt.registerTask('test:ui:runner', [
Expand Down
8 changes: 4 additions & 4 deletions test/functional/apps/discover/_shared_links.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ define(function (require) {
var expectedUrl = baseUrl
+ '/app/kibana?_t=1453775307251#'
+ '/discover?_g=(refreshInterval:(display:Off,pause:!f,value:0),time'
+ ':(from:%272015-09-19T06:31:44.000Z%27,mode:absolute,to:%272015-09'
+ '-23T18:31:44.000Z%27))&_a=(columns:!(_source),index:%27logstash-'
+ '*%27,interval:auto,query:(query_string:(analyze_wildcard:!t,query'
+ ':%27*%27)),sort:!(%27@timestamp%27,desc))';
+ ':(from:\'2015-09-19T06:31:44.000Z\',mode:absolute,to:\'2015-09'
+ '-23T18:31:44.000Z\'))&_a=(columns:!(_source),index:\'logstash-'
+ '*\',interval:auto,query:(query_string:(analyze_wildcard:!t,query'
+ ':\'*\')),sort:!(\'@timestamp\',desc))';
return discoverPage.getSharedUrl()
.then(function (actualUrl) {
// strip the timestamp out of each URL
Expand Down
2 changes: 1 addition & 1 deletion test/intern.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ define(function (require) {
'idle-timeout': 99
},
environments: [{
browserName: 'firefox'
browserName: 'chrome'
}],
tunnelOptions: serverConfig.servers.webdriver,
functionalSuites: [
Expand Down
7 changes: 2 additions & 5 deletions test/support/pages/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,8 @@ define(function (require) {

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.tryForTime(defaultTimeout, function () {
Expand Down Expand Up @@ -106,7 +103,7 @@ define(function (require) {
});
};

return doNavigation(navUrl)
return doNavigation(appUrl)
.then(function (currentUrl) {
var lastUrl = currentUrl;
return self.tryForTime(defaultTimeout, function () {
Expand Down

0 comments on commit 677a6c1

Please sign in to comment.