2022-03-10 09:25:44 +01:00
|
|
|
import test, { expect } from '@playwright/test'
|
|
|
|
import path from 'path'
|
|
|
|
import { importTypebotInDatabase } from '../services/database'
|
|
|
|
import { typebotViewer } from '../services/selectorUtils'
|
2022-03-18 12:30:42 +01:00
|
|
|
import cuid from 'cuid'
|
2022-03-10 09:25:44 +01:00
|
|
|
|
|
|
|
test('should work as expected', async ({ page }) => {
|
2022-03-18 12:30:42 +01:00
|
|
|
const typebotId = cuid()
|
2022-03-10 09:25:44 +01:00
|
|
|
await importTypebotInDatabase(
|
2022-06-11 07:27:38 +02:00
|
|
|
path.join(__dirname, '../fixtures/typebots/hugeGroup.json'),
|
2022-03-10 09:25:44 +01:00
|
|
|
{ id: typebotId, publicId: `${typebotId}-public` }
|
|
|
|
)
|
|
|
|
await page.goto(`/${typebotId}-public`)
|
|
|
|
await typebotViewer(page).locator('input').fill('Baptiste')
|
|
|
|
await typebotViewer(page).locator('input').press('Enter')
|
|
|
|
await typebotViewer(page).locator('input').fill('26')
|
|
|
|
await typebotViewer(page).locator('input').press('Enter')
|
|
|
|
await typebotViewer(page).locator('button >> text=Yes').click()
|
2022-08-21 22:33:09 +02:00
|
|
|
await page.goto(`${process.env.BUILDER_URL}/typebots/${typebotId}/results`)
|
2022-06-26 16:12:28 +02:00
|
|
|
await expect(page.locator('text="Baptiste"')).toBeVisible()
|
|
|
|
await expect(page.locator('text="26"')).toBeVisible()
|
|
|
|
await expect(page.locator('text="Yes"')).toBeVisible()
|
2022-07-01 17:08:35 +02:00
|
|
|
await page.hover('tbody > tr')
|
|
|
|
await page.click('button >> text="Open"')
|
|
|
|
await expect(page.locator('text="Baptiste" >> nth=1')).toBeVisible()
|
|
|
|
await expect(page.locator('text="26" >> nth=1')).toBeVisible()
|
|
|
|
await expect(page.locator('text="Yes" >> nth=1')).toBeVisible()
|
2022-03-10 09:25:44 +01:00
|
|
|
})
|