2
0
Files
bot/apps/builder/src/features/blocks/logic/code/code.spec.ts

27 lines
862 B
TypeScript
Raw Normal View History

2022-03-07 17:39:57 +01:00
import test, { expect } from '@playwright/test'
import { typebotViewer } from 'utils/playwright/testHelpers'
import { importTypebotInDatabase } from 'utils/playwright/databaseActions'
import cuid from 'cuid'
import { getTestAsset } from '@/test/utils/playwright'
2022-03-07 17:39:57 +01:00
const typebotId = cuid()
2022-03-07 17:39:57 +01:00
2022-06-11 07:27:38 +02:00
test.describe('Code block', () => {
2022-03-07 17:39:57 +01:00
test('code should trigger', async ({ page }) => {
await importTypebotInDatabase(getTestAsset('typebots/logic/code.json'), {
id: typebotId,
})
2022-03-07 17:39:57 +01:00
await page.goto(`/typebots/${typebotId}/edit`)
await page.click('text=Configure...')
await page.fill(
'div[role="textbox"]',
'window.location.href = "https://www.google.com"'
)
await page.click('text=Preview')
await typebotViewer(page).locator('text=Trigger code').click()
await expect(page).toHaveURL('https://www.google.com')
})
})