reqeust-payment.test.js 1.6 KB
Newer Older
M
mahaifeng 已提交
1 2 3
const PAGE_PATH =
  "/pages/API/request-payment/request-payment";

雪洛's avatar
雪洛 已提交
4
describe("payment", () => {
5
  if (process.env.uniTestPlatformInfo.indexOf('web') > -1 || process.env.UNI_AUTOMATOR_APP_WEBVIEW === 'true') {
雪洛's avatar
雪洛 已提交
6 7 8 9
    it('web', () => {
      expect(1).toBe(1)
    })
    return
10 11 12 13 14 15
  }
  if (process.env.uniTestPlatformInfo.toLocaleLowerCase().startsWith('ios')) {
    it('ios', () => {
      expect(1).toBe(1)
    })
    return
雪洛's avatar
雪洛 已提交
16
  }
M
mahaifeng 已提交
17 18 19 20
  beforeAll(async () => {
    page = await program.reLaunch(PAGE_PATH)
    await page.waitFor(600)
  });
M
mahaifeng 已提交
21 22
  //支付失败701100
  it("errorcode701100", async () => {
M
mahaifeng 已提交
23
    let orderInfo =
W
WOSHIMAHAIFENG 已提交
24
      "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\"";
M
mahaifeng 已提交
25 26 27
    await page.setData({
      orderinfo: orderInfo,
    })
W
WOSHIMAHAIFENG 已提交
28
    await page.callMethod('jest_pay')
W
WOSHIMAHAIFENG 已提交
29 30 31
    await page.waitFor(async () => {
      return await page.data('complete') === true;
    });
M
mahaifeng 已提交
32
    expect((await page.data())['errorCode']).toEqual(701100)
M
mahaifeng 已提交
33 34
  });
});