open-location.test.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
  2. const isMP = platformInfo.startsWith('mp')
  3. const isIos = platformInfo.startsWith('ios')
  4. const isHarmony = platformInfo.startsWith('harmony');
  5. describe('dialog page', () => {
  6. if (process.env.UNI_AUTOMATOR_APP_WEBVIEW == 'true' || isMP) {
  7. it('skip', () => {
  8. expect(1).toBe(1)
  9. })
  10. return
  11. }
  12. if (
  13. isIos &&
  14. (
  15. platformInfo.indexOf('14.5') != -1 ||
  16. platformInfo.indexOf('13.7') != -1 ||
  17. platformInfo.indexOf('12.4') != -1
  18. )
  19. ) {
  20. it('ios 14.5 及以下, xcode 版本太低, uts plugin compile fail', () => {
  21. expect(1).toBe(1)
  22. })
  23. return
  24. }
  25. let page;
  26. let originLifeCycleNum;
  27. beforeAll(async () => {
  28. page = await program.reLaunch('/pages/API/open-location/open-location')
  29. await page.waitFor('view');
  30. originLifeCycleNum = await page.callMethod('getLifeCycleNum')
  31. await page.callMethod('openLocation')
  32. await page.waitFor(2000)
  33. if (isHarmony) {
  34. console.log('before harmony tap')
  35. await program.tap({ x: 100, y: 545 })
  36. await page.waitFor(1000)
  37. }
  38. });
  39. it('dialogPage should be opened', async () => {
  40. const dialogPagesNum = await page.data('dialogPagesNum')
  41. expect(dialogPagesNum).toBe(1)
  42. })
  43. afterAll(async () => {
  44. await page.callMethod('setLifeCycleNum', originLifeCycleNum)
  45. });
  46. })