Compare commits

...

1 Commits

Author SHA1 Message Date
68957ad7d8 try and reduce loading timeout noise 2024-03-05 16:13:26 +11:00

View File

@ -1,16 +1,23 @@
import { expect, Page } from '@playwright/test' import { expect, Page, errors } from '@playwright/test'
import { EngineCommand } from '../../src/lang/std/engineConnection' import { EngineCommand } from '../../src/lang/std/engineConnection'
import fsp from 'fs/promises' import fsp from 'fs/promises'
import pixelMatch from 'pixelmatch' import pixelMatch from 'pixelmatch'
import { PNG } from 'pngjs' import { PNG } from 'pngjs'
async function waitForPageLoad(page: Page) { async function waitForPageLoad(page: Page) {
// wait for 'Loading stream...' spinner try {
await page.getByTestId('loading-stream').waitFor() // wait for 'Loading stream...' spinner
// wait for all spinners to be gone await page.getByTestId('loading-stream').waitFor()
await page.getByTestId('loading').waitFor({ state: 'detached' }) // wait for all spinners to be gone
await page.getByTestId('loading').waitFor({ state: 'detached' })
await page.getByTestId('start-sketch').waitFor() await page.getByTestId('start-sketch').waitFor()
} catch (e) {
if (e instanceof errors.TimeoutError) {
console.log('Timeout while waiting for page load.')
} else {
throw e // re-throw the error if it is not a TimeoutError
}
}
} }
async function removeCurrentCode(page: Page) { async function removeCurrentCode(page: Page) {