2
0
Files
bot/apps/viewer/src/features/variables/variables.spec.ts

20 lines
825 B
TypeScript
Raw Normal View History

import { getTestAsset } from '@/test/utils/playwright'
2022-03-23 09:56:39 +01:00
import test, { expect } from '@playwright/test'
2023-02-10 15:06:02 +01:00
import { createId } from '@paralleldrive/cuid2'
import { importTypebotInDatabase } from 'utils/playwright/databaseActions'
2022-03-23 09:56:39 +01:00
test('should correctly be injected', async ({ page }) => {
2023-02-10 15:06:02 +01:00
const typebotId = createId()
2022-03-23 09:56:39 +01:00
await importTypebotInDatabase(
getTestAsset('typebots/predefinedVariables.json'),
2022-03-23 09:56:39 +01:00
{ id: typebotId, publicId: `${typebotId}-public` }
)
await page.goto(`/${typebotId}-public`)
await expect(page.locator('text="Your name is"')).toBeVisible()
2022-03-23 09:56:39 +01:00
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'
)
2022-03-23 09:56:39 +01:00
})