提交 d23c8e45 编写于 作者: H hdx

fix(page-scroll-to.test): 因浮点精度问题,允许滚动上下偏差 1px

上级 fbbe119f
...@@ -13,7 +13,9 @@ describe('page-scroll-to', () => { ...@@ -13,7 +13,9 @@ describe('page-scroll-to', () => {
await page.waitFor(300) await page.waitFor(300)
const scrollTop = await page.scrollTop() const scrollTop = await page.scrollTop()
expect(scrollTop).toBe(100)
// 设备精度问题,允许上下浮动 1px
expect(scrollTop > 99 && scrollTop < 101).toBe(true)
}) })
it('scroll-to-element', async () => { it('scroll-to-element', async () => {
const btnScrollTo = await page.$('.btn-scrollToElement') const btnScrollTo = await page.$('.btn-scrollToElement')
...@@ -25,4 +27,4 @@ describe('page-scroll-to', () => { ...@@ -25,4 +27,4 @@ describe('page-scroll-to', () => {
const offset = await scrollToElement.offset() const offset = await scrollToElement.offset()
expect(offset.top >= 1188).toBe(true) expect(offset.top >= 1188).toBe(true)
}) })
}) })
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册