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');
...
THX!
答案 0 :(得分:1)
请尝试这种方式;
<input ng-model="username">
在您的E2E测试中;
expect(input('username').val()).toMatch('alice');