tldraw/apps/examples/e2e/tests/test-routes.spec.ts
Steve Ruiz 338501d656
[fix] Routes check on e2e tests (#3022)
This PR updates our end to end tests so that they check every route in
our examples to ensure that it loads (skipping any routes that don't
features a canvas).

### Change Type

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

### Test Plan

- [x] End to end tests
2024-03-02 16:42:07 +00:00

17 lines
608 B
TypeScript

import test from '@playwright/test'
import * as fs from 'fs'
import path from 'path'
// get all routes from examples/src/examples folder
const examplesFolderList = fs.readdirSync(path.join(__dirname, '../../src/examples'))
const examplesWithoutCanvas = ['image-component', 'yjs']
const exampelsToTest = examplesFolderList.filter((route) => !examplesWithoutCanvas.includes(route))
test.describe('Routes', () => {
for (const example of exampelsToTest) {
test(example, async ({ page }) => {
await page.goto(`http://localhost:5420/${example}/full`)
await page.waitForSelector('.tl-canvas')
})
}
})