Yet another refacto. I improved many many mechanisms on this one including dnd. It is now end 2 end tested 🎉
56 lines
1.9 KiB
TypeScript
56 lines
1.9 KiB
TypeScript
import test, { expect } from '@playwright/test'
|
|
import {
|
|
createTypebots,
|
|
parseDefaultBlockWithStep,
|
|
} from '../../services/database'
|
|
import { BubbleStepType, defaultTextBubbleContent } from 'models'
|
|
import { typebotViewer } from '../../services/selectorUtils'
|
|
import { generate } from 'short-uuid'
|
|
|
|
test.describe('Text bubble step', () => {
|
|
test('rich text features should work', async ({ page }) => {
|
|
const typebotId = generate()
|
|
await createTypebots([
|
|
{
|
|
id: typebotId,
|
|
...parseDefaultBlockWithStep({
|
|
type: BubbleStepType.TEXT,
|
|
content: defaultTextBubbleContent,
|
|
}),
|
|
},
|
|
])
|
|
|
|
await page.goto(`/typebots/${typebotId}/edit`)
|
|
|
|
await page.click('[data-testid="bold-button"]')
|
|
await page.type('div[role="textbox"]', 'Bold text')
|
|
await page.press('div[role="textbox"]', 'Shift+Enter')
|
|
|
|
await page.click('[data-testid="bold-button"]')
|
|
await page.click('[data-testid="italic-button"]')
|
|
await page.type('div[role="textbox"]', 'Italic text')
|
|
await page.press('div[role="textbox"]', 'Shift+Enter')
|
|
|
|
await page.click('[data-testid="underline-button"]')
|
|
await page.click('[data-testid="italic-button"]')
|
|
await page.type('div[role="textbox"]', 'Underlined text')
|
|
await page.press('div[role="textbox"]', 'Shift+Enter')
|
|
|
|
await page.click('[data-testid="bold-button"]')
|
|
await page.click('[data-testid="italic-button"]')
|
|
await page.type('div[role="textbox"]', 'Everything text')
|
|
await page.press('div[role="textbox"]', 'Shift+Enter')
|
|
|
|
await page.click('text=Preview')
|
|
await expect(
|
|
typebotViewer(page).locator('span.slate-bold >> nth=0')
|
|
).toHaveText('Bold text')
|
|
await expect(
|
|
typebotViewer(page).locator('span.slate-italic >> nth=0')
|
|
).toHaveText('Italic text')
|
|
await expect(
|
|
typebotViewer(page).locator('span.slate-underline >> nth=0')
|
|
).toHaveText('Underlined text')
|
|
})
|
|
})
|