42 lines
1.4 KiB
TypeScript
42 lines
1.4 KiB
TypeScript
import test, { expect } from '@playwright/test'
|
|
import { createTypebots } from '@typebot.io/lib/playwright/databaseActions'
|
|
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers'
|
|
import { defaultTextInputOptions, InputBlockType } from '@typebot.io/schemas'
|
|
import { createId } from '@paralleldrive/cuid2'
|
|
|
|
test.describe.parallel('Text input block', () => {
|
|
test('options should work', async ({ page }) => {
|
|
const typebotId = createId()
|
|
await createTypebots([
|
|
{
|
|
id: typebotId,
|
|
...parseDefaultGroupWithBlock({
|
|
type: InputBlockType.TEXT,
|
|
options: defaultTextInputOptions,
|
|
}),
|
|
},
|
|
])
|
|
|
|
await page.goto(`/typebots/${typebotId}/edit`)
|
|
|
|
await page.click('text=Preview')
|
|
await expect(
|
|
page.locator(
|
|
`input[placeholder="${defaultTextInputOptions.labels.placeholder}"]`
|
|
)
|
|
).toHaveAttribute('type', 'text')
|
|
await expect(page.getByRole('button', { name: 'Send' })).toBeDisabled()
|
|
|
|
await page.click(`text=${defaultTextInputOptions.labels.placeholder}`)
|
|
await page.getByLabel('Placeholder:').fill('Your name...')
|
|
await page.getByLabel('Button label:').fill('Go')
|
|
await page.click('text=Long text?')
|
|
|
|
await page.click('text=Restart')
|
|
await expect(
|
|
page.locator(`textarea[placeholder="Your name..."]`)
|
|
).toBeVisible()
|
|
await expect(page.getByRole('button', { name: 'Go' })).toBeVisible()
|
|
})
|
|
})
|