tests: fix edit→edit flakiness (#3850)

Similar to https://github.com/tldraw/tldraw/pull/3829

Trying to see if adding a small timeout helps fix this flaky test.

### Change Type

<!--  Please select a 'Scope' label ️ -->

- [ ] `sdk` — Changes the tldraw SDK
- [ ] `dotcom` — Changes the tldraw.com web app
- [ ] `docs` — Changes to the documentation, examples, or templates.
- [ ] `vs code` — Changes to the vscode plugin
- [x] `internal` — Does not affect user-facing stuff

<!--  Please select a 'Type' label ️ -->

- [ ] `bugfix` — Bug fix
- [ ] `feature` — New feature
- [ ] `improvement` — Improving existing features
- [ ] `chore` — Updating dependencies, other boring stuff
- [ ] `galaxy brain` — Architectural changes
- [x] `tests` — Changes to any test code
- [ ] `tools` — Changes to infrastructure, CI, internal scripts,
debugging tools, etc.
- [ ] `dunno` — I don't know
This commit is contained in:
Mime Čuvalo 2024-05-30 14:06:40 +01:00 committed by GitHub
parent b56433aa79
commit 749b7d4d6d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -197,29 +197,31 @@ test.describe('Focus', () => {
expect(await page.evaluate(() => document.activeElement?.nodeName === 'TEXTAREA')).toBe(true) expect(await page.evaluate(() => document.activeElement?.nodeName === 'TEXTAREA')).toBe(true)
}) })
// test('edit->edit, focus stays in the text areas when going from shape-to-shape', async ({ test('edit->edit, focus stays in the text areas when going from shape-to-shape', async ({
// page, page,
// }) => { }) => {
// await page.goto('http://localhost:5420/end-to-end') await page.goto('http://localhost:5420/end-to-end')
// await page.waitForSelector('.tl-canvas') await page.waitForSelector('.tl-canvas')
// const EditorA = (await page.$(`.tl-container`))! const EditorA = (await page.$(`.tl-container`))!
// expect(EditorA).toBeTruthy() expect(EditorA).toBeTruthy()
// // Create a new note, text should be focused // Create a new note, text should be focused
// await page.keyboard.press('n') await page.keyboard.press('n')
// await (await page.$('body'))?.click() await (await page.$('body'))?.click()
// await page.waitForSelector('.tl-shape') await page.waitForSelector('.tl-shape')
// await page.keyboard.type('test') await page.keyboard.type('test')
// // create new note next to it // create new note next to it
// await page.keyboard.press('Tab') await page.keyboard.press('Tab')
// await (await page.$('body'))?.click() await (await page.$('body'))?.click()
// // First note's textarea should be focused. await page.waitForTimeout(1000)
// expect(await EditorA.evaluate(() => !!document.querySelector('.tl-shape textarea:focus'))).toBe(
// true // First note's textarea should be focused.
// ) expect(await EditorA.evaluate(() => !!document.querySelector('.tl-shape textarea:focus'))).toBe(
// }) true
)
})
}) })