diff --git a/pages/API/navigator/new-page/onLoad.test.js b/pages/API/navigator/new-page/onLoad.test.js index 7708452ba04273098bec9bd9bc41a5b0e2c8e4a0..2a214292c655c51ab12702f7a7165050c47c21ae 100644 --- a/pages/API/navigator/new-page/onLoad.test.js +++ b/pages/API/navigator/new-page/onLoad.test.js @@ -9,7 +9,7 @@ describe("onLoad", () => { page = await program.reLaunch(INTERMEDIATE_PAGE_PATH); await page.waitFor('view'); await page.callMethod("navigateToOnLoadWithType", "adjustData"); - await page.waitFor(500); + await page.waitFor(100); const image = await program.screenshot(); expect(image).toMatchImageSnapshot(); }); @@ -17,7 +17,7 @@ describe("onLoad", () => { page = await program.reLaunch(INTERMEDIATE_PAGE_PATH); await page.waitFor('view'); await page.callMethod("navigateToOnLoadWithType", "navigateTo"); - await page.waitFor(500); + await page.waitFor(100); page = await program.currentPage(); expect(page.path).toBe(TARGET_PAGE_PATH.substring(1)); }); @@ -33,7 +33,7 @@ describe("onLoad", () => { page = await program.reLaunch(INTERMEDIATE_PAGE_PATH); await page.waitFor('view'); await page.callMethod("navigateToOnLoadWithType", "redirectTo"); - await page.waitFor(500); + await page.waitFor(100); page = await program.currentPage(); expect(page.path).toBe(TARGET_PAGE_PATH.substring(1)); }); @@ -41,7 +41,7 @@ describe("onLoad", () => { page = await program.reLaunch(INTERMEDIATE_PAGE_PATH); await page.waitFor('view'); await page.callMethod("navigateToOnLoadWithType", "reLaunch"); - await page.waitFor(500); + await page.waitFor(100); page = await program.currentPage(); expect(page.path).toBe(TARGET_PAGE_PATH.substring(1)); }); @@ -50,44 +50,40 @@ describe("onLoad", () => { await page.waitFor('view'); await page.callMethod("navigateToOnLoadWithType", "switchTab"); page = await program.currentPage(); - await page.waitFor('view'); + await page.waitFor(100); expect(page.path).toBe("pages/tabBar/component"); }); - // toast 出现在 INTERMEDIATE_PAGE_PATH 页面(非 onLoad 生命周期所在页面) - // 当 navigateTo 到 onLoad 页面时,toast 会被关闭 - // it("showToast", async () => { - // page = await program.reLaunch(INTERMEDIATE_PAGE_PATH); - // await page.waitFor(500); - // await page.callMethod("navigateToOnLoadWithType", "showToast"); - // await page.waitFor(1000); - // const image = await program.screenshot(); - // expect(image).toMatchImageSnapshot(); - // }); - // 同 toast - // it("showLoading", async () => { - // page = await program.reLaunch(INTERMEDIATE_PAGE_PATH); - // await page.waitFor('view'); - // await page.callMethod("navigateToOnLoadWithType", "showLoading"); - // await page.waitFor(1000); - // const image = await program.screenshot(); - // expect(image).toMatchImageSnapshot(); - // }); - // 同 toast - // it("showModal", async () => { - // page = await program.reLaunch(INTERMEDIATE_PAGE_PATH); - // await page.waitFor('view'); - // await page.callMethod("navigateToOnLoadWithType", "showModal"); - // await page.waitFor(1000); - // const image = await program.screenshot(); - // expect(image).toMatchImageSnapshot(); - // }); - // 同 toast - // it("showActionSheet", async () => { - // page = await program.reLaunch(INTERMEDIATE_PAGE_PATH); - // await page.waitFor('view'); - // await page.callMethod("navigateToOnLoadWithType", "showActionSheet"); - // await page.waitFor(1000); - // const image = await program.screenshot(); - // expect(image).toMatchImageSnapshot(); - // }); + it("showToast", async () => { + page = await program.reLaunch(INTERMEDIATE_PAGE_PATH); + await page.waitFor('view'); + await page.callMethod("navigateToOnLoadWithType", "showToast"); + await page.waitFor(500); + const image = await program.screenshot({adb: true, area: {x: 0, y: 200}}); + expect(image).toMatchImageSnapshot(); + await page.waitFor('view'); + }); + it("showLoading", async () => { + page = await program.reLaunch(INTERMEDIATE_PAGE_PATH); + await page.waitFor('view'); + await page.callMethod("navigateToOnLoadWithType", "showLoading"); + await page.waitFor(500); + const image = await program.screenshot({adb: true, area: {x: 0, y: 200}}); + expect(image).toMatchImageSnapshot(); + }); + it("showModal", async () => { + page = await program.reLaunch(INTERMEDIATE_PAGE_PATH); + await page.waitFor('view'); + await page.callMethod("navigateToOnLoadWithType", "showModal"); + await page.waitFor(500); + const image = await program.screenshot({adb: true, area: {x: 0, y: 200}}); + expect(image).toMatchImageSnapshot(); + }); + it("showActionSheet", async () => { + page = await program.reLaunch(INTERMEDIATE_PAGE_PATH); + await page.waitFor('view'); + await page.callMethod("navigateToOnLoadWithType", "showActionSheet"); + await page.waitFor(500); + const image = await program.screenshot({adb: true, area: {x: 0, y: 200}}); + expect(image).toMatchImageSnapshot(); + }); });