提交 f478a4f7 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

test(ios): 针对 ios 优化测试例

上级 616cec6e
const PAGE_PATH = '/pages/composition-api/reactivity/effect-scope/effect-scope'
const PAGE_PATH = '/pages/composition-api/reactivity/effect-scope/effect-scope'
const platformInfo = process.env.uniTestPlatformInfo.toLowerCase()
const isIos = platformInfo.startsWith('ios')
describe('effectScope', () => {
const isWeb = process.env.uniTestPlatformInfo.startsWith('web')
describe('effectScope', () => {
const platformInfo = process.env.uniTestPlatformInfo.toLowerCase()
const isWeb = platformInfo.startsWith('web')
let page = null
beforeAll(async () => {
page = await program.reLaunch(PAGE_PATH)
......@@ -18,7 +21,10 @@ describe('effectScope', () => {
expect(await watchEffectCounterRes.text()).toBe('watchEffect counter result: counter: 0')
const incrementCounterBtn = await page.$('#increment-counter-btn')
await incrementCounterBtn.tap()
await incrementCounterBtn.tap()
if(isIos){
await page.waitFor(200)
}
expect(await counter.text()).toBe('counter: 1')
expect(await watchCounterRes.text()).toBe('watch counter result: newVal: 1, oldVal: 0')
......@@ -27,7 +33,10 @@ describe('effectScope', () => {
const stopEffectScopeBtn = await page.$('#stop-effect-scope-btn')
await stopEffectScopeBtn.tap()
await incrementCounterBtn.tap()
await incrementCounterBtn.tap()
if(isIos){
await page.waitFor(200)
}
expect(await counter.text()).toBe('counter: 2')
expect(await watchCounterRes.text()).toBe('watch counter result: newVal: 1, oldVal: 0')
......
const PAGE_PATH = '/pages/composition-api/reactivity/watch-effect/watch-effect'
const PAGE_PATH = '/pages/composition-api/reactivity/watch-effect/watch-effect'
const platformInfo = process.env.uniTestPlatformInfo.toLowerCase()
const isIos = platformInfo.startsWith('ios')
describe('watchEffect', () => {
let page = null
......@@ -18,7 +20,7 @@ describe('watchEffect', () => {
const watchCountTrackNum = await page.$('#watch-count-track-num')
if (process.env.uniTestPlatformInfo.startsWith('android')) {
expect(await watchCountTrackNum.text()).toBe('watch count track number: 3')
} else if (process.env.uniTestPlatformInfo.toLocaleLowerCase().startsWith('ios')) {
} else if (isIos) {
// TODO: 确认 IOS 的差异是否正常
expect(await watchCountTrackNum.text()).toBe('watch count track number: 11')
} else {
......@@ -33,7 +35,10 @@ describe('watchEffect', () => {
expect(await watchCountAndObjNumRes.text()).toBe('watch count and obj.num result: count: 0, obj.num: 0')
const incrementBtn = await page.$('.increment-btn')
await incrementBtn.tap()
await incrementBtn.tap()
if(isIos){
await page.waitFor(200)
}
expect(await count.text()).toBe('count: 1')
expect(await watchCountRes.text()).toBe(
......@@ -41,7 +46,7 @@ describe('watchEffect', () => {
if (process.env.uniTestPlatformInfo.startsWith('android')) {
expect(await watchCountTrackNum.text()).toBe('watch count track number: 3')
} else if (process.env.uniTestPlatformInfo.toLocaleLowerCase().startsWith('ios')) {
} else if (isIos) {
expect(await watchCountTrackNum.text()).toBe('watch count track number: 19')
} else {
expect(await watchCountTrackNum.text()).toBe('watch count track number: 9')
......@@ -51,7 +56,10 @@ describe('watchEffect', () => {
expect(await watchCountAndObjNumRes.text()).toBe('watch count and obj.num result: count: 1, obj.num: 0')
await incrementBtn.tap()
await incrementBtn.tap()
if(isIos){
await page.waitFor(200)
}
expect(await count.text()).toBe('count: 2')
expect(await watchCountRes.text()).toBe(
......@@ -59,7 +67,7 @@ describe('watchEffect', () => {
if (process.env.uniTestPlatformInfo.startsWith('android')) {
expect(await watchCountTrackNum.text()).toBe('watch count track number: 3')
} else if (process.env.uniTestPlatformInfo.toLocaleLowerCase().startsWith('ios')) {
} else if (isIos) {
expect(await watchCountTrackNum.text()).toBe('watch count track number: 27')
} else {
expect(await watchCountTrackNum.text()).toBe('watch count track number: 12')
......@@ -72,7 +80,10 @@ describe('watchEffect', () => {
const stopWatchCountBtn = await page.$('.stop-watch-count-btn')
await stopWatchCountBtn.tap()
await incrementBtn.tap()
await incrementBtn.tap()
if(isIos){
await page.waitFor(200)
}
expect(await count.text()).toBe('count: 3')
expect(await watchCountRes.text()).toBe(
......@@ -80,7 +91,7 @@ describe('watchEffect', () => {
if (process.env.uniTestPlatformInfo.startsWith('android')) {
expect(await watchCountTrackNum.text()).toBe('watch count track number: 3')
} else if (process.env.uniTestPlatformInfo.toLocaleLowerCase().startsWith('ios')) {
} else if (isIos) {
expect(await watchCountTrackNum.text()).toBe('watch count track number: 27')
} else {
expect(await watchCountTrackNum.text()).toBe('watch count track number: 12')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册