diff --git a/packages/sanity/playwright-ct/tests/formBuilder/inputs/PortableText/RangeDecoration.spec.tsx b/packages/sanity/playwright-ct/tests/formBuilder/inputs/PortableText/RangeDecoration.spec.tsx index dc798d36446..d3e11679c10 100644 --- a/packages/sanity/playwright-ct/tests/formBuilder/inputs/PortableText/RangeDecoration.spec.tsx +++ b/packages/sanity/playwright-ct/tests/formBuilder/inputs/PortableText/RangeDecoration.spec.tsx @@ -45,7 +45,12 @@ test.describe('Portable Text Input', () => { // await page.waitForTimeout(360000) // }) test(`Draws range decoration around our selection`, async ({mount, page}) => { + const {getFocusedPortableTextEditor} = testHelpers({page}) + await mount() + + await getFocusedPortableTextEditor('field-body') + await expect(page.getByTestId('range-decoration')).toHaveText('there') }) diff --git a/packages/sanity/playwright-ct/tests/utils/testHelpers.tsx b/packages/sanity/playwright-ct/tests/utils/testHelpers.tsx index d85b8cc65e5..42d48034288 100644 --- a/packages/sanity/playwright-ct/tests/utils/testHelpers.tsx +++ b/packages/sanity/playwright-ct/tests/utils/testHelpers.tsx @@ -73,11 +73,11 @@ export function testHelpers({page}: {page: PlaywrightTestArgs['page']}) { // Wait for field to get ready (without this tests fails randomly on Webkit) await page.locator(`[data-testid='${testId}']`).waitFor() const $pteField: Locator = page.getByTestId(testId) + await $pteField.locator('[contenteditable="true"]').waitFor() + const $pteTextbox = $pteField.locator('[contenteditable="true"]') // Activate the input if needed await activatePTInputOverlay($pteField) // Ensure focus on the contentEditable element of the Portable Text Editor - const $pteTextbox = $pteField.getByRole('textbox') - await $pteTextbox.isEditable() await $pteTextbox.focus() return $pteField }, @@ -93,11 +93,11 @@ export function testHelpers({page}: {page: PlaywrightTestArgs['page']}) { // Wait for field to get ready (without this tests fails randomly on Webkit) await page.locator(`[data-testid='${testId}']`).waitFor() const $pteField: Locator = page.getByTestId(testId) + await $pteField.locator('[contenteditable="true"]').waitFor() + const $pteTextbox = $pteField.locator('[contenteditable="true"]') // Activate the input if needed await activatePTInputOverlay($pteField) // Ensure focus on the contentEditable element of the Portable Text Editor - const $pteTextbox = $pteField.getByRole('textbox') - await $pteTextbox.isEditable() await $pteTextbox.focus() return $pteTextbox },