import {Page} from '@playwright/test'; import DashboardPage from '../../../page-objects/dashboard/DashboardPage'; import datalensTest from '../../../utils/playwright/globalTestDefinition'; const expectedHTML = `

This text is highlighted in bold.

This text is in italics.

`; // spaces are needed here after '*' so editor can detect markdown while typing const text = `This text is highlighted in **bold** . This text is in *italics* . * Element 1 * Element 2 * Element 3`; datalensTest.describe('Dashboards - Markdown', () => { datalensTest('Markdown should turn into HTML tags', async ({page}: {page: Page}) => { const dashboardPage = new DashboardPage({page}); await dashboardPage.createDashboard({ editDash: async () => { await dashboardPage.addText({text, timeout: 20, markup: true}); }, }); const receivedHTML = await dashboardPage.getMarkdownHTML(); const hasText = receivedHTML.replace(/\s/g, '').includes(expectedHTML.replace(/\s/g, '')); expect(hasText).toBeTruthy(); }); });