提交 98ff7ab1 编写于 作者: W WOSHIMAHAIFENG

修改测试用例

上级 6015c53b
......@@ -9,24 +9,14 @@ describe("payment", () => {
//支付失败700711
it("errorcode700711", async () => {
let orderInfo =
"service=\"111";
"service=\"mobile.securitypay.pay\"&partner=\"2088801273866834\"&_input_charset=\"UTF-8\"&out_trade_no=\"20240229115452\"&subject=\"DCloud项目捐赠\"&payment_type=\"1\"&seller_id=\"payservice@dcloud.io\"&total_fee=\"0.01\"&body=\"DCloud致力于打造HTML5最好的移动开发工具,包括终端的Runtime、云端的服务和IDE,同时提供各项配套的开发者服务。\"&it_b_pay=\"1d\"&notify_url=\"http%3A%2F%2Fdemo.dcloud.net.cn%2Fpayment%2Falipay%2Fnotify.php\"&show_url=\"http%3A%2F%2Fwww.dcloud.io%2Fhelloh5%2F\"&sign=\"diZdkTX2iIP1oZh25UCGqx%2BpkViqAN8xdvMNSJF79aq0JiunX2mtr%2BbNlDsP0YL5x85KjULsqx%2Fq%2B5wij6eMoBVeJ%2BHhyjkwt0PYuwntroJ2Ho8bdUVEybBgOjy240NbCUtKmZzNRQAGsmLztKWzsg1srsQ8Se3Qi8KGDaOhqBs%3D\"&sign_type=\"RSA\"";
await page.setData({
orderinfo: orderInfo,
})
await page.callMethod('jest_pay')
await page.waitFor(10000);
await page.waitFor(async () => {
return await page.data('complete') === true;
});
expect((await page.data())['errorCode']).toEqual(700711)
});
//重复支付
it("errorcode700712", async () => {
let orderInfo=
"service=\"mobile.securitypay.pay\"&partner=\"2088801273866834\"&_input_charset=\"UTF-8\"&out_trade_no=\"20240226180607\"&subject=\"DCloud项目捐赠\"&payment_type=\"1\"&seller_id=\"payservice@dcloud.io\"&total_fee=\"0.01\"&body=\"DCloud致力于打造HTML5最好的移动开发工具,包括终端的Runtime、云端的服务和IDE,同时提供各项配套的开发者服务。\"&it_b_pay=\"1d\"&notify_url=\"http%3A%2F%2Fdemo.dcloud.net.cn%2Fpayment%2Falipay%2Fnotify.php\"&show_url=\"http%3A%2F%2Fwww.dcloud.io%2Fhelloh5%2F\"&sign=\"iYxQ8EmMdezAWPMGIFXifBoEkotH0Fg%2BLbNNgAP%2F%2BJquO0rLgoxgF8b%2Fo5lhUIQT7MkDf2JacmHvrUAZqQAuL%2BaPG%2BCOUu7hMu7zlZt3k7%2F1sUv9HFxP%2FhCFssfpZXhpTGEkttF6CmF7YQueCtxsAYBqBpQsVwGb2Pxi01ylko0%3D\"&sign_type=\"RSA\"";
await page.setData({
orderinfo: orderInfo,
})
await page.callMethod('jest_pay')
await page.waitFor(6000);
expect((await page.data())['errorCode']).toEqual(700712)
});
});
......@@ -11,7 +11,8 @@
btnType: "primary",
orderInfo: "",
errorCode: 0,
errorMsg: ""
errorMsg: "",
complete: false
}
},
methods: {
......@@ -49,18 +50,19 @@
uni.hideLoading()
},
});
},
},
//自动化测试使用
jest_pay() {
uni.requestPayment({
provider: "alipay",
orderInfo: this.orderInfo,
fail: (res : RequestPaymentFail) => {
console.log(JSON.stringify(res))
this.errorCode = res.errCode
this.errorCode = res.errCode
this.complete = true
},
success: (res : RequestPaymentSuccess) => {
console.log(JSON.stringify(res))
console.log(JSON.stringify(res))
this.complete = true
}
} as RequestPaymentOptions)
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册