2
0

ci: 💚 Improve linked typebot test robustness

This commit is contained in:
Baptiste Arnaud
2022-04-04 10:45:41 +02:00
parent 59031206ae
commit f6b518989c

View File

@ -9,26 +9,26 @@ test('should be configurable', async ({ page }) => {
const linkedTypebotId = cuid() const linkedTypebotId = cuid()
await importTypebotInDatabase( await importTypebotInDatabase(
path.join(__dirname, '../../fixtures/typebots/logic/linkTypebots/1.json'), path.join(__dirname, '../../fixtures/typebots/logic/linkTypebots/1.json'),
{ id: typebotId } { id: typebotId, name: 'My link typebot 1' }
) )
await importTypebotInDatabase( await importTypebotInDatabase(
path.join(__dirname, '../../fixtures/typebots/logic/linkTypebots/2.json'), path.join(__dirname, '../../fixtures/typebots/logic/linkTypebots/2.json'),
{ id: linkedTypebotId } { id: linkedTypebotId, name: 'My link typebot 2' }
) )
await page.goto(`/typebots/${typebotId}/edit`) await page.goto(`/typebots/${typebotId}/edit`)
await page.click('text=Configure...') await page.click('text=Configure...')
await page.click('input[placeholder="Select a typebot"]') await page.click('input[placeholder="Select a typebot"]')
await page.click('text=Another typebot') await page.click('text=My link typebot 2')
await expect(page.locator('input[value="Another typebot"]')).toBeVisible() await expect(page.locator('input[value="My link typebot 2"]')).toBeVisible()
await page.click('[aria-label="Navigate to typebot"]') await page.click('[aria-label="Navigate to typebot"]')
await expect(page).toHaveURL( await expect(page).toHaveURL(
`/typebots/${linkedTypebotId}/edit?parentId=${typebotId}` `/typebots/${linkedTypebotId}/edit?parentId=${typebotId}`
) )
await page.click('[aria-label="Navigate back"]') await page.click('[aria-label="Navigate back"]')
await expect(page).toHaveURL(`/typebots/${typebotId}/edit`) await expect(page).toHaveURL(`/typebots/${typebotId}/edit`)
await page.click('text=Jump in Another typebot') await page.click('text=Jump in My link typebot 2')
await expect(page.locator('input[value="Another typebot"]')).toBeVisible() await expect(page.locator('input[value="My link typebot 2"]')).toBeVisible()
await page.click('input[placeholder="Select a block"]') await page.click('input[placeholder="Select a block"]')
await page.click('text=Block #2') await page.click('text=Block #2')
@ -36,7 +36,7 @@ test('should be configurable', async ({ page }) => {
await expect(typebotViewer(page).locator('text=Second block')).toBeVisible() await expect(typebotViewer(page).locator('text=Second block')).toBeVisible()
await page.click('[aria-label="Close"]') await page.click('[aria-label="Close"]')
await page.click('text=Jump to Block #2 in Another typebot') await page.click('text=Jump to Block #2 in My link typebot 2')
await page.click('input[value="Block #2"]', { clickCount: 3 }) await page.click('input[value="Block #2"]', { clickCount: 3 })
await page.press('input[value="Block #2"]', 'Backspace') await page.press('input[value="Block #2"]', 'Backspace')
await page.click('button >> text=Start') await page.click('button >> text=Start')
@ -47,10 +47,10 @@ test('should be configurable', async ({ page }) => {
await expect(typebotViewer(page).locator('text=Hello there!')).toBeVisible() await expect(typebotViewer(page).locator('text=Hello there!')).toBeVisible()
await page.click('[aria-label="Close"]') await page.click('[aria-label="Close"]')
await page.click('text=Jump to Start in Another typebot') await page.click('text=Jump to Start in My link typebot 2')
await page.click('input[value="Another typebot"]', { clickCount: 3 }) await page.click('input[value="My link typebot 2"]', { clickCount: 3 })
await page.press('input[value="Another typebot"]', 'Backspace') await page.press('input[value="My link typebot 2"]', 'Backspace')
await page.click('button >> text=My typebot') await page.click('button >> text=My link typebot 1')
await page.click('input[placeholder="Select a block"]', { await page.click('input[placeholder="Select a block"]', {
clickCount: 3, clickCount: 3,
}) })