2
0
Files
bot/apps/viewer/src/features/variables/variables.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

20 lines
825 B
TypeScript

import { getTestAsset } from '@/test/utils/playwright'
import test, { expect } from '@playwright/test'
import { createId } from '@paralleldrive/cuid2'
import { importTypebotInDatabase } from 'utils/playwright/databaseActions'
test('should correctly be injected', async ({ page }) => {
const typebotId = createId()
await importTypebotInDatabase(
getTestAsset('typebots/predefinedVariables.json'),
{ id: typebotId, publicId: `${typebotId}-public` }
)
await page.goto(`/${typebotId}-public`)
await expect(page.locator('text="Your name is"')).toBeVisible()
await page.goto(`/${typebotId}-public?Name=Baptiste&Email=email@test.com`)
await expect(page.locator('text="Your name is Baptiste"')).toBeVisible()
await expect(page.getByPlaceholder('Type your email...')).toHaveValue(
'email@test.com'
)
})