0

尝试使用 .type 操作失败。这是在使用角度的网络应用程序上,不确定这是否与它有关。

我可以获得断言属性和元素的存在,但尝试使用 .type 或 .setValue 失败

这是测试

module.exports = {
  'Smoke test app.ablio': function (test) {
test
  .open('http://app.ablio.com')
  .assert.title().is('ablio :: Communication Without Barriers', 'Title OK')
  .open('https://app.ablio.com/signin')
  .assert.attr('#sign-in', 'type', 'submit', "submit signin form exists")
  .assert.exists('#username', "username form field exists")
  .assert.attr('#username', 'type', 'text', "username form field is type text")
  .assert.exists('#password', "password form field exists")
  .assert.attr('#password', 'type', 'password',"password form field is type password")
  .type('#username', 'testuser')
  .assert.val('#username', 'testuser', 'Username was entered')
  .screenshot ('shots/final.png')
  .done(); 
   }
 };

assert.val() 失败:

输出:

dalek smoketest.js 
Running tests
Running Browser: PhantomJS
OS: mac 10.10 (Yosemite) 32bit
Browser Version: 1.9.8

 RUNNING TEST - "Smoke test app.ablio"
▶ OPEN http://app.ablio.com
✔ TITLE Title OK
▶ OPEN https://app.ablio.com/signin
✔ ATTRIBUTE submit signin form exists
✔ EXISTS username form field exists
✔ ATTRIBUTE username form field is type text
✔ EXISTS password form field exists
✔ ATTRIBUTE password form field is type password
▶ TYPE #username
✘ VAL
0 EXPECTED: testuser
0 FOUND: 
0 MESSAGE: Username was entered
▶ SCREENSHOT shots/final.png
✘ TEST - "Smoke test app.ablio" FAILED

 6/7 assertions passed. Elapsed Time: 8.55 sec 

DalekJS CLI 工具版本:0.0.5 DalekJS 本地安装:0.0.9

4

2 回答 2

0

这解决了问题并提供了对角度的支持:http: //gist.github.com/ryanzec/7546175

于 2015-04-07T17:09:07.903 回答
0

扫描页面的 DOM,您会看到有 2 个输入,其 id 为username. 一方面是无效的,其次,username你试图填充的是 DOM 层次结构中的第二个。如果它是第一个,它甚至可以工作,不管无效的 DOM。

我不认为这是 Angular 特有的事情,因为我很难相信 Angular 本身会生成无效的 DOM。

于 2015-04-09T10:51:13.303 回答