Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion scripts/screenshots/journeys.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ const failures = []
/** One journey in a fresh browser (no cookies), its steps' screenshots named `<journey>/<nn>-<step>`. */
async function journey(name, steps) {
if ((only ?? 'all') !== (name === 'waitlist-keeps-new-people-out' ? 'waitlist' : 'all')) return
const context = await browser.newContext({ ignoreHTTPSErrors: true, viewport: { width: 1280, height: 800 } })
const context = await browser.newContext({ ignoreHTTPSErrors: true, viewport: { width: 1280, height: 800 }, reducedMotion: 'reduce' })
// No motion from the first paint, not only from the shot: a transition started before the shot can be caught midway
await context.addInitScript((css) => {
const add = () => document.head.appendChild(Object.assign(document.createElement('style'), { textContent: css }))
if (document.head) add()
else document.addEventListener('DOMContentLoaded', add)
}, NO_MOTION)
// Nothing reaches production: the site's figures come from VisualCI's own gallery on app.visualci.com, which
// changes when its screenshots are approved (and loaded in some runs, not others). Refused, each shows its
// description, the same every run.
Expand All @@ -38,6 +44,8 @@ async function journey(name, steps) {
await page.waitForLoadState('networkidle').catch(() => {})
await page.addStyleTag({ content: NO_MOTION }).catch(() => {})
await page.evaluate(() => document.fonts.ready).catch(() => {})
// Two frames, so a re-render the last request caused (a refetch after a finished import) has painted
await page.evaluate(() => new Promise((r) => requestAnimationFrame(() => requestAnimationFrame(r)))).catch(() => {})
n++
await mkdir(`${out}/${name}`, { recursive: true })
await page.screenshot({ path: `${out}/${name}/${String(n).padStart(2, '0')}-${step}.png`, fullPage: true })
Expand Down Expand Up @@ -374,6 +382,12 @@ await journey('setup-picks-from-300-repositories', async ({ page, shot }) => {
await shot('picked')
await page.getByRole('button', { name: 'Add 2 repositories' }).click()
await page.getByRole('heading', { name: 'Added 2 projects' }).waitFor({ timeout: 30000 })
// The finished state, settled: the bar full, the next step offered, and the refetches that follow it done
await page.getByRole('button', { name: 'Next: add VisualCI to CI' }).waitFor()
await page.waitForFunction(() => {
const bar = document.querySelector('.picker-progress progress')
return bar instanceof HTMLProgressElement && bar.value === bar.max
})
await shot('added')
const after = await api(page, `/api/ui/orgs/${org}`)
expect(after.projects.length === 2, `picking two made ${after.projects.length} projects`)
Expand Down
Loading