我一直在使用 Docker for Mac(版本 1.12.0-a(内部版本:11213))。
我正在尝试使用图像来运行我的量角器测试。我正在使用以下命令运行测试:
docker run -it --privileged --rm --net=host -v /dev/shm:/dev/shm -v $(pwd):/protractor webnicer/protractor-headless src/test/e2e/config/docker-config.js
这是我的配置文件:
exports.config = {
onPrepare: function() {
global.nodeModulesPath = '../../main/webapp/node_modules/';
global.mongoConnection = '127.0.0.1:27017';
global.dbName = 'DB_name';
var width = 1280;
var height = 768;
browser.driver.manage().window().setSize(width, height);
},
framework: 'jasmine2',
baseUrl: 'http://127.0.0.1:8080/my-app/',
specs: ['../tests/**/*.spec.js'],
restartBrowserBetweenTests: false,
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
isVerbose: true,
includeStackTrace: true
}
};
Mongo 在容器内运行,webnicer/protractor-headless
容器可以看到 Mongo 并可以插入所有数据(我检查了 Mongo 并通过 确认docker logs
)。
但看起来webnicer/protractor-headless
看不到localhost:8080
应用程序的部署位置。
看起来这与--net=host
选项有关,但我不确定。有人有想法或建议吗?