mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Re-implement most of PR #7024 switch to Chrome browser
This commit is contained in:
parent
a553bab16d
commit
01255ee4d4
6 changed files with 26 additions and 110 deletions
|
@ -153,6 +153,7 @@
|
|||
"auto-release-sinon": "1.0.3",
|
||||
"babel-eslint": "4.1.8",
|
||||
"chokidar": "1.4.3",
|
||||
"chromedriver": "2.21.2",
|
||||
"elasticdump": "2.1.1",
|
||||
"eslint": "1.10.3",
|
||||
"eslint-plugin-mocha": "1.1.0",
|
||||
|
@ -173,7 +174,7 @@
|
|||
"html-entities": "1.1.3",
|
||||
"husky": "0.8.1",
|
||||
"image-diff": "1.6.0",
|
||||
"intern": "3.0.1",
|
||||
"intern": "3.1.1",
|
||||
"istanbul-instrumenter-loader": "0.1.3",
|
||||
"karma": "0.13.9",
|
||||
"karma-chrome-launcher": "0.2.0",
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
var path = require('path');
|
||||
import { resolve as resolveUrl } from 'url';
|
||||
|
||||
const URL = 'https://selenium-release.storage.googleapis.com/2.53/selenium-server-standalone-2.53.0.jar';
|
||||
// must match selenium-version in test/intern.js
|
||||
const DIR = resolveUrl(URL, './');
|
||||
const FILE = URL.replace(DIR, '');
|
||||
|
||||
module.exports = function (grunt) {
|
||||
return {
|
||||
options: {
|
||||
selenium: {
|
||||
filename: FILE,
|
||||
server: DIR,
|
||||
md5: '774efe2d84987fb679f2dea038c2fa32',
|
||||
path: path.join(grunt.config.get('root'), 'selenium', FILE)
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
|
@ -6,6 +6,7 @@ module.exports = function (grunt) {
|
|||
options: {
|
||||
runType: 'runner',
|
||||
config: 'test/intern',
|
||||
bail: true,
|
||||
reporters: ['Console']
|
||||
},
|
||||
dev: {},
|
||||
|
|
|
@ -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',
|
||||
|
@ -113,35 +114,31 @@ module.exports = function (grunt) {
|
|||
]
|
||||
},
|
||||
|
||||
seleniumServer: {
|
||||
chromeDriver: {
|
||||
options: {
|
||||
wait: false,
|
||||
ready: /Selenium Server is up and running/,
|
||||
quiet: true,
|
||||
failOnError: false
|
||||
},
|
||||
cmd: 'java',
|
||||
args: [
|
||||
'-jar',
|
||||
'<%= downloadSelenium.options.selenium.path %>',
|
||||
'-port',
|
||||
uiConfig.servers.webdriver.port,
|
||||
]
|
||||
},
|
||||
|
||||
devSeleniumServer: {
|
||||
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',
|
||||
]
|
||||
},
|
||||
|
||||
devChromeDriver: {
|
||||
options: {
|
||||
wait: false,
|
||||
ready: /Starting ChromeDriver/,
|
||||
quiet: false,
|
||||
failOnError: false
|
||||
},
|
||||
cmd: chromedriver.path,
|
||||
args: [
|
||||
`--port=${uiConfig.servers.webdriver.port}`,
|
||||
'--url-base=wd/hub',
|
||||
]
|
||||
},
|
||||
|
||||
|
|
|
@ -1,61 +0,0 @@
|
|||
var _ = require('lodash');
|
||||
var request = require('request');
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var colors = require('ansicolors');
|
||||
var crypto = require('crypto');
|
||||
var {spawn} = require('child_process');
|
||||
|
||||
module.exports = function (grunt) {
|
||||
grunt.registerTask('downloadSelenium', 'Download selenium standalone', function (keepalive) {
|
||||
const done = this.async();
|
||||
const config = this.options();
|
||||
|
||||
const FILE = config.selenium.path;
|
||||
const DIR = path.dirname(config.selenium.path);
|
||||
const URL = config.selenium.server + config.selenium.filename;
|
||||
|
||||
function validateDownload(path, expectedHash, success) {
|
||||
grunt.log.write('Validating hash...');
|
||||
fs.readFile(path, function checkHash(err, data) {
|
||||
if (err) grunt.fail.warn(err);
|
||||
|
||||
const calculatedHash = crypto.createHash('md5').update(data).digest('hex');
|
||||
if (calculatedHash !== expectedHash) return grunt.fail.warn('Selenium download has an invalid hash');
|
||||
|
||||
grunt.log.writeln('done');
|
||||
success();
|
||||
});
|
||||
}
|
||||
|
||||
function downloadSelenium(success) {
|
||||
grunt.log.write(`Downloading ${URL}...`);
|
||||
request.get(URL)
|
||||
.pipe(fs.createWriteStream(FILE))
|
||||
.on('error', function downloadError(err) {
|
||||
grunt.fail.warn(err);
|
||||
})
|
||||
.on('finish', function downloadFinish() {
|
||||
grunt.log.writeln('done');
|
||||
validateDownload(FILE, config.selenium.md5, success);
|
||||
});
|
||||
}
|
||||
|
||||
function start() {
|
||||
try {
|
||||
fs.mkdirSync(DIR);
|
||||
} catch (err) {
|
||||
if (err && err.code !== 'EEXIST') grunt.fail.warn(err);
|
||||
}
|
||||
|
||||
if (fs.existsSync(FILE)) {
|
||||
validateDownload(FILE, config.selenium.md5, done);
|
||||
} else {
|
||||
downloadSelenium(done);
|
||||
}
|
||||
}
|
||||
|
||||
start();
|
||||
|
||||
});
|
||||
};
|
|
@ -19,19 +19,17 @@ module.exports = function (grunt) {
|
|||
grunt.registerTask('test:ui', [
|
||||
'esvm:ui',
|
||||
'run:testUIServer',
|
||||
'downloadSelenium',
|
||||
'run:seleniumServer',
|
||||
'run:chromeDriver',
|
||||
'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', [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue