import test, { expect } from '@playwright/test' import { createTypebots } from 'utils/playwright/databaseActions' import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers' import { defaultRatingInputOptions, InputBlockType } from 'models' import { typebotViewer } from 'utils/playwright/testHelpers' import cuid from 'cuid' const boxSvg = ` ` test('options should work', async ({ page }) => { const typebotId = cuid() await createTypebots([ { id: typebotId, ...parseDefaultGroupWithBlock({ type: InputBlockType.RATING, options: defaultRatingInputOptions, }), }, ]) await page.goto(`/typebots/${typebotId}/edit`) await page.click('text=Preview') await expect(typebotViewer(page).locator(`text=Send`)).toBeHidden() await typebotViewer(page).locator(`text=8`).click() await typebotViewer(page).locator(`text=Send`).click() await expect(typebotViewer(page).locator(`text=8`)).toBeVisible() await page.click('text=Rate from 0 to 10') await page.click('text="10"') await page.click('text="5"') await page.click('text=Numbers') await page.click('text=Icons') await page.click('text="Custom icon?"') await page.fill('[placeholder="..."]', boxSvg) await page.fill('[placeholder="Not likely at all"]', 'Not likely at all') await page.fill('[placeholder="Extremely likely"]', 'Extremely likely') await page.click('text="Restart"') await expect(typebotViewer(page).locator(`text=8`)).toBeHidden() await expect(typebotViewer(page).locator(`text=4`)).toBeHidden() await expect( typebotViewer(page).locator(`text=Not likely at all`) ).toBeVisible() await expect( typebotViewer(page).locator(`text=Extremely likely`) ).toBeVisible() await typebotViewer(page).locator(`svg >> nth=4`).click() await typebotViewer(page).locator(`text=Send`).click() await expect(typebotViewer(page).locator(`text=5`)).toBeVisible() })