公司代理后面的量角器(angular cli)
我在centos虚拟机上运行了一个非常简单的e2e测试,该测试一直运行良好。我得到以下错误-公司代理后面的量角器(angular cli),angular,proxy,protractor,angular-cli,Angular,Proxy,Protractor,Angular Cli,我在centos虚拟机上运行了一个非常简单的e2e测试,该测试一直运行良好。我得到以下错误- webpack: Compiled successfully. [15:22:42] I/launcher - Running 1 instances of WebDriver [15:22:42] I/direct - Using ChromeDriver directly... Jasmine started A Jasmine spec timed out. Resetting the WebDr
webpack: Compiled successfully.
[15:22:42] I/launcher - Running 1 instances of WebDriver
[15:22:42] I/direct - Using ChromeDriver directly...
Jasmine started
A Jasmine spec timed out. Resetting the WebDriver Control Flow.
A Jasmine spec timed out. Resetting the WebDriver Control Flow.
my-app App
✗ Should default to login screen
- Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
at ontimeout (timers.js:386:11)
at tryOnTimeout (timers.js:250:5)
- Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
at ontimeout (timers.js:386:11)
at tryOnTimeout (timers.js:250:5)
起初我以为这是由于.waitForAngular()
的问题造成的,但在通过提交退一步后,问题似乎发生在添加自定义字体(在公司网络之外进行调用)@import url('https://fonts.googleapis.com/css?family=Raleway:400,500,700');代码>并删除这一行可确认问题
我可以在此github问题之后为量角器配置代理-
然而,似乎每个调用都是通过代理进行的,包括对localhost的调用,现在它在localhost上找不到Angular应用程序
如何告诉量角器通过代理获取外部资源,本地主机上的任何内容都应忽略代理?必须为运行测试的浏览器配置代理和代理旁路。在我的例子中,我使用的是无头chrome,因此我的
grandor.conf.js
具有以下配置
capabilities: {
'browserName': 'chrome',
chromeOptions: {
args: [ "--headless", "--disable-gpu", "--window-size=800x600",
"--proxy-server=http://proxy.example:80",
"--proxy-bypass-list=http://localhost"]
}
}
重要的补充是指向我的公司代理服务器的
--代理服务器
,以及--代理绕过列表
从代理中排除本地主机。如果您需要在一些环境中运行它,您可以使用ng e2e--grandor config=other grandor.conf.js
-更多信息