report.test.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. const PAGE_PATH = '/pages/API/report/report'
  2. const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
  3. const isMP = platformInfo.startsWith('mp')
  4. const isHarmony = platformInfo.startsWith('harmony')
  5. describe('report', () => {
  6. if (isMP || isHarmony) {
  7. it('not support', () => {
  8. expect(1).toBe(1)
  9. })
  10. return
  11. }
  12. let page = null
  13. beforeAll(async () => {
  14. page = await program.navigateTo(PAGE_PATH)
  15. await page.waitFor('view')
  16. })
  17. it('Report - onLaunch', async () => {
  18. await page.callMethod('handleAppLaunch')
  19. const msg = await page.data('msg')
  20. expect(msg).toBe('onLaunch --> report:ok')
  21. })
  22. it('Report - onShow', async () => {
  23. await page.callMethod('handleAppShow')
  24. const msg = await page.data('msg')
  25. expect(msg).toBe('onAppShow --> report:ok')
  26. })
  27. it('Report - onHide', async () => {
  28. await page.callMethod('handleAppHide')
  29. const msg = await page.data('msg')
  30. expect(msg).toBe('onAppHide --> report:ok')
  31. })
  32. it('Report - onError', async () => {
  33. await page.callMethod('handleAppError')
  34. const msg = await page.data('msg')
  35. expect(msg).toBe('onAppError --> report:ok')
  36. })
  37. it('Report - customTitle', async () => {
  38. await page.callMethod('handleTitle')
  39. const msg = await page.data('msg')
  40. expect(msg).toBe('自定义title --> report:ok')
  41. })
  42. it('Report - customEvent', async () => {
  43. await page.callMethod('handleEvent')
  44. const msg = await page.data('msg')
  45. expect(msg).toBe('自定义事件 --> report:ok')
  46. })
  47. })