2022-11-15 10:28:03 +01:00
|
|
|
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'
|
2022-10-06 08:33:46 +02:00
|
|
|
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(
|
2022-11-15 10:28:03 +01:00
|
|
|
getTestAsset('typebots/predefinedVariables.json'),
|
2022-03-23 09:56:39 +01:00
|
|
|
{ id: typebotId, publicId: `${typebotId}-public` }
|
|
|
|
|
)
|
|
|
|
|
await page.goto(`/${typebotId}-public`)
|
2023-02-21 15:25:14 +01:00
|
|
|
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`)
|
2023-02-21 15:25:14 +01:00
|
|
|
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
|
|
|
})
|