当前位置:网站首页>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的用法,还待学习研究
边栏推荐
- 关于Flink框架窗口(window)函数最全解析
- Subcontracting configuration of uniapp applet subpackages
- P1908 reverse sequence pair
- Chinese science and technology from the Winter Olympics (III): the awakening and evolution of digital people
- Téléchargement par navigateur
- Selenium element positioning method
- SystemServer进程
- HMS core machine learning service helps zaful users to shop conveniently
- Some interview suggestions for Android programmers "suggestions collection"
- C语言高级用法--函数指针:回调函数;转换表
猜你喜欢
MySQL45讲——学习极客时间MySQL实战45讲笔记—— 04 | 深入浅出索引(上)
MySQL45讲——学习极客时间MySQL实战45讲笔记—— 05 | 深入浅出索引(下)
kaggle如何使用utility script
Daily learning 2
< schéma de développement de la machine d'exercice oral > machine d'exercice oral / trésor d'exercice oral / trésor de mathématiques pour enfants / lecteur LCD de calculatrice pour enfants IC - vk1621
The global special paper revenue in 2021 was about $27 million, and it is expected to reach $35 million in 2028. From 2022 to 2028, the CAGR was 3.8%
Custom events, global event bus, message subscription and publishing, $nexttick
2022 home projector preferred! Dangbei F5 brings the ultimate audio-visual experience with its powerful audio-visual effect
Daily learning 3
2022家用投影仪首选!当贝F5强悍音画效果带来极致视听体验
随机推荐
<口算练习机 方案开发原理图>口算练习机/口算宝/儿童数学宝/儿童计算器 LCD液晶显示驱动IC-VK1621B,提供技术支持
MySQL -- convert rownum in Oracle to MySQL
PHP linked list creation and traversal
关于Flink框架窗口(window)函数最全解析
P3008 [usaco11jan]roads and planes g (SPFA + SLF optimization)
Start to write a small demo - three piece chess
提示:SQL Server 阻止了对组件‘Ad Hoc Distributed Queries ‘的STATEMENT ‘OpenRowset/OpenDatasource“”
无主灯设计:如何让智能照明更加「智能」?
路由(二)
Penetrate the remote connection database through the Intranet
Quarkus learning IV - project development to deployment
Quarkus学习四 - 项目开发到部署
MySQL45讲——学习极客时间MySQL实战45讲笔记—— 04 | 深入浅出索引(上)
docker mysql
Chaos engineering platform chaosblade box new heavy release
ensp简单入门
万物生长大会在杭召开,当贝入选2022中国未来独角兽TOP100榜单
2022家用投影仪首选!当贝F5强悍音画效果带来极致视听体验
<口算練習機 方案開發原理圖>口算練習機/口算寶/兒童數學寶/兒童計算器 LCD液晶顯示驅動IC-VK1621B,提供技術支持
Who is better, Qianyuan projection Xiaoming Q1 pro or Jimi new play? Which configuration is higher than haqu K1?