slider-maxValue.test.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
  2. const isAndroid = platformInfo.startsWith('android')
  3. const isWeb = platformInfo.startsWith('web')
  4. const isMP = platformInfo.startsWith('mp')
  5. const PAGE_PATH = '/pages/component/slider/slider-maxValue'
  6. describe('touch-events-test', () => {
  7. if (isAndroid || isWeb || isMP || process.env.UNI_TEST_DEVICES_DIRECTION == 'landscape') {
  8. it('not support', () => {
  9. expect(1).toBe(1)
  10. })
  11. return
  12. }
  13. let page
  14. beforeAll(async () => {
  15. page = await program.reLaunch(PAGE_PATH)
  16. await page.waitFor(500);
  17. })
  18. it('test-slider-max-value', async () => {
  19. const sliderX = await page.data('sliderX')
  20. const sliderY = await page.data('sliderY')
  21. const x = sliderX + 25
  22. const y = sliderY + 15
  23. // 滑动事件
  24. await program.swipe({
  25. startPoint: {x, y},
  26. endPoint: {x: x + 1000, y},
  27. duration: 300
  28. })
  29. await page.waitFor(600);
  30. const ret = await page.data('sliderValue')
  31. expect(ret).toBe(10)
  32. })
  33. it('test-slider-click', async () => {
  34. const sliderX = await page.data('sliderX')
  35. const sliderY = await page.data('sliderY')
  36. const sliderHeight = await page.data('sliderHeight')
  37. const x = sliderX + 100
  38. const y = sliderY + sliderHeight / 2.0
  39. // 点击事件
  40. await program.tap({x, y})
  41. await page.waitFor(600);
  42. const ret = await page.data('sliderValue')
  43. expect(ret).toBeLessThan(10)
  44. })
  45. })