Skip to content

Commit

Permalink
Puppeteer/clickBullet: Use any until asElement can be typed correctly.
Browse files Browse the repository at this point in the history
  • Loading branch information
raineorshine committed Apr 26, 2024
1 parent 1a2a4e8 commit 1dc74be
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/e2e/puppeteer/helpers/clickBullet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,17 @@ const clickBullet = async (page: Page, value: string) => {
if (!editableNode) throw new Error('editable node for the given value not found.')

const bulletNode = await page.evaluateHandle((editableNode: Element) => {
const thoughtContainer = editableNode.closest('.thought-container') as HTMLElement
const thoughtContainer = editableNode.closest('.thought-container') as HTMLElement | null

if (!thoughtContainer) return
if (!thoughtContainer) return null

return thoughtContainer.querySelector(':scope > .bullet')
}, editableNode)

if (!bulletNode) throw new Error('Bullet node not found.')

await bulletNode.asElement()?.click()
// TODO
await (bulletNode as any).asElement()?.click()
}

export default clickBullet

0 comments on commit 1dc74be

Please sign in to comment.