虚拟机上的 Karma 测试
Karma Tesing on Virtual Machine
我正在尝试 运行 业力测试作为自动化 TFS 构建的一部分。构建打开浏览器 window 并且无法在构建服务器上 运行 headless。这种情况下最好的浏览器配置是什么?
谢谢!
package.json 脚本是
"headlessTest":"karma start --browsers ChromeHeadless karma.conf.js"
// Karma configuration file, see link for more information
// https://karma-runner.github.io/0.13/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular/cli'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular/cli/plugins/karma'),
require('karma-phantomjs-launcher')
],
client:{
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
reports: [ 'html', 'lcovonly' ],
fixWebpackSourcePaths: true
},
angularCli: {
environment: 'dev'
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false
});
};
控制台输出 window TFS build
[33m01 08 2017 10:03:00.043:WARN [launcher]: [39mChromeHeadless have not
captured in 60000 ms, killing.
[33m01 08 2017 10:03:02.087:WARN [launcher]: [39mChromeHeadless was not
killed in 2000 ms, sending SIGKILL.
[33m01 08 2017 10:03:04.208:WARN [launcher]: [39mChromeHeadless was not``killed by SIGKILL in 2000 ms, continuing.
您可以尝试 chrome 与 "nosandbox" 共进午餐。
在你的 karma 中使用以下配置 project.conf.js
:
browsers: ['ChromeNoSandbox'],
customLaunchers: {
ChromeNoSandbox: {
base: 'Chrome',
flags: ['--no-sandbox']
}
}
参考这个 Github 问题:https://github.com/karma-runner/karma-chrome-launcher/issues/73#issuecomment-236597429
更新:
Karma 有一个问题:github.com/karma-runner/karma/issues/2652 , whatever you can try different versions combination for Karma and Chrome, someone mentioned that downgrading to karma 1.5 有效。
您也可以尝试增加超时值,例如600000,然后再试一次。
我正在尝试 运行 业力测试作为自动化 TFS 构建的一部分。构建打开浏览器 window 并且无法在构建服务器上 运行 headless。这种情况下最好的浏览器配置是什么? 谢谢!
package.json 脚本是
"headlessTest":"karma start --browsers ChromeHeadless karma.conf.js"
// Karma configuration file, see link for more information
// https://karma-runner.github.io/0.13/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular/cli'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular/cli/plugins/karma'),
require('karma-phantomjs-launcher')
],
client:{
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
reports: [ 'html', 'lcovonly' ],
fixWebpackSourcePaths: true
},
angularCli: {
environment: 'dev'
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false
});
};
控制台输出 window TFS build
[33m01 08 2017 10:03:00.043:WARN [launcher]: [39mChromeHeadless have not
captured in 60000 ms, killing.
[33m01 08 2017 10:03:02.087:WARN [launcher]: [39mChromeHeadless was not
killed in 2000 ms, sending SIGKILL.
[33m01 08 2017 10:03:04.208:WARN [launcher]: [39mChromeHeadless was not``killed by SIGKILL in 2000 ms, continuing.
您可以尝试 chrome 与 "nosandbox" 共进午餐。
在你的 karma 中使用以下配置 project.conf.js
:
browsers: ['ChromeNoSandbox'],
customLaunchers: {
ChromeNoSandbox: {
base: 'Chrome',
flags: ['--no-sandbox']
}
}
参考这个 Github 问题:https://github.com/karma-runner/karma-chrome-launcher/issues/73#issuecomment-236597429
更新:
Karma 有一个问题:github.com/karma-runner/karma/issues/2652 , whatever you can try different versions combination for Karma and Chrome, someone mentioned that downgrading to karma 1.5 有效。
您也可以尝试增加超时值,例如600000,然后再试一次。