簡體   English   中英

在AngularJS教程中執行測試時出錯,步驟3

[英]Error running test in AngularJS tutorial, step-3

嘗試在角度教程中運行端到端測試時,我得到以下內容( http://docs.angularjs.org/tutorial/step_03 )...

我做了“git checkout -f step-3”所以它直接來自回購...

[2013-04-05 07:17:07.774] [WARN] config - "/" is proxied, you should probably change urlRoot to avoid conflicts
INFO [testacular]: Testacular server started at http://localhost:9876/
INFO [launcher]: Starting browser Chrome
INFO [Chrome 26.0 (Mac)]: Connected on socket id CamYxe8MuPk52Agq6g5L
WARN [proxy]: failed to proxy /app/index.html (Error: connect ECONNREFUSED)
WARN [proxy]: failed to proxy /app/index.html (Error: connect ECONNREFUSED)

我在Rails應用程序中運行應用程序,該應用程序由WEBrick在端口3000上提供服務。所以我將testacula配置更改為...

proxies = {
'/': 'http://localhost:3000/'
};

...然后測試運行但失敗了

Chrome 26.0 (Mac) PhoneCat App Phone list view should filter the phone list as user types into the search box FAILED
expect repeater '.phones li' count toBe 3
/Users/paul/rails_projects/angularjs/public/angular-phonecat/test/e2e/scenarios.js:15:7: expected 3 but was 0

所以它似乎沒有正確導航到頁面。 有人有主意嗎?

干杯

將angular-phonecat / config / testacular-e2e.conf.js代理更新為:

proxies = {
  '/': 'http://localhost:3000/angular-phonecat/'
};

angular-phonecat / test / e2e / scenarios.js中的測試預計能夠達到:

http://localhost:3000/app/index.html  

將代理更新為上述配置將解決此問題(或者您可以將/ Users / paul / rails_projects / angularjs / public / angular-phonecat / *中的所有文件直接移動到您的公用文件夾中)

正如克里斯所說,(我提高了他的評論)

我正在運行MAMP所以我不得不改為使用port:80 / angular-phonecat

如果您只是運行scripts / web-server.js,那么只需運行服務器:

→ ./scripts/web-server.js 
Http Server running at http://localhost:8000/

請注意, 8000是正確的端口並更新e2e配置文件:

// config/karma-e2e.conf.js

proxies: {
  '/': 'http://localhost:8000/' //was :3000
}

現在運行e2e測試,應該沒問題:

→ karma start config/karma-e2e.conf.js

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM