fix export snapshot race condition (#2280)

Fixes a race condition with our snapshot export tests that was causing
them to be flaky.

### Change Type

- [x] `tests` — Changes to any test code only[^2]

### Test Plan
- [x] End to end tests
This commit is contained in:
alex 2023-12-04 13:52:37 +00:00 committed by GitHub
parent 7d699a749f
commit 7c77944951
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -207,7 +207,7 @@ test.describe('Export snapshots', () => {
} }
async function snapshotTest(page: Page) { async function snapshotTest(page: Page) {
page.waitForEvent('download').then(async (download) => { const downloadAndSnapshot = page.waitForEvent('download').then(async (download) => {
const path = (await download.path()) as string const path = (await download.path()) as string
assert(path) assert(path)
await rename(path, path + '.svg') await rename(path, path + '.svg')
@ -230,5 +230,6 @@ test.describe('Export snapshots', () => {
}) })
}) })
await page.evaluate(() => (window as any)['tldraw-export']()) await page.evaluate(() => (window as any)['tldraw-export']())
await downloadAndSnapshot
} }
}) })

View file

@ -15576,7 +15576,7 @@
"text": "export interface TLUiContextMenuProps " "text": "export interface TLUiContextMenuProps "
} }
], ],
"fileUrlPath": "packages/tldraw/src/lib/ui/components/ContextMenu.tsx", "fileUrlPath": "packages/tldraw/.tsbuild-api/lib/ui/components/ContextMenu.d.ts",
"releaseTag": "Public", "releaseTag": "Public",
"name": "TLUiContextMenuProps", "name": "TLUiContextMenuProps",
"preserveMemberOrder": false, "preserveMemberOrder": false,
@ -15599,6 +15599,7 @@
"text": ";" "text": ";"
} }
], ],
"fileUrlPath": "packages/tldraw/src/lib/ui/components/ContextMenu.tsx",
"isReadonly": false, "isReadonly": false,
"isOptional": false, "isOptional": false,
"releaseTag": "Public", "releaseTag": "Public",