[英]Angular Protractor: No specs found
在調查量角器時,我遇到了以下問題:
當我運行以下代碼時,它沒有找到任何規格......因此測試不會運行
describe('My app', function() {
console.log('Starting test suite "GUEST"');
browser.get('')
.then(function () {
it('Should automatically redirect', function() {
console.log('Start test 1: automatic redirection of index');
expect(browser.getLocationAbsUrl()).toMatch("/test");
});
});
});
重定向已正確完成,但輸出為:
Starting selenium standalone server...
[launcher] Running 1 instances of WebDriver
Selenium standalone server started at http://192.168.10.217:50382/wd/hub
Starting test suite "GUEST"
Started
No specs found
Finished in 0.004 seconds
Shutting down selenium standalone server.
[launcher] 0 instance(s) of WebDriver still running
[launcher] chrome #1 passed
我認為量角器遍歷文件並在執行.then promise回調函數之前找到結束,並且找不到任何期望值 。
我可能做錯了......但它似乎是這樣做的方式
您的測試包含在一個承諾中,該承諾在注冊測試階段后得到解決。 它應該是:
describe('My app', function() {
console.log('Starting test suite "GUEST"');
it('Should automatically redirect', function() {
browser.get('')
.then(function () {
console.log('Start test 1: automatic redirection of index');
expect(browser.getLocationAbsUrl()).toMatch("/test");
});
});
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.