3

binding()函数似乎在 e2e 测试中找不到双向绑定。假设以下绑定:

<input ng-model="username">
<p>{{email}}</p>
<input ng-bind="password">

以下 e2e 测试失败:

...
expect(binding('username')).toMatch('alice');
...
>> Binding selector 'username' did not match.

以下 e2e 测试成功:

...
expect(binding('email')).toMatch('alice@ab.com');
expect(binding('password')).toMatch('abc123');
...

谢谢!

4

1 回答 1

1

请尝试这种方式;

<input ng-model="username">

在您的 E2E 测试中;

expect(input('username').val()).toMatch('alice');
于 2013-09-05T09:06:53.697 回答