VUE2.0 测试环境配置

  • unit测试
安装karma-chrome-luncher
npm install karma-chrome-launcher -save

在karma.conf.js中添加:

plugins: [
'karma-chrome-launcher',
'karma-mocha'
],
 

启动测试

npm run unit
  • e2e测试

先安装chromedriver 

npm install chromedriver

 nigtwatch.conf.js与runner.js文件不需要修改,默认即可 

npm run e2e 

在运行中报错如下时

java.lang.UnsupportedClassVersionError: org/openqa/grid/selenium/GridLauncherV3 : Unsupporte
d major.minor version 52.0

 这里需要将JAVA换为对应版本

  stanford parser和jdk版本对应关系
J2SE 8 = 52, J2SE 7 = 51, J2SE 6.0 = 50, J2SE 5.0 = 49, JDK 1.4 = 48, JDK 1.3 = 47, JDK 1.2 = 46, JDK 1.1 = 45
运行出现浏览器闪退 报错如下时
请查看根目录下 selenium-debug.log文件,按log信息安装匹配的chromedriver与chrome版本
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "e2e"
npm ERR! node v6.9.5
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! vue-project@1.0.0 e2e: `node test/e2e/runner.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vue-project@1.0.0 e2e script 'node test/e2e/runner.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the vue-project package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node test/e2e/runner.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs vue-project
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls vue-project
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     H:\vue-project\npm-debug.log

运行成功如下

Starting selenium server... started - PID:  22592

[Demo Test] Test Suite
==========================

[Test] Test Suite
=====================

Running:  default e2e tests
> Listening at http://localhost:8080

 √ Element <#app> was visible after 87 milliseconds.
 √ Testing if element <.hello> is present.
 √ Testing if element <h1> contains text: "Welcome to Your Vue.js App".
 √ Testing if element <img> has count: 1

OK. 4 assertions passed. (5.202s)

OK. 4  total assertions passed. (5.484s)

H:\vue-project>

 

 

 
 

转载于:https://www.cnblogs.com/plus-chen/p/6392251.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值