snapshot of https://github.com/ueberdosis/tiptap.git (main, 2026-09-15; blobs > 131072B omitted)
Some checks failed
Verify / Install node dependencies (push) Failing after 2s
Verify / Build packages (push) Has been skipped
Verify / Check linting & formatting (push) Has been skipped
Verify / Run unit tests (push) Has been skipped
Verify / Run e2e tests (shard 1/4) (push) Has been skipped
Verify / Run e2e tests (shard 2/4) (push) Has been skipped
Verify / Run e2e tests (shard 3/4) (push) Has been skipped
Verify / Run e2e tests (shard 4/4) (push) Has been skipped
Publish / Resolve publish config (push) Failing after 2s
Publish / Send notification to Slack (push) Has been skipped
Publish / Send failure notification to Slack (push) Failing after 8s
Verify / Merge e2e reports (push) Has been skipped
Publish / Build (push) Has been skipped
Publish / Bump Versions OR Release to Registry (push) Has been skipped
Some checks failed
Verify / Install node dependencies (push) Failing after 2s
Verify / Build packages (push) Has been skipped
Verify / Check linting & formatting (push) Has been skipped
Verify / Run unit tests (push) Has been skipped
Verify / Run e2e tests (shard 1/4) (push) Has been skipped
Verify / Run e2e tests (shard 2/4) (push) Has been skipped
Verify / Run e2e tests (shard 3/4) (push) Has been skipped
Verify / Run e2e tests (shard 4/4) (push) Has been skipped
Publish / Resolve publish config (push) Failing after 2s
Publish / Send notification to Slack (push) Has been skipped
Publish / Send failure notification to Slack (push) Failing after 8s
Verify / Merge e2e reports (push) Has been skipped
Publish / Build (push) Has been skipped
Publish / Bump Versions OR Release to Registry (push) Has been skipped
This commit is contained in:
45
demos/test/helpers.ts
Normal file
45
demos/test/helpers.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import type { Page } from '@playwright/test'
|
||||
|
||||
/**
|
||||
* Get the editor element from the page
|
||||
* @param page The page to get the editor from
|
||||
* @returns The editor element Locator
|
||||
*/
|
||||
export async function getEditor(page: Page) {
|
||||
const locator = page.locator('.tiptap')
|
||||
await locator.waitFor()
|
||||
return locator
|
||||
}
|
||||
|
||||
/**
|
||||
* Set default content for the editor
|
||||
* @param page The page containing the editor
|
||||
* @param content The HTML content to set
|
||||
*/
|
||||
export async function setEditorContent(page: Page, content: string) {
|
||||
const editor = await getEditor(page)
|
||||
await editor.evaluate((el: any, innerContent: string) => {
|
||||
el.editor.commands.setContent(innerContent)
|
||||
}, content)
|
||||
}
|
||||
|
||||
/**
|
||||
* Place the caret at the end of the document.
|
||||
* Clicking the editor and pressing Ctrl+End is flaky, the caret can stay at the start.
|
||||
* @param page The page containing the editor
|
||||
*/
|
||||
export async function focusEditorEnd(page: Page) {
|
||||
const editor = await getEditor(page)
|
||||
await editor.evaluate((el: any) => {
|
||||
el.editor.commands.focus('end')
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Click a button in the editor
|
||||
* @param page The page containing the editor
|
||||
* @param buttonLabel The label of the button to click
|
||||
*/
|
||||
export async function clickButton(page: Page, buttonLabel: string) {
|
||||
await page.getByRole('button', { name: buttonLabel }).click()
|
||||
}
|
||||
Reference in New Issue
Block a user