animation-frame.test.js 947 B

12345678910111213141516171819202122232425262728293031323334
  1. const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
  2. const isMP = platformInfo.startsWith('mp')
  3. const PAGE_PATH = '/pages/API/animation-frame/animation-frame'
  4. describe('API-cancelAnimationFrame', () => {
  5. if (isMP) {
  6. it('other platform', () => {
  7. expect(1).toBe(1)
  8. })
  9. return
  10. }
  11. let page
  12. beforeAll(async () => {
  13. page = await program.reLaunch(PAGE_PATH)
  14. await page.waitFor('view');
  15. });
  16. it('cancelAnimationFrame', async () => {
  17. await page.callMethod('startRequestAnimationFrame')
  18. await page.waitFor(100)
  19. const data1 = await page.data()
  20. expect(data1.testFrameCount > 0).toBe(true)
  21. await page.callMethod('stopRequestAnimationFrame')
  22. await page.waitFor(100)
  23. const data2 = await page.data()
  24. const testFrameCount = data2.testFrameCount
  25. await page.waitFor(100)
  26. const data3 = await page.data()
  27. expect(data3.testFrameCount).toBe(testFrameCount)
  28. });
  29. });