Skip to content

Commit 1af7df2

Browse files
committed
Add CI
1 parent 2e40d87 commit 1af7df2

2 files changed

Lines changed: 23 additions & 3 deletions

File tree

.github/workflows/push.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,12 @@ jobs:
1414
node-version: '20'
1515
- name: Install deps (with cache)
1616
uses: bahmutov/npm-install@v1
17+
- name: Build
18+
run: yarn build
19+
- name: Install Puppeteer browser
20+
run: npx puppeteer browsers install chrome
1721
- name: Test codebase
18-
run: yarn test
22+
run: yarn test --run
1923
- name: Upload coverage
2024
uses: codecov/codecov-action@v2
2125
- name: Typecheck codebase

test/browser.test.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,25 @@ describe('Browser tests with Puppeteer', () => {
156156
})
157157
page = await browser.newPage()
158158

159+
const errors: string[] = []
160+
page.on('pageerror', err => errors.push(err.message))
161+
page.on('console', msg => {
162+
if (msg.type() === 'error') {
163+
errors.push(msg.text())
164+
}
165+
})
166+
159167
await page.goto(`http://localhost:${appPort}/`)
160-
await page.waitForFunction('window.ready === true')
161-
})
168+
169+
try {
170+
await page.waitForFunction('window.ready === true', { timeout: 10000 })
171+
} catch (e) {
172+
const html = await page.content()
173+
console.error('Page errors:', errors)
174+
console.error('Page HTML:', html)
175+
throw e
176+
}
177+
}, 30000)
162178

163179
afterAll(async () => {
164180
await browser?.close()

0 commit comments

Comments
 (0)