如何到达本地服务器运行夜视testingdocker selenium和本地应用程序?

夜间值class

守夜 – 版本

v0.9.14 

configuration

 { "src_folders": [ "test/e2e" ], "selenium": { "start_process": false, "port": 4444 }, "test_settings": { "default": { "launch_url": "http://localhost:8080", "selenium_port": 4444, "selenium_host": "172.17.0.2", "silent": true }, "dev": { "desiredCapabilities": { "browserName": "chrome" }, "globals": { "baseUrl": "http://localhost:8080/" } } } } 

docker

图片

 $ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 8afbc5b1ee50 selenium/standalone-chrome "/opt/bin/entry_po..." 25 minutes ago Up 25 minutes 0.0.0.0:32770->4444/tcp nightwatch-server 

networking

 $ docker inspect nightwatch-server --format "{{ json .NetworkSettings.Networks }}" | python -m json.tool { "bridge": { "Aliases": null, "EndpointID": "7e621587f6ecbaa9b9d73aee601f647bebd76346b16d9d88e27c8ac7671e503d", "Gateway": "172.17.0.1", "GlobalIPv6Address": "", "GlobalIPv6PrefixLen": 0, "IPAMConfig": null, "IPAddress": "172.17.0.2", "IPPrefixLen": 16, "IPv6Gateway": "", "Links": null, "MacAddress": "02:42:ac:11:00:02", "NetworkID": "363882b98acd8d8fb0756a296610a0135e3ebde4feae8bdceaa7917939d79752" } } 

testing

 module.exports = { 'index page': function (client) { client .url('http://localhost:8080') .waitForElementVisible('body', 1000) .assert.title('Google') .end(); } }; 

结果

 [Index] Test Suite ====================== Running: index page ✔ Element <body> was visible after 100 milliseconds. ✖ Testing if the page title equals "Google". - expected "Google" but got: "localhost" at Object.index page (/data/projects/apidae/frontend/static_src/test/e2e/index.js:6:12) at _combinedTickCallback (internal/process/next_tick.js:73:7) FAILED: 1 assertions failed and 1 passed (674ms) _________________________________________________ TEST FAILURE: 1 assertions failed, 1 passed. (746ms) ✖ index - index page (674ms) Testing if the page title equals "Google". - expected "Google" but got: "localhost" at Object.index page (/data/projects/apidae/frontend/static_src/test/e2e/index.js:6:12) at _combinedTickCallback (internal/process/next_tick.js:73:7) 

为什么我无法访问我的本地服务器?