Angular 2 e2e 使用量角器:by.model 不工作

Angular 2 e2e using protractor: by.model not working

在为 Angular 2 应用程序使用 protractor.js 编写测试用例时,如果我想获得 element(by.model("xyz.test")) 它总是给出失败说明 angular 未定义。

知道如何解决这个问题吗?

正如 Protractor 风格指南的贡献者之一@Carmen Popoviciu 所提到的,by.model 和 by.binding 尚未使用 Protractor 和 Angular 2:

"Keep in mind that currently not all locator strategies are supported for ng2 apps. Things like by.model() or by.binding() are not working just yet. Check the Protractor changelog for new releases"

https://github.com/CarmenPopoviciu/angular2-go-protractor

这是a github issue to follow关于这个的,by.model在评论中提到了。

(这是我目前唯一能找到的公开票,如果有人有更好的话)

@Gabriel Kohen 的回答绝对准确,但我想我会添加另一个答案,其中包含一些文档链接,这些文档积极劝阻使用 by.modelby.binding

https://github.com/angular/protractor#compatibility

https://github.com/angular/protractor/blob/master/docs/locators.md#locators

在这一点上,它们可能永远不会得到支持。