tldraw/apps/examples/e2e/tests/test-routes.spec.ts
alex 4c5c3daa51
PDF editor example (#3159)
This diff adds a PDF editor example. It's pretty similar to the image
annotator, but is a better way to demo longer axis-locked scrolling.
There are some pretty big drawbacks to it at the moment (see the TODO
list on `PdfEditor.tsx`)

I'm going to land as-is for now, and we can iterate on it in the future.

### Change Type
- [x] `docs` — Changes to the documentation, examples, or templates.
- [x] `feature` — New feature
2024-03-19 11:55:21 +00:00

26 lines
815 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 = [
// only shows an image, not the canvas
'image-component',
// links out to a different repo
'yjs',
// starts by asking the user to select an image
'image-annotator',
// starts by asking the user to open a pdf
'pdf-editor',
]
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')
})
}
})