Generalized implementation of the text editor toolbar (#9147)

Signed-off-by: Victor Ilyushchenko <alt13ri@gmail.com>
This commit is contained in:
Victor Ilyushchenko
2025-06-05 11:05:21 +07:00
committed by GitHub
parent fcb67d20f8
commit f21996252b
28 changed files with 1307 additions and 1113 deletions
@@ -312,11 +312,12 @@ test.describe('Content in the Documents tests', () => {
})
test('Checking styles in a Document', async ({ page, browser, request }) => {
const content: string = [...new Array(20).keys()].map((index) => `Line ${index + 1}`).join('\n')
const content: string = [...new Array(21).keys()].map((index) => `Line ${index}`).join('\n')
const testLink: string = 'http://test/link/123456'
const testNote: string = 'Test Note'
await documentContentPage.addContentToTheNewLine(content, false)
await documentContentPage.applyToolbarCommand('Line 0', 'btnH1')
await documentContentPage.applyToolbarCommand('Line 1', 'btnH1')
await documentContentPage.applyToolbarCommand('Line 2', 'btnH2')
await documentContentPage.applyToolbarCommand('Line 3', 'btnH3')
@@ -229,14 +229,18 @@ export class DocumentContentPage extends CommonPage {
await this.buttonOnToolbar(id).click()
}
async selectLine (text: string): Promise<void> {
async selectLine (text: string, shallow: boolean = true): Promise<void> {
const loc: Locator = this.page.locator('p', { hasText: text }).first()
await expect(loc).toBeVisible()
await loc.click({ clickCount: 3 })
if (shallow) {
await loc.click({ clickCount: 3 })
} else {
await loc.selectText()
}
}
async applyToolbarCommand (text: string, btnId: string): Promise<void> {
await this.selectLine(text)
await this.selectLine(text, false)
await this.clickButtonOnTooltip(btnId)
}