Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 4 additions & 1 deletion tests/learn-guided.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,10 @@ for (const [name, width, height, touch] of SIZES) {
await page.evaluate(() => window.openCodeBot.device.disconnect())
await page.waitForFunction(() => window.openCodeBot.device.simulating, null, { timeout: 20000 }).catch(() => {})
check((await state()).sim, 'the simulator closed during a mission comes back')
const ringBack = await page.waitForFunction(() => !document.querySelector('.journey-ring').hidden, null, { timeout: 10000 }).then(() => true, () => false)
// The simulator back, its 3D view is built again: under the software renderer the
// tests run on (no GPU), that holds the page's main thread for 8 to 15 seconds in
// one task, and the ring's timer runs only after it. Allow for it.
const ringBack = await page.waitForFunction(() => !document.querySelector('.journey-ring').hidden, null, { timeout: 30000 }).then(() => true, () => false)
if (!ringBack) console.log(await page.evaluate(() => { const j = window.openCodeBot.learn.journey; return JSON.stringify({ i: j.index, point: j.steps[j.index]?.point, found: !!j._locate(j.steps[j.index]), view: !!window.openCodeBot.device.sim.view, good: j.coach?.good, folded: j.coach?.folded }) }))
check(ringBack, 'and the ring is on the board again')

Expand Down
6 changes: 4 additions & 2 deletions tests/learn-journey.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,10 @@ for (const [name, width, height, touch, motion = 'no-preference'] of SIZES) {
const app = window.openCodeBot
app.workspace.replaceBlocks(app.blocksFromPython('from codex import *\n\ndisplay.show("Hi, I\'m Sam!")\n').state)
})
await page.waitForTimeout(900)
check(await bubble().evaluate((b) => b.classList.contains('good')), 'changing the words meets it')
// Met as soon as the goal watcher next looks; under the tests' software renderer the
// simulator can hold the main thread for seconds, so wait for it rather than a fixed time.
const met = await page.waitForFunction(() => document.querySelector('.journey-bubble')?.classList.contains('good'), null, { timeout: 15000 }).then(() => true, () => false)
check(met, 'changing the words meets it')

// A reload in the middle comes back to the next step.
await page.reload({ waitUntil: 'networkidle' })
Expand Down
Loading