get-system-setting.test.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
  2. const isWeb = platformInfo.startsWith('web')
  3. const isAppWebView = process.env.UNI_AUTOMATOR_APP_WEBVIEW == 'true'
  4. const PAGE_PATH = '/pages/API/get-system-setting/get-system-setting'
  5. describe('ExtApi-GetSystemSetting', () => {
  6. if (isWeb || isAppWebView) {
  7. it('web', () => {
  8. expect(1).toBe(1)
  9. })
  10. return
  11. }
  12. let page;
  13. let res;
  14. beforeAll(async () => {
  15. page = await program.reLaunch(PAGE_PATH)
  16. await page.waitFor(600);
  17. res = await uni.getSystemSetting()
  18. });
  19. it('Check GetSystemSetting', async () => {
  20. for (const key in res) {
  21. const value = res[key];
  22. if (res['bluetoothEnabled'] == undefined || res['bluetoothEnabled'] === false) {
  23. expect(res['bluetoothError']).not.toBe("")
  24. } else {
  25. expect(res['bluetoothError'] == undefined).toBe(true)
  26. }
  27. if (res['wifiEnabled'] == undefined) {
  28. expect(res['wifiError']).not.toBe("")
  29. } else {
  30. expect(res['wifiError'] == undefined).toBe(true)
  31. }
  32. if (key == 'deviceOrientation') {
  33. expect(['portrait', 'landscape']).toContain(value);
  34. }
  35. }
  36. });
  37. });