5***@qq.com
5***@qq.com
  • 发布:2021-09-23 11:06
  • 更新:2023-07-03 14:29
  • 阅读:1098

uniapp项目 微信小程序 自动化测试错误

分类:HBuilderX

HBx:3.2.3.20210825
自动化插件:HBuilderX uni-app自动化测试 版本:0.0.3
自动安装 自动化测试环境依赖插件:版本0.0.1

测试 hello-uniapp 测试例子,发现 测试api 加载超时,应该说是完全卡住。无法正常获取变量.

11:02:03.097 [hello-uniapp:mp-weixin] DONE  Build complete. Watching for changes...  
11:02:38.389 [hello-uniapp:mp-weixin] FAIL pages/tabBar/component/component.test.js (55.808 s)  
11:02:38.389 [hello-uniapp:mp-weixin]   
11:02:38.395 [hello-uniapp:mp-weixin] pages/tabBar/component/component.nvue  
11:02:38.395 [hello-uniapp:mp-weixin]     ✕ u-link (1 ms)  
11:02:38.400 [hello-uniapp:mp-weixin]     ✕ 视图容器  
11:02:38.401 [hello-uniapp:mp-weixin]     ✕ .uni-panel action  
11:02:38.403 [hello-uniapp:mp-weixin]   
11:02:38.403 [hello-uniapp:mp-weixin]   ● pages/tabBar/component/component.nvue › u-link  
11:02:38.406 [hello-uniapp:mp-weixin]   
11:02:38.406 [hello-uniapp:mp-weixin]     thrown: "Exceeded timeout of 30000 ms for a hook.  
11:02:38.410 [hello-uniapp:mp-weixin]     Use jest.setTimeout(newTimeout) to increase the timeout value, if this is a long-running test."  
11:02:38.410 [hello-uniapp:mp-weixin]   
11:02:38.412 [hello-uniapp:mp-weixin]       1   
11:02:38.414 [hello-uniapp:mp-weixin]  describe('pages/tabBar/component/component.nvue', () => {  
11:02:38.414 [hello-uniapp:mp-weixin]       2   
11:02:38.416 [hello-uniapp:mp-weixin]      let page  
11:02:38.417 [hello-uniapp:mp-weixin]     > 3   
11:02:38.419 [hello-uniapp:mp-weixin]      beforeAll(async () => {  
11:02:38.421 [hello-uniapp:mp-weixin]           
11:02:38.422 [hello-uniapp:mp-weixin]      ^  
11:02:38.423 [hello-uniapp:mp-weixin]       4   
11:02:38.425 [hello-uniapp:mp-weixin]          // 重新reLaunch至首页,并获取首页page对象(其中 program 是uni-automator自动注入的全局对象)  
11:02:38.427 [hello-uniapp:mp-weixin]       5   
11:02:38.429 [hello-uniapp:mp-weixin]          page = await program.reLaunch('/pages/tabBar/component/component')  
11:02:38.431 [hello-uniapp:mp-weixin]       6   
11:02:38.432 [hello-uniapp:mp-weixin]          await page.waitFor(1000)  
11:02:38.433 [hello-uniapp:mp-weixin]   
11:02:38.434 [hello-uniapp:mp-weixin]       at pages/tabBar/component/component.test.js:3:5  
11:02:38.436 [hello-uniapp:mp-weixin]       at Object.<anonymous> (pages/tabBar/component/component.test.js:1:57)  
11:02:38.436 [hello-uniapp:mp-weixin]   
11:02:38.438 [hello-uniapp:mp-weixin]   ● pages/tabBar/component/component.nvue › 视图容器  
11:02:38.438 [hello-uniapp:mp-weixin]   
11:02:38.440 [hello-uniapp:mp-weixin]     thrown: "Exceeded timeout of 30000 ms for a hook.  
11:02:38.441 [hello-uniapp:mp-weixin]     Use jest.setTimeout(newTimeout) to increase the timeout value, if this is a long-running test."  
11:02:38.443 [hello-uniapp:mp-weixin]   
11:02:38.443 [hello-uniapp:mp-weixin]       1   
11:02:38.445 [hello-uniapp:mp-weixin]  describe('pages/tabBar/component/component.nvue', () => {  
11:02:38.445 [hello-uniapp:mp-weixin]       2   
11:02:38.446 [hello-uniapp:mp-weixin]      let page  
11:02:38.446 [hello-uniapp:mp-weixin]     > 3   
11:02:38.448 [hello-uniapp:mp-weixin]      beforeAll(async () => {  
11:02:38.448 [hello-uniapp:mp-weixin]           
11:02:38.450 [hello-uniapp:mp-weixin]      ^  
11:02:38.450 [hello-uniapp:mp-weixin]       4   
11:02:38.451 [hello-uniapp:mp-weixin]          // 重新reLaunch至首页,并获取首页page对象(其中 program 是uni-automator自动注入的全局对象)  
11:02:38.451 [hello-uniapp:mp-weixin]       5   
11:02:38.453 [hello-uniapp:mp-weixin]          page = await program.reLaunch('/pages/tabBar/component/component')  
11:02:38.453 [hello-uniapp:mp-weixin]       6   
11:02:38.455 [hello-uniapp:mp-weixin]          await page.waitFor(1000)  
11:02:38.455 [hello-uniapp:mp-weixin]   
11:02:38.456 [hello-uniapp:mp-weixin]       at pages/tabBar/component/component.test.js:3:5  
11:02:38.457 [hello-uniapp:mp-weixin]       at Object.<anonymous> (pages/tabBar/component/component.test.js:1:57)  
11:02:38.458 [hello-uniapp:mp-weixin]   
11:02:38.458 [hello-uniapp:mp-weixin]   ● pages/tabBar/component/component.nvue › .uni-panel action  
11:02:38.460 [hello-uniapp:mp-weixin]   
11:02:38.460 [hello-uniapp:mp-weixin]     thrown: "Exceeded timeout of 30000 ms for a hook.  
11:02:38.462 [hello-uniapp:mp-weixin]     Use jest.setTimeout(newTimeout) to increase the timeout value, if this is a long-running test."  
11:02:38.462 [hello-uniapp:mp-weixin]   
11:02:38.463 [hello-uniapp:mp-weixin]       1   
11:02:38.463 [hello-uniapp:mp-weixin]  describe('pages/tabBar/component/component.nvue', () => {  
11:02:38.465 [hello-uniapp:mp-weixin]       2   
11:02:38.465 [hello-uniapp:mp-weixin]      let page  
11:02:38.466 [hello-uniapp:mp-weixin]     > 3   
11:02:38.466 [hello-uniapp:mp-weixin]      beforeAll(async () => {  
11:02:38.468 [hello-uniapp:mp-weixin]           
11:02:38.468 [hello-uniapp:mp-weixin]      ^  
11:02:38.469 [hello-uniapp:mp-weixin]       4   
11:02:38.469 [hello-uniapp:mp-weixin]          // 重新reLaunch至首页,并获取首页page对象(其中 program 是uni-automator自动注入的全局对象)  
11:02:38.471 [hello-uniapp:mp-weixin]       5   
11:02:38.471 [hello-uniapp:mp-weixin]          page = await program.reLaunch('/pages/tabBar/component/component')  
11:02:38.473 [hello-uniapp:mp-weixin]       6   
11:02:38.473 [hello-uniapp:mp-weixin]          await page.waitFor(1000)  
11:02:38.475 [hello-uniapp:mp-weixin]   
11:02:38.475 [hello-uniapp:mp-weixin]       at pages/tabBar/component/component.test.js:3:5  
11:02:38.476 [hello-uniapp:mp-weixin]       at Object.<anonymous> (pages/tabBar/component/component.test.js:1:57)  
11:02:38.478 [hello-uniapp:mp-weixin] Test Suites: 1 failed, 1 total  
11:02:38.480 [hello-uniapp:mp-weixin] Tests:       3 failed, 3 total  
11:02:38.480 [hello-uniapp:mp-weixin] Snapshots:   0 total  
11:02:38.482 [hello-uniapp:mp-weixin] Time:        55.892 s, estimated 58 s  
11:02:38.483 [hello-uniapp:mp-weixin] Ran all test suites.  
11:02:38.485 Test results written to: ../../../Library/Application Support/HBuilder X/hbuilderx-for-uniapp-test/hello-uniapp/mp-weixin/20210923111.json  

11:02:38.487 [hello-uniapp:mp-weixin] Force exiting Jest: Have you considered using `--detectOpenHandles` to detect async operations that kept running after all tests finished?  
11:02:38.489 [hello-uniapp:mp-weixin]测试运行结束。
2021-09-23 11:06 负责人:无 分享
已邀请:
5***@qq.com

5***@qq.com (作者)

4***@qq.com

4***@qq.com

一样的问题。 请问作者解决了吗

describe('pages/investmentLink/homepage.vue', () => {
14:15:54.307 [jest:h5] 4
14:15:54.308 [jest:h5] let page;
14:15:54.308 [jest:h5] > 5
14:15:54.308 [jest:h5] beforeAll(async () => {
14:15:54.309 [jest:h5]
14:15:54.309 [jest:h5] ^
14:15:54.310 [jest:h5] 6
14:15:54.310 [jest:h5] // 重新reLaunch至首页,并获取首页page对象(其中 program 是uni-automator自动注入的全局对象)
14:15:54.310 [jest:h5] 7
14:15:54.310 [jest:h5] page = await program.reLaunch('/pages/investmentLink/homepage')
14:15:54.311 [jest:h5] 8
14:15:54.311 [jest:h5] await page.waitFor(5000)
14:15:54.312 [jest:h5]
14:15:54.312 [jest:h5] at jest_test/homepage.test.js:5:5
14:15:54.313 [jest:h5] at Object.<anonymous> (jest_test/homepage.test.js:3:1)
14:16:04.418 [jest:h5] FAIL jest_test/index.test.js (10.107 s)
14:16:04.419 [jest:h5] ● sum › check 1+2 equal to 3?
14:16:04.420 [jest:h5]
14:16:04.422 [jest:h5] thrown: "Exceeded timeout of 10000 ms for a hook.
14:16:04.423 [jest:h5] Use jest.setTimeout(newTimeout) to increase the timeout value, if this is a long-running test."
14:16:04.424 [jest:h5]
14:16:04.425 [jest:h5] 19
14:16:04.451 [jest:h5] describe('sum', () => {
14:16:04.452 [jest:h5] 20
14:16:04.453 [jest:h5] let page;
14:16:04.453 [jest:h5] > 21
14:16:04.455 [jest:h5] beforeAll(async () => {
14:16:04.455 [jest:h5]
14:16:04.456 [jest:h5] ^
14:16:04.456 [jest:h5] 22
14:16:04.456 [jest:h5] page = await program.reLaunch('/pages/index/index')
14:16:04.457 [jest:h5] 23
14:16:04.457 [jest:h5] await page.waitFor(5000);
14:16:04.458 [jest:h5] 24
14:16:04.458 [jest:h5] page = await program.currentPage();
14:16:04.459 [jest:h5]
14:16:04.459 [jest:h5] at jest_test/index.test.js:21:5
14:16:04.459 [jest:h5] at Object.<anonymous> (jest_test/index.test.js:19:1)
14:16:04.460 [jest:h5]

要回复问题请先登录注册