提交 d1848671 编写于 作者: W WOSHIMAHAIFENG

pay自动化测试

上级 a847f5f0
...@@ -13,7 +13,7 @@ describe("payment", () => { ...@@ -13,7 +13,7 @@ describe("payment", () => {
await page.setData({ await page.setData({
orderinfo: orderInfo, orderinfo: orderInfo,
}) })
await page.callMethod('pay') await page.callMethod('jest_pay')
await page.waitFor(10000); await page.waitFor(10000);
expect((await page.data())['errorCode']).toEqual(700711) expect((await page.data())['errorCode']).toEqual(700711)
}); });
...@@ -25,7 +25,7 @@ describe("payment", () => { ...@@ -25,7 +25,7 @@ describe("payment", () => {
await page.setData({ await page.setData({
orderinfo: orderInfo, orderinfo: orderInfo,
}) })
await page.callMethod('pay') await page.callMethod('jest_pay')
await page.waitFor(6000); await page.waitFor(6000);
expect((await page.data())['errorCode']).toEqual(700712) expect((await page.data())['errorCode']).toEqual(700712)
}); });
......
...@@ -49,6 +49,20 @@ ...@@ -49,6 +49,20 @@
uni.hideLoading() uni.hideLoading()
}, },
}); });
},
//自动化测试使用
jest_pay() {
uni.requestPayment({
provider: "alipay",
orderInfo: this.orderInfo,
fail: (res : RequestPaymentFail) => {
console.log(JSON.stringify(res))
this.errorCode = res.errCode
},
success: (res : RequestPaymentSuccess) => {
console.log(JSON.stringify(res))
}
} as RequestPaymentOptions)
} }
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册