嘗試使用.type操作失敗。這是一個使用角度的Web應用程序,不知道這是否與它有關。Dalek.js未設置元素值
我可以斷言屬性和元素的存在,而是試圖用.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
好的,經過幾個調試會話後,我可以看到Dalek只看到第一個DOM加載,而不是角度加載的DOM。有沒有什麼方法來等待角度來加載DOM? –
這解決了這個問題,並提供對角度的支持:https://gist.github.com/ryanzec/7546175 –