diff --git a/pages/API/page-scroll-to/page-scroll-to.test.js b/pages/API/page-scroll-to/page-scroll-to.test.js index 730fa5397b1dac0b0dfe5e61693c1c5ad3d5feca..5a3c1be8b35fa86eb0098927021eb7b788278ab7 100644 --- a/pages/API/page-scroll-to/page-scroll-to.test.js +++ b/pages/API/page-scroll-to/page-scroll-to.test.js @@ -6,22 +6,23 @@ describe('page-scroll-to', () => { page = await program.reLaunch(PAGE_PATH) await page.waitFor(500) }) - // TODO it('scroll-to', async () => { const btnScrollTo = await page.$('.btn-scrollTo') await btnScrollTo.tap() - await page.waitFor(50) - // const scrollTop = await page.scrollTop() - // expect(scrollTop).toBe(100) + await page.waitFor(300) + + const scrollTop = await page.scrollTop() + expect(scrollTop).toBe(100) }) - // it('scroll-to-element', async () => { - // const btnScrollTo = await page.$('.btn-scrollToElement') - // const scrollToElement = await page.$('.custom-element') + it('scroll-to-element', async () => { + const btnScrollTo = await page.$('.btn-scrollToElement') + const scrollToElement = await page.$('.custom-element') + + await btnScrollTo.tap() + await page.waitFor(300) - // await btnScrollTo.tap() - // await page.waitFor(50) - // const offset = await scrollToElement.offset() - // expect(offset.top).toBe(0) - // }) -}) \ No newline at end of file + const offset = await scrollToElement.offset() + expect(offset.top >= 1188).toBe(true) + }) +}) diff --git a/pages/API/page-scroll-to/page-scroll-to.uvue b/pages/API/page-scroll-to/page-scroll-to.uvue index 5e89de99192769e3fdb917ca52d7157491f1353b..43b8ee329e748a168dfd0d92ed0267302a727f2f 100644 --- a/pages/API/page-scroll-to/page-scroll-to.uvue +++ b/pages/API/page-scroll-to/page-scroll-to.uvue @@ -27,7 +27,7 @@ -