2
0

perf(e2e): ️ Migrate to Playwright

This commit is contained in:
Baptiste Arnaud
2022-01-28 09:42:31 +01:00
parent c5aaa323d1
commit 73f277fce7
145 changed files with 3104 additions and 2346 deletions

View File

@ -0,0 +1,43 @@
import test, { expect } from '@playwright/test'
import {
createTypebots,
parseDefaultBlockWithStep,
} from '../../services/database'
import { defaultEmailInputOptions, InputStepType } from 'models'
import { typebotViewer } from '../../services/selectorUtils'
const typebotId = 'email-input-step'
test.describe('Email input step', () => {
test('options should work', async ({ page }) => {
await createTypebots([
{
id: typebotId,
...parseDefaultBlockWithStep({
type: InputStepType.EMAIL,
options: defaultEmailInputOptions,
}),
},
])
await page.goto(`/typebots/${typebotId}/edit`)
await page.click('text=Preview')
await expect(
typebotViewer(page).locator(
`input[placeholder="${defaultEmailInputOptions.labels.placeholder}"]`
)
).toHaveAttribute('type', 'email')
await expect(typebotViewer(page).locator(`button`)).toBeDisabled()
await page.click(`text=${defaultEmailInputOptions.labels.placeholder}`)
await page.fill('#placeholder', 'Your email...')
await expect(page.locator('text=Your email...')).toBeVisible()
await page.fill('#button', 'Go')
await page.click('text=Restart')
await expect(
typebotViewer(page).locator(`input[placeholder="Your email..."]`)
).toBeVisible()
})
})