Gitako/__tests__/cases/project-page.gitako.ts
2020-10-28 16:25:45 +08:00

27 lines
997 B
TypeScript

import { expectToFind, expectToNotFind, scroll } from '../utils'
describe(`in Gitako project page`, () => {
beforeAll(() => page.goto('https://github.com/EnixCoda/Gitako'))
it('should render Gitako', async () => {
await expectToFind('.gitako-side-bar .gitako-position-wrapper')
})
it('should render file list', async () => {
await expectToFind('.gitako-side-bar .files .node-item')
})
it('should render while scroll', async () => {
const filesEle = await page.waitForSelector('.gitako-side-bar .files')
// node of tsconfig.json should NOT be rendered before scroll down
await expectToNotFind('.gitako-side-bar .files a[title="tsconfig.json"]')
const box = await filesEle.boundingBox()
if (box) {
await page.mouse.move(box.x + 40, box.y + 40)
await scroll({ totalDistance: 100, duration: 5000 })
// node of tsconfig.json should be rendered now
await expectToFind('.gitako-side-bar .files a[title="tsconfig.json"]')
}
})
})