provider.test.js 1.3 KB
Newer Older
DCloud-WZF's avatar
DCloud-WZF 已提交
1 2 3
const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
const isMP = platformInfo.startsWith('mp')
const PAGE_PATH = "/pages/API/provider/provider";
4 5

describe("provider", () => {
DCloud-WZF's avatar
DCloud-WZF 已提交
6 7 8 9 10 11 12
  if (isMP) {
  	it('skip mp', () => {
  		expect(1).toBe(1)
  	})
  	return
  }

13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
  if (process.env.uniTestPlatformInfo.indexOf('web') > -1 || process.env.UNI_AUTOMATOR_APP_WEBVIEW === 'true') {
    it('web', () => {
      expect(1).toBe(1)
    })
    return
  }
  beforeAll(async () => {
    page = await program.reLaunch(PAGE_PATH)
    await page.waitFor(600)
  });
  it("test getprovider", async () => {
    await page.callMethod('getProvider');
    await page.waitFor(1000);
    let providerIds = await page.data('providerIds')

    expect(providerIds[0]).toEqual('wxpay')
    expect(providerIds[1]).toEqual('alipay')
    expect(providerIds[2]).toEqual('system')
    expect(providerIds[3]).toEqual('tencent')
M
mahaifeng 已提交
32 33 34 35 36 37 38

    let providerObjects = await page.data('providerObjects')
    expect(providerObjects[0].description).toEqual('微信支付')
    expect(providerObjects[1].description).toEqual('支付宝')
    expect(providerObjects[2].description).toEqual('系统定位')
    expect(providerObjects[3].description).toEqual('腾讯定位')
    expect(providerObjects.length).toEqual(4)
39 40
  });
});