get-app-authorize-setting.test.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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-app-authorize-setting/get-app-authorize-setting'
  5. describe('ExtApi-GetAppAuthorizeSetting', () => {
  6. if (isWeb || isAppWebView) {
  7. it('dummyTest', () => {
  8. expect(1).toBe(1)
  9. })
  10. return
  11. }
  12. let page;
  13. let res;
  14. let commonSupportList = [
  15. 'authorized', 'denied', 'not determined', 'config error'
  16. ]
  17. let locationAccuracySupportList = [
  18. 'reduced', 'full', 'unsupported'
  19. ]
  20. beforeAll(async () => {
  21. page = await program.reLaunch(PAGE_PATH)
  22. await page.waitFor(600);
  23. res = await uni.getAppAuthorizeSetting();
  24. });
  25. it('Check albumAuthorized', async () => {
  26. expect(commonSupportList).toContain(res.albumAuthorized)
  27. });
  28. it('Check bluetoothAuthorized', async () => {
  29. expect(commonSupportList).toContain(res.bluetoothAuthorized)
  30. });
  31. it('Check cameraAuthorized', async () => {
  32. expect(commonSupportList).toContain(res.cameraAuthorized)
  33. });
  34. it('Check locationAuthorized', async () => {
  35. expect(commonSupportList).toContain(res.locationAuthorized)
  36. });
  37. it('Check locationAccuracy', async () => {
  38. expect(locationAccuracySupportList).toContain(res.locationAccuracy)
  39. });
  40. it('Check microphoneAuthorized', async () => {
  41. expect(commonSupportList).toContain(res.microphoneAuthorized)
  42. });
  43. it('Check notificationAuthorized', async () => {
  44. expect(commonSupportList).toContain(res.notificationAuthorized)
  45. });
  46. });