provider.test.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
  2. const isMP = platformInfo.startsWith('mp')
  3. const isWeb = platformInfo.startsWith('web')
  4. const isHarmony = platformInfo.startsWith('harmony')
  5. const isAppWebView = process.env.UNI_AUTOMATOR_APP_WEBVIEW == 'true'
  6. const PAGE_PATH = "/pages/API/provider/provider";
  7. describe("provider", () => {
  8. if (isMP || isWeb || isAppWebView) {
  9. it('not support', () => {
  10. expect(1).toBe(1)
  11. })
  12. return
  13. }
  14. beforeAll(async () => {
  15. page = await program.reLaunch(PAGE_PATH)
  16. await page.waitFor(600)
  17. });
  18. it("test getprovider", async () => {
  19. await page.callMethod('getProvider');
  20. await page.waitFor(1000);
  21. let providerIds = await page.data('providerIds')
  22. expect(providerIds).toEqual(expect.arrayContaining(['wxpay', 'alipay', 'system']))
  23. if (!isHarmony) {
  24. expect(providerIds).toEqual(expect.arrayContaining(['tencent']))
  25. } else {
  26. expect(providerIds).toEqual(expect.arrayContaining(['huawei']))
  27. }
  28. expect(providerIds).toHaveLength(4)
  29. let providerObjects = await page.data('providerObjects')
  30. expect(providerObjects).toEqual(expect.arrayContaining(['微信支付', '支付宝', '系统定位']))
  31. if (!isHarmony) {
  32. expect(providerObjects).toEqual(expect.arrayContaining(['腾讯定位']))
  33. } else {
  34. expect(providerObjects).toEqual(expect.arrayContaining(['华为登录']))
  35. }
  36. expect(providerObjects).toHaveLength(4)
  37. });
  38. });