2
0
Files
bot/apps/builder/src/features/blocks/logic/script/script.spec.ts
Baptiste Arnaud debdac12ff Introduce bot v2 in builder (#328)
Also, the new engine is the default for updated typebots for viewer

Closes #211
2023-02-21 15:25:14 +01:00

26 lines
837 B
TypeScript

import test, { expect } from '@playwright/test'
import { importTypebotInDatabase } from 'utils/playwright/databaseActions'
import { createId } from '@paralleldrive/cuid2'
import { getTestAsset } from '@/test/utils/playwright'
const typebotId = createId()
test.describe('Script block', () => {
test('script should trigger', async ({ page }) => {
await importTypebotInDatabase(getTestAsset('typebots/logic/script.json'), {
id: typebotId,
})
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 page.getByRole('button', { name: 'Trigger code' }).click()
await expect(page).toHaveURL('https://www.google.com')
})
})