如何在Angular 2中使用量角器? [英] How to use Protractor with Angular 2?
问题描述
我使用Protular与Angular 1.x.我想逐步迁移到Angular 2.0,但我没有在文档中看到Protractor / a>。
I use Protractor with Angular 1.x. I would like to migrate to Angular 2.0 step by step but I don't see Protractor in the docs.
自Angular 2以来,量角器是否已被删除?我应该在不使用Protractor的情况下编写测试,而不是使用Jasmine(或其他)?
Has protractor been dropped since Angular 2? Should I write my tests without using Protractor, using Jasmine instead (or others)?
推荐答案
您可以测试Angular 2应用量角器
(从量角器2.5.0开始)。
You can test Angular 2 applications with Protractor
(starting from Protractor 2.5.0).
对于量角器5.0.0+ ,你不需要做任何特定的事情, Protractor将自动检测被测应用程序中使用的Angular版本。
For Protractor 5.0.0+, you don't have to do anything specific, Protractor will auto-detect the Angular version used in the application under test.
对于Protractor> = 2.5.0和< = 4.0.14,您只需要添加 useAllAngular2AppRoots:true
到你的配置。这是一个样本。
For Protractor >= 2.5.0 and <= 4.0.14, you would only need to add useAllAngular2AppRoots: true
to your config. Here is a sample.
请注意,几个内置的Protractor匹配器尚不能与Angular2一起使用,请参阅:
Note that several built-in Protractor matchers would not yet work with Angular2, see:
- Protractor Angular 2 Failed: unknown error: angular is not defined
Firefox中还存在Protractor + Angular2问题(仍未解决),请参阅:
There is also that Protractor+Angular2 problem in Firefox (still unresolved), see:
- Can't run Selenium via Protractor on Firefox after update to Angular 2
这篇关于如何在Angular 2中使用量角器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!