0.0.34 • Published 2 years ago

@mpflow/plugin-e2e-test v0.0.34

Weekly downloads
20
License
MIT
Repository
github
Last release
2 years ago

@mpflow/plugin-e2e-test

Mpflow 的 e2e 测试支持插件

说明

该插件用于给 Mpflow 的构架提供 e2e 测试功能的集成,使用 jest 为测试执行器,miniprogram-automator 为自动化执行器

e2e 测试代码请按照 ${name}.test.js 的命名形式,放置在项目的 tests/e2e/ 目录下

测试文件默认注入了一个全局 miniProgram 对象,可以直接操纵小程序开发者工具,使用方法请参考 miniprogram-automator 文档

安装

mpflow add e2e-test
# 或
mpflow add @mpflow/plugin-e2e-test

使用

在项目的 tests/e2e 文件夹下添加测试文件,如:

// page-index.test.js

describe('page index', () => {
  let page

  beforeAll(async () => {
    page = await miniProgram.reLaunch('/pages/index/index')
    await page.waitFor(500)
  }, 30 * 1000)

  test('wxml', async () => {
    const element = await page.$('page')
    expect(await element.wxml()).toMatchSnapshot()
  })
})

然后执行命令启动 e2e 测试

npm run test:e2e
# 或
yarn test:e2e

也可以通过 --coverage 参数来获取代码覆盖率报告

npm run test:e2e -- --coverage
# 或
yarn test:e2e --coverage
0.0.34

2 years ago

0.0.33

3 years ago

0.0.30

4 years ago

0.0.31

4 years ago

0.0.32

4 years ago

0.0.29

4 years ago

0.0.28

4 years ago

0.0.27

4 years ago

0.0.25

4 years ago

0.0.26

4 years ago

0.0.24

4 years ago

0.0.23

4 years ago

0.0.22

4 years ago

0.0.21

4 years ago

0.0.20

5 years ago

0.0.19

5 years ago

0.0.18

5 years ago

0.0.16

5 years ago

0.0.17

5 years ago

0.0.15

5 years ago

0.0.14

5 years ago

0.0.13

5 years ago

0.0.12

5 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago