Some checks failed
Admin | Playwright Tests / Admin | Playwright Tests | Shard 1 Of 6 (push) Failing after 37s
Admin | Playwright Tests / Admin | Playwright Tests | Shard 2 Of 6 (push) Failing after 7s
Admin | Playwright Tests / Admin | Playwright Tests | Shard 4 Of 6 (push) Failing after 7s
Admin | Playwright Tests / Admin | Playwright Tests | Shard 6 Of 6 (push) Failing after 6s
Linting Tests / PHP 8.3 test on ubuntu-latest (push) Failing after 5s
CI / PHP 8.3 test on ubuntu-latest (push) Failing after 6s
Skills Consistency / validate-skills (push) Successful in 10s
Admin | Playwright Tests / Admin | Playwright Tests | Shard 3 Of 6 (push) Failing after 7s
Admin | Playwright Tests / Admin | Playwright Tests | Shard 5 Of 6 (push) Failing after 6s
29 lines
869 B
TypeScript
29 lines
869 B
TypeScript
import { Page, expect } from "@playwright/test";
|
|
|
|
export class CommonPage {
|
|
readonly page: Page;
|
|
|
|
constructor(page: Page) {
|
|
this.page = page;
|
|
}
|
|
|
|
/**
|
|
* Fill TinyMCE editor inside an iframe
|
|
* @param iframeSelector - iframe CSS or XPath selector
|
|
* @param content - text content to insert into TinyMCE
|
|
*/
|
|
async fillInTinymce(iframeSelector: string, content: string) {
|
|
await this.page.waitForSelector(iframeSelector);
|
|
const iframe = this.page.frameLocator(iframeSelector);
|
|
const editorBody = iframe.locator("body");
|
|
|
|
await expect(editorBody).toBeVisible();
|
|
|
|
await editorBody.click();
|
|
await editorBody.press("Control+A"); // Select all existing content
|
|
await editorBody.press("Backspace"); // Clear existing content
|
|
await editorBody.pressSequentially(content);
|
|
|
|
await expect(editorBody).toHaveText(content);
|
|
}
|
|
} |