package里边配置: "test:mp-weixin": "cross-env UNI_PLATFORM=mp-weixin jest --coverage",
describe('我的页', () => {
let page
beforeAll(async () => {
// 重新reLaunch至首页,并获取首页page对象(其中 program 是uni-automator自动注入的全局对象)
page = await program.reLaunch('/pages/my/index')
await page.waitFor(3000)
})
test('banner加载-无图展示class iconfont', async () => {
const bannerNode = await page.$('.banner')
const bannerClass = await bannerNode.attribute('class')
const bannerUrl = await page.data('bannerUrl')
if (!bannerUrl) {
expect(bannerClass.indexOf('iconfont') !== -1).toBe(true)
return
}
expect(bannerClass.indexOf('iconfont') === -1).toBe(true)
})
})