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

test: ios 支持 webview & app 截图对比

上级 dc05c6c5
...@@ -243,6 +243,10 @@ describe("shot-compare", () => { ...@@ -243,6 +243,10 @@ describe("shot-compare", () => {
shouldCompareScreenShot = version > 9 shouldCompareScreenShot = version > 9
} }
if(process.env.uniTestPlatformInfo.startsWith('IOS') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) {
shouldCompareScreenShot = true
}
if (!shouldCompareScreenShot) { if (!shouldCompareScreenShot) {
it("other platform not support", async () => { it("other platform not support", async () => {
expect(1).toBe(1); expect(1).toBe(1);
...@@ -299,6 +303,7 @@ describe("shot-compare", () => { ...@@ -299,6 +303,7 @@ describe("shot-compare", () => {
const screenshotPath = `__webview__${pages[pageIndex].replace(/\//g, "-")}`; const screenshotPath = `__webview__${pages[pageIndex].replace(/\//g, "-")}`;
// web in webview screenshot // web in webview screenshot
let startTime = Date.now();
// 加载依赖页面 // 加载依赖页面
if (childToParentPagesMap.get(pages[pageIndex])) { if (childToParentPagesMap.get(pages[pageIndex])) {
await page.setData({ await page.setData({
...@@ -316,8 +321,7 @@ describe("shot-compare", () => { ...@@ -316,8 +321,7 @@ describe("shot-compare", () => {
isLoaded: false, isLoaded: false,
isCustomNavigationBar, isCustomNavigationBar,
}); });
startTime = Date.now();
const startTime = Date.now();
await page.waitFor(async () => { await page.waitFor(async () => {
const isLoaded = await page.data("isLoaded"); const isLoaded = await page.data("isLoaded");
return isLoaded || Date.now() - startTime > 3000; return isLoaded || Date.now() - startTime > 3000;
......
...@@ -242,6 +242,10 @@ describe("shot-compare", () => { ...@@ -242,6 +242,10 @@ describe("shot-compare", () => {
shouldCompareScreenShot = version > 9 shouldCompareScreenShot = version > 9
} }
if(process.env.uniTestPlatformInfo.startsWith('IOS') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) {
shouldCompareScreenShot = true
}
if (!shouldCompareScreenShot) { if (!shouldCompareScreenShot) {
it("other platform not support", async () => { it("other platform not support", async () => {
expect(1).toBe(1); expect(1).toBe(1);
...@@ -291,6 +295,7 @@ describe("shot-compare", () => { ...@@ -291,6 +295,7 @@ describe("shot-compare", () => {
const screenshotPath = `webview-shot__${pages[pageIndex].replace(/\//g, "-")}`; const screenshotPath = `webview-shot__${pages[pageIndex].replace(/\//g, "-")}`;
// web in webview screenshot // web in webview screenshot
let startTime = Date.now();
// 加载依赖页面 // 加载依赖页面
if (childToParentPagesMap.get(pages[pageIndex])) { if (childToParentPagesMap.get(pages[pageIndex])) {
await page.setData({ await page.setData({
...@@ -309,7 +314,7 @@ describe("shot-compare", () => { ...@@ -309,7 +314,7 @@ describe("shot-compare", () => {
needRemoveWebHead: !isNeedAdbScreenshot, needRemoveWebHead: !isNeedAdbScreenshot,
}); });
const startTime = Date.now(); startTime = Date.now();
await page.waitFor(async () => { await page.waitFor(async () => {
const isLoaded = await page.data("isLoaded"); const isLoaded = await page.data("isLoaded");
return isLoaded || Date.now() - startTime > 3000; return isLoaded || Date.now() - startTime > 3000;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册