get-battery-info.test.js 851 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. const PAGE_PATH = '/pages/API/get-battery-info/get-battery-info'
  2. describe('ExtApi-GetBatteryInfo', () => {
  3. if (process.env.uniTestPlatformInfo.indexOf('web') > -1) {
  4. it('dummyTest', () => {
  5. expect(1).toBe(1)
  6. })
  7. return
  8. }
  9. if(process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) {
  10. it('dummyTest', () => {
  11. expect(1).toBe(1)
  12. })
  13. return
  14. }
  15. let page;
  16. let res;
  17. const numberProperties = [
  18. 'level'
  19. ]
  20. beforeAll(async () => {
  21. page = await program.reLaunch(PAGE_PATH)
  22. await page.waitFor(600);
  23. res = await page.data();
  24. });
  25. it('Check properties', async () => {
  26. for (const key in res) {
  27. const value = res[key];
  28. expect(value).not.toBeNull();
  29. if (numberProperties.indexOf(key) != -1) {
  30. expect(value).toBeGreaterThanOrEqual(0);
  31. }
  32. }
  33. });
  34. });