当前位置:网站首页>uniapp自动化测试学习
uniapp自动化测试学习
2022-07-02 11:05:00 【snotJam】
文章目录
环境:使用的是普通uniapp项目,安装插件的方式搭建测试环境,而非cli方式
问题一:提示 node 的 binding.node 的问题
安装插件后,提示 node 的 binding.node 的问题,当前安装的是node.js是v14版本的,卸载后安装v12版本,不再提示错误
问题二:右键没有运行测试用例的选项
因为是vue写法,创建 xxx.spec.js测试文件,右键没有运行测试用例的选项。改为xxx.test.js ,右键可以选择运行测试用例
问题三: import时,报 Cannot use import statement outside a module
看的vue组件单元测试,在测试文件中,可以使用import来引入模块,但是在uniapp的, xxx.test.js 文件中,使用import来引入,会报 :
Cannot use import statement outside a module
detail如下:
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){import { shallowMount } from "@vue/test-utils";
好像是将整个xxx.test.js文件封装了一个function方法,那么使用import就报错了,需要使用require来引入
1:import在代码编译时被加载,所以必须放在文件开头,require在代码运行时被加载,所以require理论上可以运用在代码的任何地方,所以import性能更好。
2:import引入的对象被修改时,源对象也会被修改,相当于浅拷贝,require引入的对象被修改时,源对象不会被修改,官网称值拷贝,我们可以理解为深拷贝。
然后参考了别人的文章:uniapp自动化测试
根据博主的写法做了测试:.test.js内容如下
.child-title是引入的子组件中的某个class,运行结果如下:
至此,算是把简单的测试流程跑通,对于测试文件的编写以及jest的用法,还待学习研究
边栏推荐
- Adhere to the foundation of 20 minutes go every day II
- Available solution development oral arithmetic training machine / math treasure / children's oral arithmetic treasure / intelligent math treasure LCD LCD driver ic-vk1622 (lqfp64 package), original te
- Story point vs. Human Sky
- MySQL45讲——学习极客时间MySQL实战45讲笔记—— 05 | 深入浅出索引(下)
- 当贝投影4K激光投影X3 Pro获得一致好评:万元投影仪首选
- Getting started with QT - making a simple calculator
- Quarkus学习四 - 项目开发到部署
- Pycharm连接远程服务器
- 测试框架TestNG的使用(二):testNG xml的使用
- [Hongke technology sharing] how to test DNS server: DNS performance and response time test
猜你喜欢

瀏覽器驅動的下載

《可供方案开发》口算训练机/数学宝/儿童口算宝/智能数学宝 LCD液晶显示驱动IC-VK1622(LQFP64封装),原厂技术支持
![[to be continued] [UE4 notes] l5ue4 model import](/img/6b/d3083afc969043dbef1aeb4fccfc99.jpg)
[to be continued] [UE4 notes] l5ue4 model import

Qt-制作一个简单的计算器-实现四则运算

The conference on the growth of all things was held in Hangzhou, and dangbei was selected into the top 100 list of future unicorns in China in 2022

提示:SQL Server 阻止了对组件‘Ad Hoc Distributed Queries ‘的STATEMENT ‘OpenRowset/OpenDatasource“”

QT new project_ MyNotepad++

ensp简单入门

< schematic diagram of oral arithmetic exercise machine program development> oral arithmetic exercise machine / oral arithmetic treasure / children's math treasure / children's calculator LCD LCD driv

Getting started with QT - making a simple calculator
随机推荐
Simple introduction to ENSP
c# 水晶报表打印
Data Lake (11): Iceberg table data organization and query
mongodb的认识
Qt原代码基本知识
Launcher启动过程
NLA自然语言分析实现数据分析零门槛
Everyone believes that the one-stop credit platform makes the credit scenario "useful"
Certik released the defi security report in 2021, disclosing key data of industry development (PDF download link attached)
Adhere to the foundation of 20 minutes go every day II
BeanUtils -- shallow copy -- example / principle
Use of UIC in QT
一般来讲,如果频繁出现inconsistent tab and space的报错
C语言高级用法--函数指针:回调函数;转换表
[Hongke technology sharing] how to test DNS server: DNS performance and response time test
数据湖(十一):Iceberg表数据组织与查询
Dingtalk send message
P1908 reverse sequence pair
QT new project
Default slot, named slot, scope slot