提交 37761836 编写于 作者: 杜庆泉's avatar 杜庆泉

prompt 优化自动化测试截图区域,避免某些型号系统区域影响对比结果

上级 9394e36f
......@@ -23,7 +23,7 @@ describe('API-loading', () => {
area: {
x: 0,
y: 200,
height: windowHeight,
height: windowHeight - 100,
width:windowWidth
},
});
......@@ -64,7 +64,7 @@ describe('API-loading', () => {
area: {
x: 0,
y: 200,
height: windowHeight,
height: windowHeight - 100,
width:windowWidth
},
});
......@@ -106,7 +106,7 @@ describe('API-loading', () => {
area: {
x: 0,
y: 200,
height: windowHeight,
height: windowHeight - 100,
width:windowWidth
},
});
......@@ -147,7 +147,7 @@ describe('API-loading', () => {
area: {
x: 0,
y: 200,
height: windowHeight,
height: windowHeight - 100,
width:windowWidth
},
});
......@@ -188,7 +188,7 @@ describe('API-loading', () => {
area: {
x: 0,
y: 200,
height: windowHeight,
height: windowHeight - 100,
width:windowWidth
},
});
......@@ -229,7 +229,7 @@ describe('API-loading', () => {
area: {
x: 0,
y: 200,
height: windowHeight,
height: windowHeight - 100,
width:windowWidth
},
});
......@@ -273,7 +273,7 @@ describe('API-loading', () => {
area: {
x: 0,
y: 200,
height: windowHeight,
height: windowHeight - 100,
width:windowWidth
},
});
......@@ -314,7 +314,7 @@ describe('API-loading', () => {
area: {
x: 0,
y: 200,
height: windowHeight,
height: windowHeight - 100,
width:windowWidth
},
});
......@@ -355,7 +355,7 @@ describe('API-loading', () => {
area: {
x: 0,
y: 200,
height: windowHeight,
height: windowHeight - 100,
width:windowWidth
},
});
......@@ -396,7 +396,7 @@ describe('API-loading', () => {
area: {
x: 0,
y: 200,
height: windowHeight,
height: windowHeight - 100,
width:windowWidth
},
});
......@@ -438,7 +438,7 @@ describe('API-loading', () => {
area: {
x: 0,
y: 200,
height: windowHeight,
height: windowHeight - 100,
width:windowWidth
},
});
......@@ -479,7 +479,7 @@ describe('API-loading', () => {
area: {
x: 0,
y: 200,
height: windowHeight,
height: windowHeight - 100,
width:windowWidth
},
});
......@@ -520,7 +520,7 @@ describe('API-loading', () => {
area: {
x: 0,
y: 200,
height: windowHeight,
height: windowHeight - 100,
width:windowWidth
},
});
......
......@@ -16,13 +16,15 @@ describe('API-loading', () => {
if (isAndroid) {
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
const windowWidth = res.windowWidth * res.pixelRatio;
const image = await program.screenshot({
adb: true,
area: {
x: 0,
y: 200,
height: windowHeight,
height: windowHeight - 200,
width:windowWidth
},
});
expect(image).toMatchImageSnapshot();
......@@ -54,13 +56,15 @@ describe('API-loading', () => {
if (isAndroid) {
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
const windowWidth = res.windowWidth * res.pixelRatio;
const image = await program.screenshot({
adb: true,
area: {
x: 0,
y: 200,
height: windowHeight,
height: windowHeight - 200,
width:windowWidth
},
});
expect(image).toMatchImageSnapshot();
......@@ -93,13 +97,15 @@ describe('API-loading', () => {
if (isAndroid) {
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
const windowWidth = res.windowWidth * res.pixelRatio;
const image = await program.screenshot({
adb: true,
area: {
x: 0,
y: 200,
height: windowHeight,
height: windowHeight - 200,
width:windowWidth
},
});
expect(image).toMatchImageSnapshot();
......@@ -132,13 +138,15 @@ describe('API-loading', () => {
if (isAndroid) {
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
const windowWidth = res.windowWidth * res.pixelRatio;
const image = await program.screenshot({
adb: true,
area: {
x: 0,
y: 200,
height: windowHeight,
height: windowHeight - 200,
width:windowWidth
},
});
expect(image).toMatchImageSnapshot();
......@@ -171,13 +179,15 @@ describe('API-loading', () => {
if (isAndroid) {
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
const windowWidth = res.windowWidth * res.pixelRatio;
const image = await program.screenshot({
adb: true,
area: {
x: 0,
y: 200,
height: windowHeight,
height: windowHeight - 200,
width:windowWidth
},
});
expect(image).toMatchImageSnapshot();
......@@ -210,13 +220,14 @@ describe('API-loading', () => {
if (isAndroid) {
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
const windowWidth = res.windowWidth * res.pixelRatio;
const image = await program.screenshot({
adb: true,
area: {
x: 0,
y: 200,
height: windowHeight,
height: windowHeight - 200,
width:windowWidth
},
});
expect(image).toMatchImageSnapshot();
......@@ -249,13 +260,14 @@ describe('API-loading', () => {
if (isAndroid) {
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
const windowWidth = res.windowWidth * res.pixelRatio;
const image = await program.screenshot({
adb: true,
area: {
x: 0,
y: 200,
height: windowHeight,
height: windowHeight - 200,
width:windowWidth
},
});
expect(image).toMatchImageSnapshot();
......@@ -288,13 +300,14 @@ describe('API-loading', () => {
if (isAndroid) {
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
const windowWidth = res.windowWidth * res.pixelRatio;
const image = await program.screenshot({
adb: true,
area: {
x: 0,
y: 200,
height: windowHeight,
height: windowHeight - 200,
width:windowWidth
},
});
expect(image).toMatchImageSnapshot();
......@@ -327,13 +340,14 @@ describe('API-loading', () => {
if (isAndroid) {
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
const windowWidth = res.windowWidth * res.pixelRatio;
const image = await program.screenshot({
adb: true,
area: {
x: 0,
y: 200,
height: windowHeight,
height: windowHeight - 200,
width:windowWidth
},
});
expect(image).toMatchImageSnapshot();
......@@ -366,13 +380,15 @@ describe('API-loading', () => {
if (isAndroid) {
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
const windowWidth = res.windowWidth * res.pixelRatio;
const image = await program.screenshot({
adb: true,
area: {
x: 0,
y: 200,
height: windowHeight,
height: windowHeight - 200,
width:windowWidth
},
});
expect(image).toMatchImageSnapshot();
......@@ -405,13 +421,15 @@ describe('API-loading', () => {
if (isAndroid) {
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
const windowWidth = res.windowWidth * res.pixelRatio;
const image = await program.screenshot({
adb: true,
area: {
x: 0,
y: 200,
height: windowHeight,
height: windowHeight - 200,
width:windowWidth
},
});
expect(image).toMatchImageSnapshot();
......@@ -444,13 +462,15 @@ describe('API-loading', () => {
if (isAndroid) {
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
const windowWidth = res.windowWidth * res.pixelRatio;
const image = await program.screenshot({
adb: true,
area: {
x: 0,
y: 200,
height: windowHeight,
height: windowHeight - 200,
width:windowWidth
},
});
expect(image).toMatchImageSnapshot();
......@@ -483,13 +503,15 @@ describe('API-loading', () => {
if (isAndroid) {
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
const windowWidth = res.windowWidth * res.pixelRatio;
const image = await program.screenshot({
adb: true,
area: {
x: 0,
y: 200,
height: windowHeight,
height: windowHeight - 200,
width:windowWidth
},
});
expect(image).toMatchImageSnapshot();
......@@ -522,13 +544,15 @@ describe('API-loading', () => {
if (isAndroid) {
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
const windowWidth = res.windowWidth * res.pixelRatio;
const image = await program.screenshot({
adb: true,
area: {
x: 0,
y: 200,
height: windowHeight,
height: windowHeight - 200,
width:windowWidth
},
});
expect(image).toMatchImageSnapshot();
......@@ -561,13 +585,15 @@ describe('API-loading', () => {
if (isAndroid) {
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
const windowWidth = res.windowWidth * res.pixelRatio;
const image = await program.screenshot({
adb: true,
area: {
x: 0,
y: 200,
height: windowHeight,
height: windowHeight - 200,
width:windowWidth
},
});
expect(image).toMatchImageSnapshot();
......@@ -601,13 +627,14 @@ describe('API-loading', () => {
if (isAndroid) {
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
const windowWidth = res.windowWidth * res.pixelRatio;
const image = await program.screenshot({
adb: true,
area: {
x: 0,
y: 200,
height: windowHeight,
height: windowHeight - 200,
width:windowWidth
},
});
expect(image).toMatchImageSnapshot();
......@@ -640,13 +667,15 @@ describe('API-loading', () => {
if (isAndroid) {
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
const windowWidth = res.windowWidth * res.pixelRatio;
const image = await program.screenshot({
adb: true,
area: {
x: 0,
y: 200,
height: windowHeight,
height: windowHeight - 200,
width:windowWidth
},
});
expect(image).toMatchImageSnapshot();
......@@ -679,13 +708,14 @@ describe('API-loading', () => {
if (isAndroid) {
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
const windowWidth = res.windowWidth * res.pixelRatio;
const image = await program.screenshot({
adb: true,
area: {
x: 0,
y: 200,
height: windowHeight,
height: windowHeight - 200,
width:windowWidth
},
});
expect(image).toMatchImageSnapshot();
......
......@@ -5,6 +5,7 @@ describe('API-toast', () => {
let page;
const isAndroid = process.env.UNI_OS_NAME === "android";
beforeAll(async () => {
page = await program.reLaunch('/pages/API/toast/toast')
await page.waitFor(600);
......@@ -13,12 +14,21 @@ describe('API-toast', () => {
it("onload-toast-test", async () => {
if (isAndroid) {
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
const windowWidth = res.windowWidth * res.pixelRatio;
const image = await program.screenshot({
adb: true,
area: {
x: 0,
y: 200,
height: windowHeight - 200,
width:windowWidth
},
});
expect(image).toMatchImageSnapshot();
......@@ -38,11 +48,18 @@ describe('API-toast', () => {
await btnToastDefaultButton.tap()
await page.waitFor(200)
if (isAndroid) {
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
const windowWidth = res.windowWidth * res.pixelRatio;
const image = await program.screenshot({
adb: true,
area: {
x: 0,
y: 200,
height: windowHeight - 200,
width:windowWidth
},
});
expect(image).toMatchImageSnapshot();
......@@ -62,11 +79,16 @@ describe('API-toast', () => {
await btnToastDurationButton.tap()
await page.waitFor(2000)
if (isAndroid) {
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
const windowWidth = res.windowWidth * res.pixelRatio;
const image = await program.screenshot({
adb: true,
area: {
x: 0,
y: 200,
height: windowHeight - 200,
width:windowWidth
},
});
expect(image).toMatchImageSnapshot();
......@@ -84,11 +106,16 @@ describe('API-toast', () => {
await btnToastErrorIconButton.tap()
await page.waitFor(200)
if (isAndroid) {
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
const windowWidth = res.windowWidth * res.pixelRatio;
const image = await program.screenshot({
adb: true,
area: {
x: 0,
y: 200,
height: windowHeight - 200,
width:windowWidth
},
});
expect(image).toMatchImageSnapshot();
......@@ -112,11 +139,16 @@ describe('API-toast', () => {
await page.waitFor(200)
if (isAndroid) {
const res = await page.callMethod('jest_getWindowInfo')
const windowHeight = res.windowHeight * res.pixelRatio;
const windowWidth = res.windowWidth * res.pixelRatio;
const image = await program.screenshot({
adb: true,
area: {
x: 0,
y: 200,
height: windowHeight - 200,
width:windowWidth
},
});
expect(image).toMatchImageSnapshot();
......
......@@ -37,6 +37,10 @@
}, 2000);
},
methods: {
//自动化测试例专用
jest_getWindowInfo() : GetWindowInfoResult {
return uni.getWindowInfo();
},
toast1Tap: function () {
uni.showToast({
title: "默认",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册