提交 9d158628 编写于 作者: H hdx

feat(rpx2px): 新增自动化测试

上级 e7330ac1
const PAGE_PATH = '/pages/API/rpx2px/rpx2px'
describe('API-rpx2px', () => {
beforeAll(async () => {
page = await program.reLaunch(PAGE_PATH)
await page.waitFor(600);
});
it('rpx2px', async () => {
const btnConvert = await page.$('.convert')
await btnConvert.tap()
await page.waitFor(100)
const data = await page.data()
expect(data.result).toBe(true)
});
});
......@@ -15,7 +15,7 @@
</view>
</view>
<view>
<button type="primary" @click="rpx2px">转换</button>
<button class="convert" type="primary" @click="rpx2px">转换</button>
</view>
</view>
<!-- #ifdef APP -->
......@@ -35,6 +35,12 @@
methods: {
rpx2px: function () {
this.pxValue = uni.rpx2px(this.rpxValue);
// 仅限自动化测试
const windowInfo = uni.getWindowInfo();
if (windowInfo.windowWidth == this.pxValue) {
this.result = true
}
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册