提交 0dc46350 编写于 作者: A Anne_LXM

test: 调整测试例兼容 web 端

上级 4a8426e5
<template> <template>
<view> <view class="my-component">
<view class="item"> <view class="item">
<text class="title">字符串型数据:</text> <text class="title">字符串型数据:</text>
<text class="value" id="str">{{str}}</text> <text class="value" id="str">{{str}}</text>
......
...@@ -5,7 +5,7 @@ describe('/pages/state/props/props', () => { ...@@ -5,7 +5,7 @@ describe('/pages/state/props/props', () => {
beforeAll(async () => { beforeAll(async () => {
page = await program.reLaunch(PAGE_PATH) page = await program.reLaunch(PAGE_PATH)
page = await program.currentPage(); page = await program.currentPage();
console.log('page', page); // console.log('page', page);
await page.waitFor(1000); await page.waitFor(1000);
}); });
...@@ -13,19 +13,15 @@ describe('/pages/state/props/props', () => { ...@@ -13,19 +13,15 @@ describe('/pages/state/props/props', () => {
let str = await getMyComponentText("#str") let str = await getMyComponentText("#str")
console.log('str-*--*-',str); console.log('str-*--*-',str);
expect(str).toEqual("你好我是props.uvue组件传进的数据"); expect(str).toEqual("你好我是props.uvue组件传进的数据");
let num = await getMyComponentText("#num") let num = await getMyComponentText("#num")
// console.log('num-*--*-',num); // console.log('num-*--*-',num);
expect(parseInt(num)).toEqual(1); expect(parseInt(num)).toEqual(1);
page.callMethod('addNum') page.callMethod('addNum')
num = await getMyComponentText("#num") num = await getMyComponentText("#num")
// console.log('num-*--*-',num); // console.log('num-*--*-',num);
expect(parseInt(num)).toEqual(2); expect(parseInt(num)).toEqual(2);
}); });
}); });
async function getMyComponentText(param){
return await(await(await page.$('.my-component')).$(param)).text();
async function getMyComponentText(param){
return await(await(await page.$('my-component')).$(param)).text();
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册