1

运行由 yeoman 生成器生成的名为 mean-seed 的项目时遇到问题。我已经修补了几天了,并尝试了几件事。我遇到问题的地方是运行“jasmine_node”任务:

Running "jasmine_node" task
>> Error: Unable to access jarfile node_modules/protractor/selenium/selenium-server-standalone-2.39.0.jar
Warning: Done, with errors. Use --force to continue.

Aborted due to warnings.

所以我首先尝试识别缺少的 npm 包来安装

  744  npm install && bower update && bower install
  755  npm install protractor
  760  npm install npm install selenium-standalone
  761  npm install -g protractor
  765  npm install protractor-tester
  767  npm install protractor-selenium-server-vagrant
  768  npm install selenium-standalone@2.39.0-2.8.0-2

这些实际上都没有在 node_modules 目录中创建文件 selenium-server-standalone-2.39.0.jar 。我跑了一个查找来检查,但是安装了其他几个罐子。

$ find . -name "*.jar" -print
./node_modules/grunt-jasmine-node-coverage-validation/node_modules/jasmine-node/node_modules/jasmine-reporters/ext/jline.jar
./node_modules/grunt-jasmine-node-coverage-validation/node_modules/jasmine-node/node_modules/jasmine-reporters/ext/js.jar
./node_modules/selenium-standalone/.selenium/2.39.0/server.jar

我找到了 selenium 服务器下载,所以我尝试下载并将其复制到我必须创建的引用目录 https://code.google.com/p/selenium/downloads/detail?name=selenium-server-standalone-2.39 .0.jar

我又咕哝着跑了。它通过任务然后运行 ​​jasmine_node 任务

Running "jasmine_node" task
TEST configFile: /Users/jgs/Projects/mean/app/test/../configs/config.test.json
configFile: ./app/configs/config.test.json
   info  - socket.io started
waiting for server to be running..
[success] connected to db at localhost:27017/test_temp
>> Feb 01, 2014 3:03:54 PM org.openqa.grid.selenium.GridLauncher main
>> INFO: Launching a standalone server
>> Setting system property webdriver.chrome.driver to node_modules/protractor/selenium/chromedriver

------------------
[ERROR]
Run `node run.js config=test`
Server not connected. Ensure you have a node server running with the `config=test` command line option so this server connects to the TEST database - the same one used here for the tests. Do NOT connect to the live database for doing tests!
------------------

[success] connected to db at localhost:27017/test_temp

all tests - 2526 ms
    should test everything - 2525 ms

Failures:

  1) all tests should test everything
   Message:
     Expected 'ERROR - check the logs above to fix the problem then try again' to be false.
   Stacktrace:
     Error: Expected 'ERROR - check the logs above to fix the problem then try again' to be false.
    at /Users/jgs/Projects/mean/app/test/all.spec.js:6:2935
    at _rejected (/Users/jgs/Projects/mean/node_modules/q/q.js:808:24)
    at /Users/jgs/Projects/mean/node_modules/q/q.js:834:30
    at Promise.when (/Users/jgs/Projects/mean/node_modules/q/q.js:1079:31)
    at Promise.promise.promiseDispatch (/Users/jgs/Projects/mean/node_modules/q/q.js:752:41)
    at /Users/jgs/Projects/mean/node_modules/q/q.js:574:44
    at flush (/Users/jgs/Projects/mean/node_modules/q/q.js:108:17)
    at process._tickCallback (node.js:415:13)

Finished in 2.53 seconds
1 test, 1 assertion, 1 failure, 0 skipped


Warning: Task "jasmine_node" failed. Use --force to continue.

Aborted due to warnings.
$ 

知道为什么茉莉花任务仍然失败吗?

4

2 回答 2

1

运行./node_modules/protractor/bin/webdriver-manager update,请参阅此处了解更多信息: https ://github.com/jackrabbitsgroup/generator-mean-seed/issues/5

我还没有更新量角器升级的文档,对此感到抱歉!

于 2014-02-03T20:27:46.623 回答
0

这是我的解决方案。

首先,您需要同时下载 selenium-server-standalone https://code.google.com/p/selenium/downloads/detail?name=selenium-server-standalone-2.39.0.jar

和 chromedriver http://chromedriver.storage.googleapis.com/index.html

将它们复制到

node_modules/protractor/selenium/

您将希望另一个终端选项卡或窗口通过运行来启动节点服务器

node run.js

然后你可以运行默认的 grunt 任务

grunt

然后,您将在控制台中看到 selenium 测试的输出,并且 chrome 应该会打开并自动执行测试。

于 2014-02-02T19:38:28.323 回答