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

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

上级 4aeed860
......@@ -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();
});
});
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册