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

test: 补充 onLoad 生命周期调用弹框 API 测试

上级 4aeed860
...@@ -9,7 +9,7 @@ describe("onLoad", () => { ...@@ -9,7 +9,7 @@ describe("onLoad", () => {
page = await program.reLaunch(INTERMEDIATE_PAGE_PATH); page = await program.reLaunch(INTERMEDIATE_PAGE_PATH);
await page.waitFor('view'); await page.waitFor('view');
await page.callMethod("navigateToOnLoadWithType", "adjustData"); await page.callMethod("navigateToOnLoadWithType", "adjustData");
await page.waitFor(500); await page.waitFor(100);
const image = await program.screenshot(); const image = await program.screenshot();
expect(image).toMatchImageSnapshot(); expect(image).toMatchImageSnapshot();
}); });
...@@ -17,7 +17,7 @@ describe("onLoad", () => { ...@@ -17,7 +17,7 @@ describe("onLoad", () => {
page = await program.reLaunch(INTERMEDIATE_PAGE_PATH); page = await program.reLaunch(INTERMEDIATE_PAGE_PATH);
await page.waitFor('view'); await page.waitFor('view');
await page.callMethod("navigateToOnLoadWithType", "navigateTo"); await page.callMethod("navigateToOnLoadWithType", "navigateTo");
await page.waitFor(500); await page.waitFor(100);
page = await program.currentPage(); page = await program.currentPage();
expect(page.path).toBe(TARGET_PAGE_PATH.substring(1)); expect(page.path).toBe(TARGET_PAGE_PATH.substring(1));
}); });
...@@ -33,7 +33,7 @@ describe("onLoad", () => { ...@@ -33,7 +33,7 @@ describe("onLoad", () => {
page = await program.reLaunch(INTERMEDIATE_PAGE_PATH); page = await program.reLaunch(INTERMEDIATE_PAGE_PATH);
await page.waitFor('view'); await page.waitFor('view');
await page.callMethod("navigateToOnLoadWithType", "redirectTo"); await page.callMethod("navigateToOnLoadWithType", "redirectTo");
await page.waitFor(500); await page.waitFor(100);
page = await program.currentPage(); page = await program.currentPage();
expect(page.path).toBe(TARGET_PAGE_PATH.substring(1)); expect(page.path).toBe(TARGET_PAGE_PATH.substring(1));
}); });
...@@ -41,7 +41,7 @@ describe("onLoad", () => { ...@@ -41,7 +41,7 @@ describe("onLoad", () => {
page = await program.reLaunch(INTERMEDIATE_PAGE_PATH); page = await program.reLaunch(INTERMEDIATE_PAGE_PATH);
await page.waitFor('view'); await page.waitFor('view');
await page.callMethod("navigateToOnLoadWithType", "reLaunch"); await page.callMethod("navigateToOnLoadWithType", "reLaunch");
await page.waitFor(500); await page.waitFor(100);
page = await program.currentPage(); page = await program.currentPage();
expect(page.path).toBe(TARGET_PAGE_PATH.substring(1)); expect(page.path).toBe(TARGET_PAGE_PATH.substring(1));
}); });
...@@ -50,44 +50,40 @@ describe("onLoad", () => { ...@@ -50,44 +50,40 @@ describe("onLoad", () => {
await page.waitFor('view'); await page.waitFor('view');
await page.callMethod("navigateToOnLoadWithType", "switchTab"); await page.callMethod("navigateToOnLoadWithType", "switchTab");
page = await program.currentPage(); page = await program.currentPage();
await page.waitFor('view'); await page.waitFor(100);
expect(page.path).toBe("pages/tabBar/component"); expect(page.path).toBe("pages/tabBar/component");
}); });
// toast 出现在 INTERMEDIATE_PAGE_PATH 页面(非 onLoad 生命周期所在页面) it("showToast", async () => {
// 当 navigateTo 到 onLoad 页面时,toast 会被关闭 page = await program.reLaunch(INTERMEDIATE_PAGE_PATH);
// it("showToast", async () => { await page.waitFor('view');
// page = await program.reLaunch(INTERMEDIATE_PAGE_PATH); await page.callMethod("navigateToOnLoadWithType", "showToast");
// await page.waitFor(500); await page.waitFor(500);
// await page.callMethod("navigateToOnLoadWithType", "showToast"); const image = await program.screenshot({adb: true, area: {x: 0, y: 200}});
// await page.waitFor(1000); expect(image).toMatchImageSnapshot();
// const image = await program.screenshot(); await page.waitFor('view');
// expect(image).toMatchImageSnapshot(); });
// }); it("showLoading", async () => {
// 同 toast page = await program.reLaunch(INTERMEDIATE_PAGE_PATH);
// it("showLoading", async () => { await page.waitFor('view');
// page = await program.reLaunch(INTERMEDIATE_PAGE_PATH); await page.callMethod("navigateToOnLoadWithType", "showLoading");
// await page.waitFor('view'); await page.waitFor(500);
// await page.callMethod("navigateToOnLoadWithType", "showLoading"); const image = await program.screenshot({adb: true, area: {x: 0, y: 200}});
// await page.waitFor(1000); expect(image).toMatchImageSnapshot();
// const image = await program.screenshot(); });
// expect(image).toMatchImageSnapshot(); it("showModal", async () => {
// }); page = await program.reLaunch(INTERMEDIATE_PAGE_PATH);
// 同 toast await page.waitFor('view');
// it("showModal", async () => { await page.callMethod("navigateToOnLoadWithType", "showModal");
// page = await program.reLaunch(INTERMEDIATE_PAGE_PATH); await page.waitFor(500);
// await page.waitFor('view'); const image = await program.screenshot({adb: true, area: {x: 0, y: 200}});
// await page.callMethod("navigateToOnLoadWithType", "showModal"); expect(image).toMatchImageSnapshot();
// await page.waitFor(1000); });
// const image = await program.screenshot(); it("showActionSheet", async () => {
// expect(image).toMatchImageSnapshot(); page = await program.reLaunch(INTERMEDIATE_PAGE_PATH);
// }); await page.waitFor('view');
// 同 toast await page.callMethod("navigateToOnLoadWithType", "showActionSheet");
// it("showActionSheet", async () => { await page.waitFor(500);
// page = await program.reLaunch(INTERMEDIATE_PAGE_PATH); const image = await program.screenshot({adb: true, area: {x: 0, y: 200}});
// await page.waitFor('view'); expect(image).toMatchImageSnapshot();
// await page.callMethod("navigateToOnLoadWithType", "showActionSheet"); });
// await page.waitFor(1000);
// const image = await program.screenshot();
// expect(image).toMatchImageSnapshot();
// });
}); });
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册