diff --git a/pages/composition-api/lifecycle/page-lifecycle/page-lifecycle.test.js b/pages/composition-api/lifecycle/page-lifecycle/page-lifecycle.test.js index 54fcd86b57d4065beebe00a7fd08374527743dbb..73fe1c583519cfca653217937322eb90925169b8 100644 --- a/pages/composition-api/lifecycle/page-lifecycle/page-lifecycle.test.js +++ b/pages/composition-api/lifecycle/page-lifecycle/page-lifecycle.test.js @@ -4,7 +4,14 @@ const INTER_PAGE_PATH = '/pages/app-instance/index/index' let page let lifeCycleNum -describe('page-lifecycle', () => { +describe('page-lifecycle', () => { + if (process.env.uniTestPlatformInfo.startsWith('web')) { + // TODO: 自动化测试暂不能调用web端setup内defineExpose导出的方法,待自动化测试兼容后开放此测试例 + it('web', async () => { + expect(1).toBe(1) + }) + return + } beforeAll(async () => { page = await program.reLaunch(HOME_PATH) await page.waitFor(700) diff --git a/pages/composition-api/reactivity/on-scope-dispose/on-scope-dispose.uvue b/pages/composition-api/reactivity/on-scope-dispose/on-scope-dispose.uvue index f0af9cb9d5e190c4b1dcce3de41275bd59c49f74..9cf3f8a1e03906d7fbd8780d5ee34c7a2c1fbb72 100644 --- a/pages/composition-api/reactivity/on-scope-dispose/on-scope-dispose.uvue +++ b/pages/composition-api/reactivity/on-scope-dispose/on-scope-dispose.uvue @@ -14,9 +14,9 @@ const createScope = () => { scope = effectScope(); (scope as EffectScope).run(() => { - hasCurrentScope.value = getCurrentScope() !== null + hasCurrentScope.value = getCurrentScope() != null onScopeDispose(() => { - hasCurrentScope.value = getCurrentScope() !== null + hasCurrentScope.value = getCurrentScope() != null }) }) } diff --git a/pages/composition-api/reactivity/readonly/readonly.test.js b/pages/composition-api/reactivity/readonly/readonly.test.js index 474341c1f66b32ad4ef0aa3d1f6eb0698d4e1d34..4926f1d95a1ecb257c52de0a12e774a921d21c35 100644 --- a/pages/composition-api/reactivity/readonly/readonly.test.js +++ b/pages/composition-api/reactivity/readonly/readonly.test.js @@ -37,7 +37,7 @@ describe('ref', () => { expect(await dataStr.text()).toBe('data.str: new str') expect(await dataNum.text()).toBe('data.num: 1') - expect(await dataArr.text()).toBe(isWeb ? 'data.arr: [\n"a",\n"b",\n"c",\n"d"]' : 'data.arr: ["a","b","c","d"]') + expect(await dataArr.text()).toBe(isWeb ? 'data.arr: [\n"a",\n"b",\n"c",\n"d"\n]' : 'data.arr: ["a","b","c","d"]') expect(await readonlyDataStr.text()).toBe('readonly data.str: new str') expect(await readonlyDataNum.text()).toBe('readonly data.num: 1') expect(await readonlyDataArr.text()).toBe(isWeb ? 'readonly data.arr: [\n"a",\n"b",\n"c",\n"d"\n]' : 'readonly data.arr: ["a","b","c","d"]') diff --git a/pages/composition-api/reactivity/shallow-readonly/shallow-readonly.test.js b/pages/composition-api/reactivity/shallow-readonly/shallow-readonly.test.js index da7322966512295be25c9930b30c28294cf922ce..5e022f644d48d450b3165420e3db0a33071d38b6 100644 --- a/pages/composition-api/reactivity/shallow-readonly/shallow-readonly.test.js +++ b/pages/composition-api/reactivity/shallow-readonly/shallow-readonly.test.js @@ -13,6 +13,11 @@ describe('shallowReadonly', () => { let stateNestedCount = await page.$('#state-nested-count') expect(await stateNestedCount.text()).toBe('state.nested.count: 0') + if (process.env.uniTestPlatformInfo.startsWith('web')) { + // web端操作readonly对象会直接编译失败,以下测试无法执行 + return + } + const incrementStateCountBtn = await page.$('#increment-state-count-btn') await incrementStateCountBtn.tap() diff --git a/pages/composition-api/reactivity/to-refs/to-refs.test.js b/pages/composition-api/reactivity/to-refs/to-refs.test.js index 13eb10e0bee2d4a4db603f1d22c5a15bdc1ba744..dde664be84aa8f10c4a97e8e546450d6b8f0ca9b 100644 --- a/pages/composition-api/reactivity/to-refs/to-refs.test.js +++ b/pages/composition-api/reactivity/to-refs/to-refs.test.js @@ -1,6 +1,13 @@ const PAGE_PATH = '/pages/composition-api/reactivity/to-refs/to-refs' describe('toRefs', () => { + if (process.env.uniTestPlatformInfo.startsWith('web')) { + // TODO: web 端暂不支持 + it('web', async () => { + expect(1).toBe(1) + }) + return + } let page = null beforeAll(async () => { page = await program.reLaunch(PAGE_PATH) diff --git a/pages/composition-api/reactivity/watch-post-effect/watch-post-effect.test.js b/pages/composition-api/reactivity/watch-post-effect/watch-post-effect.test.js index 7479d4aa793278bc59fe2156945a979020b5c4b1..cfd4a865407df645180dff1a05dc0f8c4fc25bb6 100644 --- a/pages/composition-api/reactivity/watch-post-effect/watch-post-effect.test.js +++ b/pages/composition-api/reactivity/watch-post-effect/watch-post-effect.test.js @@ -102,7 +102,10 @@ describe('watchPostEffect', () => { expect(await objArr.text()).toBe(isWeb ? 'obj.arr: [\n0,\n1\n]' : 'obj.arr: [0,1]') expect(await watchObjRes.text()).toBe( - 'watch obj result: obj: {"arr":[0],"bool":false,"num":0,"str":"num: 0"}') + isWeb ? + 'watch obj result: obj: {"num":0,"str":"num: 0","bool":false,"arr":[0]}' : + 'watch obj result: obj: {"arr":[0],"bool":false,"num":0,"str":"num: 0"}' + ) expect(await watchObjStrRes.text()).toBe( 'watch obj.str result: str: num: 1, obj.str ref text: obj.str: num: 1') expect(await watchObjArrRes.text()).toBe(isWeb ? 'watch obj.arr result: arr: [\n0,\n1\n]' : diff --git a/pages/composition-api/reactivity/watch-sync-effect/watch-sync-effect.test.js b/pages/composition-api/reactivity/watch-sync-effect/watch-sync-effect.test.js index 036244c29a5a482cb36d777796a3ab708032d3c2..772f669fac817105ced0947c3aacb4eff6e94651 100644 --- a/pages/composition-api/reactivity/watch-sync-effect/watch-sync-effect.test.js +++ b/pages/composition-api/reactivity/watch-sync-effect/watch-sync-effect.test.js @@ -96,7 +96,7 @@ describe('watchSyncEffect', () => { expect(await objStr.text()).toBe('obj.str: num: 1') expect(await objNum.text()).toBe('obj.num: 1') expect(await objBool.text()).toBe('obj.bool: true') - expect(await objArr.text()).toBe('obj.arr: [0,1]') + expect(await objArr.text()).toBe(isWeb ? 'obj.arr: [\n0,\n1\n]' : 'obj.arr: [0,1]') expect(await watchObjRes.text()).toBe( 'watch obj result: obj: {"arr":[0],"bool":false,"num":0,"str":"num: 0"}') diff --git a/pages/composition/setup/setup.test.js b/pages/composition/setup/setup.test.js index e74b1d852b0fe9913b27fdbdb66404f94c7c4fc5..4f9f4f5c6852961db2866f1df08afe3ba69edf1a 100644 --- a/pages/composition/setup/setup.test.js +++ b/pages/composition/setup/setup.test.js @@ -44,8 +44,10 @@ describe('options setup', () => { const count = await page.$('#count') expect(await count.text()).toBe('count: 1') - const propsCount = await page.$('#props-count') - expect(await propsCount.text()).toBe('props.count: 1') + if (!process.env.uniTestPlatformInfo.startsWith('web')) { + const propsCount = await page.$('#props-count') + expect(await propsCount.text()).toBe('props.count: 1') + } const updateObjBtn = await page.$('#update-obj-btn') await updateObjBtn.tap()