2
0
Files
bot/apps/builder/playwright/tests/bubbles/embed.spec.ts

58 lines
1.7 KiB
TypeScript
Raw Normal View History

2022-03-23 12:01:35 +01:00
import test, { expect } from '@playwright/test'
import {
createTypebots,
2022-06-11 07:27:38 +02:00
parseDefaultGroupWithBlock,
2022-03-23 12:01:35 +01:00
} from '../../services/database'
2022-06-11 07:27:38 +02:00
import { BubbleBlockType, defaultEmbedBubbleContent } from 'models'
2022-03-23 12:01:35 +01:00
import { typebotViewer } from '../../services/selectorUtils'
import cuid from 'cuid'
const pdfSrc = 'https://www.orimi.com/pdf-test.pdf'
const siteSrc = 'https://app.cal.com/baptistearno/15min'
2022-06-11 07:27:38 +02:00
test.describe.parallel('Embed bubble block', () => {
2022-03-23 12:01:35 +01:00
test.describe('Content settings', () => {
test('should import and parse embed correctly', async ({ page }) => {
const typebotId = cuid()
await createTypebots([
{
id: typebotId,
2022-06-11 07:27:38 +02:00
...parseDefaultGroupWithBlock({
type: BubbleBlockType.EMBED,
2022-03-23 12:01:35 +01:00
content: defaultEmbedBubbleContent,
}),
},
])
await page.goto(`/typebots/${typebotId}/edit`)
await page.click('text=Click to edit...')
await page.fill('input[placeholder="Paste the link or code..."]', pdfSrc)
await expect(page.locator('text="Show embed"')).toBeVisible()
2022-03-23 12:01:35 +01:00
})
})
test.describe('Preview', () => {
test('should display embed correctly', async ({ page }) => {
const typebotId = cuid()
await createTypebots([
{
id: typebotId,
2022-06-11 07:27:38 +02:00
...parseDefaultGroupWithBlock({
type: BubbleBlockType.EMBED,
2022-03-23 12:01:35 +01:00
content: {
url: siteSrc,
height: 700,
},
}),
},
])
await page.goto(`/typebots/${typebotId}/edit`)
await page.click('text=Preview')
await expect(
typebotViewer(page).locator('iframe#embed-bubble-content')
).toHaveAttribute('src', siteSrc)
})
})
})