node.js / karma /端到端testing:无法代理/app/index.html(错误:连接ECONNREFUSED)
以下是我在尝试运行MS Windows 8 Professional上的AngularJS教程http://docs.angularjs.org/tutorial/step_05的端到端testing时得到的消息。 你能告诉我如何使这个testing运行良好?
[2013-06-10 17:27:54.100] [WARN] config - "/" is proxied, you should probably change urlRoot to avoid conflicts INFO [karma]: Karma server started at http://localhost:9876/ INFO [launcher]: <<< Starting browser Chrome INFO [launcher]: --- Starting browser Chrome INFO [Chrome 27.0 (Windows)]: Connected on socket id E20UigDmDqhk3jaRRYAP WARN [proxy]: failed to proxy /app/index.html (Error: connect ECONNREFUSED)
你看到的错误表明你还没有启动networking服务器。 由于您正在使用./scripts/e2e-test.sh来运行e2etesting,因此您需要让您的web服务器从localhost:8000提供应用程序,并且docroot需要指向angular-phonecat文件夹,而不是应用程序文件夹。 这可以通过简单地运行./scripts/web-server.js来完成(参见步骤00 )
请注意,还有第二种方式来运行您的e2etesting。 你可以访问
http://localhost:8000/test/e2e/runner.html
是的,问题是Web服务器没有运行。 它最容易运行一个本地的。
主要有:
- git clone https://github.com/angular/angular-seed
- 我克隆为'angular-seed-template-project',并将其用作我自己项目的模板。
- 我
git pull
这最后的工作,并运行npm update
拉入其最新的依赖项 - 他们实际上是说要在git-hub上分配angular-seed,这将允许你轻松地用最新的变化来更新你的项目(按照我如何合并父叉? )。 然而我的理解是,你只能fork一个github项目一次,这将排除使用angular-seed作为模板。 显然,我需要更详细地看这个。
-
cd <the-project>
-
npm test
运行unit testing -
npm start
以current-dir的应用程序为基础启动web服务器。 默认情况下,这不会作为一个进程运行,所以要么在不同的terminal上运行命令行命令,要么作为进程启动(这就是所谓的node
,以后需要kill) –npm start &
-
npm run update-webdriver
来安装Selenium等等 -
npm run protractor
来运行端到端的集成testing
按照敏捷种子指示的方式这样做会避免这个错误。