import {test, expect} from '../../fixtures/test' // in a content body can exfiltrate data if a form // submit is triggered, and can seed form data that another form on the page // reads. It must be stripped from canvas-rce content. All visible surrounding // text must survive. test.describe(' and credential-like inputs stripped', () => { test.beforeEach(async ({page, rcePage}) => { await page.goto('/scenarios/basic') await rcePage.waitForEditor() }) async function setAndGet(page: any, html: string): Promise { return page.evaluate((content: string) => { // @ts-expect-error -- TinyMCE global window.tinymce.activeEditor.setContent(content) // @ts-expect-error -- TinyMCE global return window.tinymce.activeEditor.getContent() }, html) } test(' is stripped — surrounding text preserved', async ({page}) => { const content = await setAndGet( page, '

Before.

After.

', ) expect(content).not.toContain(' is stripped', async ({page}) => { const content = await setAndGet( page, '

Enter: here.

', ) expect(content).not.toContain(' is stripped', async ({page}) => { const content = await setAndGet( page, '

Email: end.

', ) expect(content).not.toContain('