refactor: ♻️ Rename step to block
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import test, { expect } from '@playwright/test'
|
||||
import {
|
||||
createTypebots,
|
||||
parseDefaultBlockWithStep,
|
||||
parseDefaultGroupWithBlock,
|
||||
} from '../../services/database'
|
||||
import { BubbleStepType, defaultEmbedBubbleContent } from 'models'
|
||||
import { BubbleBlockType, defaultEmbedBubbleContent } from 'models'
|
||||
import { typebotViewer } from '../../services/selectorUtils'
|
||||
import cuid from 'cuid'
|
||||
|
||||
@@ -11,15 +11,15 @@ const pdfSrc = 'https://www.orimi.com/pdf-test.pdf'
|
||||
const iframeCode = '<iframe src="https://typebot.io"></iframe>'
|
||||
const siteSrc = 'https://app.cal.com/baptistearno/15min'
|
||||
|
||||
test.describe.parallel('Embed bubble step', () => {
|
||||
test.describe.parallel('Embed bubble block', () => {
|
||||
test.describe('Content settings', () => {
|
||||
test('should import and parse embed correctly', async ({ page }) => {
|
||||
const typebotId = cuid()
|
||||
await createTypebots([
|
||||
{
|
||||
id: typebotId,
|
||||
...parseDefaultBlockWithStep({
|
||||
type: BubbleStepType.EMBED,
|
||||
...parseDefaultGroupWithBlock({
|
||||
type: BubbleBlockType.EMBED,
|
||||
content: defaultEmbedBubbleContent,
|
||||
}),
|
||||
},
|
||||
@@ -54,8 +54,8 @@ test.describe.parallel('Embed bubble step', () => {
|
||||
await createTypebots([
|
||||
{
|
||||
id: typebotId,
|
||||
...parseDefaultBlockWithStep({
|
||||
type: BubbleStepType.EMBED,
|
||||
...parseDefaultGroupWithBlock({
|
||||
type: BubbleBlockType.EMBED,
|
||||
content: {
|
||||
url: siteSrc,
|
||||
height: 700,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import test, { expect } from '@playwright/test'
|
||||
import {
|
||||
createTypebots,
|
||||
parseDefaultBlockWithStep,
|
||||
parseDefaultGroupWithBlock,
|
||||
} from '../../services/database'
|
||||
import { BubbleStepType, defaultImageBubbleContent } from 'models'
|
||||
import { BubbleBlockType, defaultImageBubbleContent } from 'models'
|
||||
import { typebotViewer } from '../../services/selectorUtils'
|
||||
import path from 'path'
|
||||
import cuid from 'cuid'
|
||||
@@ -11,15 +11,15 @@ import cuid from 'cuid'
|
||||
const unsplashImageSrc =
|
||||
'https://images.unsplash.com/photo-1504297050568-910d24c426d3?ixlib=rb-1.2.1&ixid=MnwxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1287&q=80'
|
||||
|
||||
test.describe.parallel('Image bubble step', () => {
|
||||
test.describe.parallel('Image bubble block', () => {
|
||||
test.describe('Content settings', () => {
|
||||
test('should upload image file correctly', async ({ page }) => {
|
||||
const typebotId = cuid()
|
||||
await createTypebots([
|
||||
{
|
||||
id: typebotId,
|
||||
...parseDefaultBlockWithStep({
|
||||
type: BubbleStepType.IMAGE,
|
||||
...parseDefaultGroupWithBlock({
|
||||
type: BubbleBlockType.IMAGE,
|
||||
content: defaultImageBubbleContent,
|
||||
}),
|
||||
},
|
||||
@@ -46,8 +46,8 @@ test.describe.parallel('Image bubble step', () => {
|
||||
await createTypebots([
|
||||
{
|
||||
id: typebotId,
|
||||
...parseDefaultBlockWithStep({
|
||||
type: BubbleStepType.IMAGE,
|
||||
...parseDefaultGroupWithBlock({
|
||||
type: BubbleBlockType.IMAGE,
|
||||
content: defaultImageBubbleContent,
|
||||
}),
|
||||
},
|
||||
@@ -69,8 +69,8 @@ test.describe.parallel('Image bubble step', () => {
|
||||
await createTypebots([
|
||||
{
|
||||
id: typebotId,
|
||||
...parseDefaultBlockWithStep({
|
||||
type: BubbleStepType.IMAGE,
|
||||
...parseDefaultGroupWithBlock({
|
||||
type: BubbleBlockType.IMAGE,
|
||||
content: defaultImageBubbleContent,
|
||||
}),
|
||||
},
|
||||
@@ -84,7 +84,7 @@ test.describe.parallel('Image bubble step', () => {
|
||||
force: true,
|
||||
position: { x: 0, y: 0 },
|
||||
})
|
||||
await expect(page.locator('img[alt="Block image"]')).toHaveAttribute(
|
||||
await expect(page.locator('img[alt="Group image"]')).toHaveAttribute(
|
||||
'src',
|
||||
new RegExp('giphy.com/media', 'gm')
|
||||
)
|
||||
@@ -97,8 +97,8 @@ test.describe.parallel('Image bubble step', () => {
|
||||
await createTypebots([
|
||||
{
|
||||
id: typebotId,
|
||||
...parseDefaultBlockWithStep({
|
||||
type: BubbleStepType.IMAGE,
|
||||
...parseDefaultGroupWithBlock({
|
||||
type: BubbleBlockType.IMAGE,
|
||||
content: {
|
||||
url: unsplashImageSrc,
|
||||
},
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
import test, { expect } from '@playwright/test'
|
||||
import {
|
||||
createTypebots,
|
||||
parseDefaultBlockWithStep,
|
||||
parseDefaultGroupWithBlock,
|
||||
} from '../../services/database'
|
||||
import { BubbleStepType, defaultTextBubbleContent } from 'models'
|
||||
import { BubbleBlockType, defaultTextBubbleContent } from 'models'
|
||||
import { typebotViewer } from '../../services/selectorUtils'
|
||||
import cuid from 'cuid'
|
||||
|
||||
test.describe('Text bubble step', () => {
|
||||
test.describe('Text bubble block', () => {
|
||||
test('rich text features should work', async ({ page }) => {
|
||||
const typebotId = cuid()
|
||||
await createTypebots([
|
||||
{
|
||||
id: typebotId,
|
||||
...parseDefaultBlockWithStep({
|
||||
type: BubbleStepType.TEXT,
|
||||
...parseDefaultGroupWithBlock({
|
||||
type: BubbleBlockType.TEXT,
|
||||
content: defaultTextBubbleContent,
|
||||
}),
|
||||
},
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import test, { expect } from '@playwright/test'
|
||||
import {
|
||||
createTypebots,
|
||||
parseDefaultBlockWithStep,
|
||||
parseDefaultGroupWithBlock,
|
||||
} from '../../services/database'
|
||||
import {
|
||||
BubbleStepType,
|
||||
BubbleBlockType,
|
||||
defaultVideoBubbleContent,
|
||||
VideoBubbleContentType,
|
||||
} from 'models'
|
||||
@@ -16,15 +16,15 @@ const videoSrc =
|
||||
const youtubeVideoSrc = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
|
||||
const vimeoVideoSrc = 'https://vimeo.com/649301125'
|
||||
|
||||
test.describe.parallel('Video bubble step', () => {
|
||||
test.describe.parallel('Video bubble block', () => {
|
||||
test.describe('Content settings', () => {
|
||||
test('should import video url correctly', async ({ page }) => {
|
||||
const typebotId = cuid()
|
||||
await createTypebots([
|
||||
{
|
||||
id: typebotId,
|
||||
...parseDefaultBlockWithStep({
|
||||
type: BubbleStepType.VIDEO,
|
||||
...parseDefaultGroupWithBlock({
|
||||
type: BubbleBlockType.VIDEO,
|
||||
content: defaultVideoBubbleContent,
|
||||
}),
|
||||
},
|
||||
@@ -47,8 +47,8 @@ test.describe.parallel('Video bubble step', () => {
|
||||
await createTypebots([
|
||||
{
|
||||
id: typebotId,
|
||||
...parseDefaultBlockWithStep({
|
||||
type: BubbleStepType.VIDEO,
|
||||
...parseDefaultGroupWithBlock({
|
||||
type: BubbleBlockType.VIDEO,
|
||||
content: {
|
||||
type: VideoBubbleContentType.URL,
|
||||
url: videoSrc,
|
||||
@@ -69,8 +69,8 @@ test.describe.parallel('Video bubble step', () => {
|
||||
await createTypebots([
|
||||
{
|
||||
id: typebotId,
|
||||
...parseDefaultBlockWithStep({
|
||||
type: BubbleStepType.VIDEO,
|
||||
...parseDefaultGroupWithBlock({
|
||||
type: BubbleBlockType.VIDEO,
|
||||
content: {
|
||||
type: VideoBubbleContentType.YOUTUBE,
|
||||
url: youtubeVideoSrc,
|
||||
@@ -93,8 +93,8 @@ test.describe.parallel('Video bubble step', () => {
|
||||
await createTypebots([
|
||||
{
|
||||
id: typebotId,
|
||||
...parseDefaultBlockWithStep({
|
||||
type: BubbleStepType.VIDEO,
|
||||
...parseDefaultGroupWithBlock({
|
||||
type: BubbleBlockType.VIDEO,
|
||||
content: {
|
||||
type: VideoBubbleContentType.VIMEO,
|
||||
url: vimeoVideoSrc,
|
||||
|
||||
@@ -2,11 +2,11 @@ import test, { expect } from '@playwright/test'
|
||||
import cuid from 'cuid'
|
||||
import { CollaborationType, Plan, WorkspaceRole } from 'db'
|
||||
import prisma from 'libs/prisma'
|
||||
import { InputStepType, defaultTextInputOptions } from 'models'
|
||||
import { InputBlockType, defaultTextInputOptions } from 'models'
|
||||
import {
|
||||
createResults,
|
||||
createTypebots,
|
||||
parseDefaultBlockWithStep,
|
||||
parseDefaultGroupWithBlock,
|
||||
} from '../services/database'
|
||||
|
||||
test.describe('Typebot owner', () => {
|
||||
@@ -30,8 +30,8 @@ test.describe('Typebot owner', () => {
|
||||
id: typebotId,
|
||||
name: 'Guest typebot',
|
||||
workspaceId: guestWorkspaceId,
|
||||
...parseDefaultBlockWithStep({
|
||||
type: InputStepType.TEXT,
|
||||
...parseDefaultGroupWithBlock({
|
||||
type: InputBlockType.TEXT,
|
||||
options: defaultTextInputOptions,
|
||||
}),
|
||||
},
|
||||
@@ -83,8 +83,8 @@ test.describe('Collaborator', () => {
|
||||
id: typebotId,
|
||||
name: 'Guest typebot',
|
||||
workspaceId: guestWorkspaceId,
|
||||
...parseDefaultBlockWithStep({
|
||||
type: InputStepType.TEXT,
|
||||
...parseDefaultGroupWithBlock({
|
||||
type: InputBlockType.TEXT,
|
||||
options: defaultTextInputOptions,
|
||||
}),
|
||||
},
|
||||
@@ -105,8 +105,8 @@ test.describe('Collaborator', () => {
|
||||
await page.click('text=Everyone at Guest workspace')
|
||||
await expect(page.locator('text="Remove"')).toBeHidden()
|
||||
await expect(page.locator('text=Pro user')).toBeVisible()
|
||||
await page.click('text=Block #1', { force: true })
|
||||
await expect(page.locator('input[value="Block #1"]')).toBeHidden()
|
||||
await page.click('text=Group #1', { force: true })
|
||||
await expect(page.locator('input[value="Group #1"]')).toBeHidden()
|
||||
await page.goto(`/typebots/${typebotId}/results`)
|
||||
await expect(page.locator('text="content199"')).toBeVisible()
|
||||
})
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import test, { expect } from '@playwright/test'
|
||||
import { InputStepType, defaultTextInputOptions } from 'models'
|
||||
import { InputBlockType, defaultTextInputOptions } from 'models'
|
||||
import {
|
||||
createTypebots,
|
||||
freeWorkspaceId,
|
||||
parseDefaultBlockWithStep,
|
||||
parseDefaultGroupWithBlock,
|
||||
} from '../services/database'
|
||||
import path from 'path'
|
||||
import cuid from 'cuid'
|
||||
@@ -13,8 +13,8 @@ test('should be able to connect custom domain', async ({ page }) => {
|
||||
await createTypebots([
|
||||
{
|
||||
id: typebotId,
|
||||
...parseDefaultBlockWithStep({
|
||||
type: InputStepType.TEXT,
|
||||
...parseDefaultGroupWithBlock({
|
||||
type: InputBlockType.TEXT,
|
||||
options: defaultTextInputOptions,
|
||||
}),
|
||||
},
|
||||
@@ -54,8 +54,8 @@ test.describe('Free workspace', () => {
|
||||
{
|
||||
id: typebotId,
|
||||
workspaceId: freeWorkspaceId,
|
||||
...parseDefaultBlockWithStep({
|
||||
type: InputStepType.TEXT,
|
||||
...parseDefaultGroupWithBlock({
|
||||
type: InputBlockType.TEXT,
|
||||
options: defaultTextInputOptions,
|
||||
}),
|
||||
},
|
||||
|
||||
@@ -2,9 +2,9 @@ import test, { expect } from '@playwright/test'
|
||||
import {
|
||||
createTypebots,
|
||||
importTypebotInDatabase,
|
||||
parseDefaultBlockWithStep,
|
||||
parseDefaultGroupWithBlock,
|
||||
} from '../services/database'
|
||||
import { defaultTextInputOptions, InputStepType } from 'models'
|
||||
import { defaultTextInputOptions, InputBlockType } from 'models'
|
||||
import path from 'path'
|
||||
import cuid from 'cuid'
|
||||
import { typebotViewer } from '../services/selectorUtils'
|
||||
@@ -18,25 +18,26 @@ test.describe.parallel('Editor', () => {
|
||||
},
|
||||
])
|
||||
await page.goto(`/typebots/${typebotId}/edit`)
|
||||
await expect(page.locator("text='Start'")).toBeVisible()
|
||||
await page.dragAndDrop('text=Button', '#editor-container', {
|
||||
targetPosition: { x: 800, y: 400 },
|
||||
})
|
||||
await page.dragAndDrop(
|
||||
'text=Text >> nth=0',
|
||||
'[data-testid="block"] >> nth=1',
|
||||
'[data-testid="group"] >> nth=1',
|
||||
{
|
||||
targetPosition: { x: 100, y: 50 },
|
||||
}
|
||||
)
|
||||
await page.dragAndDrop(
|
||||
'[data-testid="endpoint"]',
|
||||
'[data-testid="block"] >> nth=1',
|
||||
'[data-testid="group"] >> nth=1',
|
||||
{ targetPosition: { x: 100, y: 10 } }
|
||||
)
|
||||
await expect(page.locator('[data-testid="edge"]')).toBeVisible()
|
||||
await page.dragAndDrop(
|
||||
'[data-testid="endpoint"]',
|
||||
'[data-testid="step"] >> nth=1'
|
||||
'[data-testid="group"] >> nth=1'
|
||||
)
|
||||
await expect(page.locator('[data-testid="edge"]')).toBeVisible()
|
||||
await page.dragAndDrop('text=Date', '#editor-container', {
|
||||
@@ -44,7 +45,7 @@ test.describe.parallel('Editor', () => {
|
||||
})
|
||||
await page.dragAndDrop(
|
||||
'[data-testid="endpoint"] >> nth=2',
|
||||
'[data-testid="block"] >> nth=2',
|
||||
'[data-testid="group"] >> nth=2',
|
||||
{
|
||||
targetPosition: { x: 100, y: 10 },
|
||||
}
|
||||
@@ -60,7 +61,7 @@ test.describe.parallel('Editor', () => {
|
||||
const total = await page.locator('[data-testid="edge"]').count()
|
||||
expect(total).toBe(1)
|
||||
})
|
||||
test('Drag and drop steps and items should work', async ({ page }) => {
|
||||
test('Drag and drop blocks and items should work', async ({ page }) => {
|
||||
const typebotId = cuid()
|
||||
await importTypebotInDatabase(
|
||||
path.join(__dirname, '../fixtures/typebots/editor/buttonsDnd.json'),
|
||||
@@ -69,19 +70,19 @@ test.describe.parallel('Editor', () => {
|
||||
}
|
||||
)
|
||||
|
||||
// Steps dnd
|
||||
// Blocks dnd
|
||||
await page.goto(`/typebots/${typebotId}/edit`)
|
||||
await expect(page.locator('[data-testid="step"] >> nth=1')).toHaveText(
|
||||
await expect(page.locator('[data-testid="block"] >> nth=1')).toHaveText(
|
||||
'Hello!'
|
||||
)
|
||||
await page.dragAndDrop('text=Hello', '[data-testid="step"] >> nth=3', {
|
||||
await page.dragAndDrop('text=Hello', '[data-testid="block"] >> nth=3', {
|
||||
targetPosition: { x: 100, y: 0 },
|
||||
})
|
||||
await expect(page.locator('[data-testid="step"] >> nth=2')).toHaveText(
|
||||
await expect(page.locator('[data-testid="block"] >> nth=2')).toHaveText(
|
||||
'Hello!'
|
||||
)
|
||||
await page.dragAndDrop('text=Hello', 'text=Block #2')
|
||||
await expect(page.locator('[data-testid="step"] >> nth=3')).toHaveText(
|
||||
await page.dragAndDrop('text=Hello', 'text=Group #2')
|
||||
await expect(page.locator('[data-testid="block"] >> nth=3')).toHaveText(
|
||||
'Hello!'
|
||||
)
|
||||
|
||||
@@ -106,25 +107,25 @@ test.describe.parallel('Editor', () => {
|
||||
await createTypebots([
|
||||
{
|
||||
id: typebotId,
|
||||
...parseDefaultBlockWithStep({
|
||||
type: InputStepType.TEXT,
|
||||
...parseDefaultGroupWithBlock({
|
||||
type: InputBlockType.TEXT,
|
||||
options: defaultTextInputOptions,
|
||||
}),
|
||||
},
|
||||
])
|
||||
|
||||
await page.goto(`/typebots/${typebotId}/edit`)
|
||||
await page.click('text=Block #1', { button: 'right' })
|
||||
await page.click('text=Group #1', { button: 'right' })
|
||||
await page.click('text=Duplicate')
|
||||
await expect(page.locator('text="Block #1"')).toBeVisible()
|
||||
await expect(page.locator('text="Block #1 copy"')).toBeVisible()
|
||||
await page.click('text="Block #1"', { button: 'right' })
|
||||
await expect(page.locator('text="Group #1"')).toBeVisible()
|
||||
await expect(page.locator('text="Group #1 copy"')).toBeVisible()
|
||||
await page.click('text="Group #1"', { button: 'right' })
|
||||
await page.click('text=Delete')
|
||||
await expect(page.locator('text="Block #1"')).toBeHidden()
|
||||
await expect(page.locator('text="Group #1"')).toBeHidden()
|
||||
await page.click('button[aria-label="Undo"]')
|
||||
await expect(page.locator('text="Block #1"')).toBeVisible()
|
||||
await expect(page.locator('text="Group #1"')).toBeVisible()
|
||||
await page.click('button[aria-label="Redo"]')
|
||||
await expect(page.locator('text="Block #1"')).toBeHidden()
|
||||
await expect(page.locator('text="Group #1"')).toBeHidden()
|
||||
})
|
||||
|
||||
test('Rename and icon change should work', async ({ page }) => {
|
||||
@@ -133,8 +134,8 @@ test.describe.parallel('Editor', () => {
|
||||
{
|
||||
id: typebotId,
|
||||
name: 'My awesome typebot',
|
||||
...parseDefaultBlockWithStep({
|
||||
type: InputStepType.TEXT,
|
||||
...parseDefaultGroupWithBlock({
|
||||
type: InputBlockType.TEXT,
|
||||
options: defaultTextInputOptions,
|
||||
}),
|
||||
},
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
import test, { expect } from '@playwright/test'
|
||||
import {
|
||||
createTypebots,
|
||||
parseDefaultBlockWithStep,
|
||||
parseDefaultGroupWithBlock,
|
||||
} from '../../services/database'
|
||||
import { defaultChoiceInputOptions, InputStepType, ItemType } from 'models'
|
||||
import { defaultChoiceInputOptions, InputBlockType, ItemType } from 'models'
|
||||
import { typebotViewer } from '../../services/selectorUtils'
|
||||
import cuid from 'cuid'
|
||||
|
||||
test.describe.parallel('Buttons input step', () => {
|
||||
test.describe.parallel('Buttons input block', () => {
|
||||
test('can edit button items', async ({ page }) => {
|
||||
const typebotId = cuid()
|
||||
await createTypebots([
|
||||
{
|
||||
id: typebotId,
|
||||
...parseDefaultBlockWithStep({
|
||||
type: InputStepType.CHOICE,
|
||||
...parseDefaultGroupWithBlock({
|
||||
type: InputBlockType.CHOICE,
|
||||
items: [
|
||||
{
|
||||
id: 'choice1',
|
||||
stepId: 'step1',
|
||||
blockId: 'block1',
|
||||
type: ItemType.BUTTON,
|
||||
},
|
||||
],
|
||||
@@ -46,10 +46,10 @@ test.describe.parallel('Buttons input step', () => {
|
||||
await expect(typebotViewer(page).locator('text=Item 3')).toBeVisible()
|
||||
await page.click('button[aria-label="Close"]')
|
||||
|
||||
await page.click('[data-testid="step1-icon"]')
|
||||
await page.click('[data-testid="block1-icon"]')
|
||||
await page.click('text=Multiple choice?')
|
||||
await page.fill('#button', 'Go')
|
||||
await page.click('[data-testid="step1-icon"]')
|
||||
await page.click('[data-testid="block1-icon"]')
|
||||
|
||||
await page.locator('text=Item 1').hover()
|
||||
await page.click('[aria-label="Add item"]')
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
import test, { expect } from '@playwright/test'
|
||||
import {
|
||||
createTypebots,
|
||||
parseDefaultBlockWithStep,
|
||||
parseDefaultGroupWithBlock,
|
||||
} from '../../services/database'
|
||||
import { defaultDateInputOptions, InputStepType } from 'models'
|
||||
import { defaultDateInputOptions, InputBlockType } from 'models'
|
||||
import { typebotViewer } from '../../services/selectorUtils'
|
||||
import cuid from 'cuid'
|
||||
|
||||
test.describe('Date input step', () => {
|
||||
test.describe('Date input block', () => {
|
||||
test('options should work', async ({ page }) => {
|
||||
const typebotId = cuid()
|
||||
await createTypebots([
|
||||
{
|
||||
id: typebotId,
|
||||
...parseDefaultBlockWithStep({
|
||||
type: InputStepType.DATE,
|
||||
...parseDefaultGroupWithBlock({
|
||||
type: InputBlockType.DATE,
|
||||
options: defaultDateInputOptions,
|
||||
}),
|
||||
},
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
import test, { expect } from '@playwright/test'
|
||||
import {
|
||||
createTypebots,
|
||||
parseDefaultBlockWithStep,
|
||||
parseDefaultGroupWithBlock,
|
||||
} from '../../services/database'
|
||||
import { defaultEmailInputOptions, InputStepType } from 'models'
|
||||
import { defaultEmailInputOptions, InputBlockType } from 'models'
|
||||
import { typebotViewer } from '../../services/selectorUtils'
|
||||
import cuid from 'cuid'
|
||||
|
||||
test.describe('Email input step', () => {
|
||||
test.describe('Email input block', () => {
|
||||
test('options should work', async ({ page }) => {
|
||||
const typebotId = cuid()
|
||||
await createTypebots([
|
||||
{
|
||||
id: typebotId,
|
||||
...parseDefaultBlockWithStep({
|
||||
type: InputStepType.EMAIL,
|
||||
...parseDefaultGroupWithBlock({
|
||||
type: InputBlockType.EMAIL,
|
||||
options: defaultEmailInputOptions,
|
||||
}),
|
||||
},
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
import test, { expect } from '@playwright/test'
|
||||
import {
|
||||
createTypebots,
|
||||
parseDefaultBlockWithStep,
|
||||
parseDefaultGroupWithBlock,
|
||||
} from '../../services/database'
|
||||
import { defaultNumberInputOptions, InputStepType } from 'models'
|
||||
import { defaultNumberInputOptions, InputBlockType } from 'models'
|
||||
import { typebotViewer } from '../../services/selectorUtils'
|
||||
import cuid from 'cuid'
|
||||
|
||||
test.describe('Number input step', () => {
|
||||
test.describe('Number input block', () => {
|
||||
test('options should work', async ({ page }) => {
|
||||
const typebotId = cuid()
|
||||
await createTypebots([
|
||||
{
|
||||
id: typebotId,
|
||||
...parseDefaultBlockWithStep({
|
||||
type: InputStepType.NUMBER,
|
||||
...parseDefaultGroupWithBlock({
|
||||
type: InputBlockType.NUMBER,
|
||||
options: defaultNumberInputOptions,
|
||||
}),
|
||||
},
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
import test, { expect } from '@playwright/test'
|
||||
import {
|
||||
createTypebots,
|
||||
parseDefaultBlockWithStep,
|
||||
parseDefaultGroupWithBlock,
|
||||
} from '../../services/database'
|
||||
import { defaultPaymentInputOptions, InputStepType } from 'models'
|
||||
import { defaultPaymentInputOptions, InputBlockType } from 'models'
|
||||
import cuid from 'cuid'
|
||||
import { stripePaymentForm, typebotViewer } from '../../services/selectorUtils'
|
||||
|
||||
test.describe('Payment input step', () => {
|
||||
test.describe('Payment input block', () => {
|
||||
test('Can configure Stripe account', async ({ page }) => {
|
||||
const typebotId = cuid()
|
||||
await createTypebots([
|
||||
{
|
||||
id: typebotId,
|
||||
...parseDefaultBlockWithStep({
|
||||
type: InputStepType.PAYMENT,
|
||||
...parseDefaultGroupWithBlock({
|
||||
type: InputBlockType.PAYMENT,
|
||||
options: defaultPaymentInputOptions,
|
||||
}),
|
||||
},
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
import test, { expect } from '@playwright/test'
|
||||
import {
|
||||
createTypebots,
|
||||
parseDefaultBlockWithStep,
|
||||
parseDefaultGroupWithBlock,
|
||||
} from '../../services/database'
|
||||
import { defaultPhoneInputOptions, InputStepType } from 'models'
|
||||
import { defaultPhoneInputOptions, InputBlockType } from 'models'
|
||||
import { typebotViewer } from '../../services/selectorUtils'
|
||||
import cuid from 'cuid'
|
||||
|
||||
test.describe('Phone input step', () => {
|
||||
test.describe('Phone input block', () => {
|
||||
test('options should work', async ({ page }) => {
|
||||
const typebotId = cuid()
|
||||
await createTypebots([
|
||||
{
|
||||
id: typebotId,
|
||||
...parseDefaultBlockWithStep({
|
||||
type: InputStepType.PHONE,
|
||||
...parseDefaultGroupWithBlock({
|
||||
type: InputBlockType.PHONE,
|
||||
options: defaultPhoneInputOptions,
|
||||
}),
|
||||
},
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import test, { expect } from '@playwright/test'
|
||||
import {
|
||||
createTypebots,
|
||||
parseDefaultBlockWithStep,
|
||||
parseDefaultGroupWithBlock,
|
||||
} from '../../services/database'
|
||||
import { defaultRatingInputOptions, InputStepType } from 'models'
|
||||
import { defaultRatingInputOptions, InputBlockType } from 'models'
|
||||
import { typebotViewer } from '../../services/selectorUtils'
|
||||
import cuid from 'cuid'
|
||||
|
||||
@@ -25,8 +25,8 @@ test('options should work', async ({ page }) => {
|
||||
await createTypebots([
|
||||
{
|
||||
id: typebotId,
|
||||
...parseDefaultBlockWithStep({
|
||||
type: InputStepType.RATING,
|
||||
...parseDefaultGroupWithBlock({
|
||||
type: InputBlockType.RATING,
|
||||
options: defaultRatingInputOptions,
|
||||
}),
|
||||
},
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
import test, { expect } from '@playwright/test'
|
||||
import {
|
||||
createTypebots,
|
||||
parseDefaultBlockWithStep,
|
||||
parseDefaultGroupWithBlock,
|
||||
} from '../../services/database'
|
||||
import { defaultTextInputOptions, InputStepType } from 'models'
|
||||
import { defaultTextInputOptions, InputBlockType } from 'models'
|
||||
import { typebotViewer } from '../../services/selectorUtils'
|
||||
import cuid from 'cuid'
|
||||
|
||||
test.describe.parallel('Text input step', () => {
|
||||
test.describe.parallel('Text input block', () => {
|
||||
test('options should work', async ({ page }) => {
|
||||
const typebotId = cuid()
|
||||
await createTypebots([
|
||||
{
|
||||
id: typebotId,
|
||||
...parseDefaultBlockWithStep({
|
||||
type: InputStepType.TEXT,
|
||||
...parseDefaultGroupWithBlock({
|
||||
type: InputBlockType.TEXT,
|
||||
options: defaultTextInputOptions,
|
||||
}),
|
||||
},
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
import test, { expect } from '@playwright/test'
|
||||
import {
|
||||
createTypebots,
|
||||
parseDefaultBlockWithStep,
|
||||
parseDefaultGroupWithBlock,
|
||||
} from '../../services/database'
|
||||
import { defaultUrlInputOptions, InputStepType } from 'models'
|
||||
import { defaultUrlInputOptions, InputBlockType } from 'models'
|
||||
import { typebotViewer } from '../../services/selectorUtils'
|
||||
import cuid from 'cuid'
|
||||
|
||||
test.describe('Url input step', () => {
|
||||
test.describe('Url input block', () => {
|
||||
test('options should work', async ({ page }) => {
|
||||
const typebotId = cuid()
|
||||
await createTypebots([
|
||||
{
|
||||
id: typebotId,
|
||||
...parseDefaultBlockWithStep({
|
||||
type: InputStepType.URL,
|
||||
...parseDefaultGroupWithBlock({
|
||||
type: InputBlockType.URL,
|
||||
options: defaultUrlInputOptions,
|
||||
}),
|
||||
},
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
import test from '@playwright/test'
|
||||
import {
|
||||
createTypebots,
|
||||
parseDefaultBlockWithStep,
|
||||
parseDefaultGroupWithBlock,
|
||||
} from '../../services/database'
|
||||
import { defaultGoogleAnalyticsOptions, IntegrationStepType } from 'models'
|
||||
import { defaultGoogleAnalyticsOptions, IntegrationBlockType } from 'models'
|
||||
import cuid from 'cuid'
|
||||
|
||||
test.describe('Google Analytics step', () => {
|
||||
test.describe('Google Analytics block', () => {
|
||||
test('its configuration should work', async ({ page }) => {
|
||||
const typebotId = cuid()
|
||||
await createTypebots([
|
||||
{
|
||||
id: typebotId,
|
||||
...parseDefaultBlockWithStep({
|
||||
type: IntegrationStepType.GOOGLE_ANALYTICS,
|
||||
...parseDefaultGroupWithBlock({
|
||||
type: IntegrationBlockType.GOOGLE_ANALYTICS,
|
||||
options: defaultGoogleAnalyticsOptions,
|
||||
}),
|
||||
},
|
||||
|
||||
@@ -6,7 +6,7 @@ import cuid from 'cuid'
|
||||
|
||||
const typebotId = cuid()
|
||||
|
||||
test.describe('Send email step', () => {
|
||||
test.describe('Send email block', () => {
|
||||
test('its configuration should work', async ({ page }) => {
|
||||
if (
|
||||
!process.env.SMTP_USERNAME ||
|
||||
|
||||
@@ -4,7 +4,7 @@ import path from 'path'
|
||||
import { HttpMethod } from 'models'
|
||||
import cuid from 'cuid'
|
||||
|
||||
test.describe('Webhook step', () => {
|
||||
test.describe('Webhook block', () => {
|
||||
test('easy configuration should work', async ({ page }) => {
|
||||
const typebotId = cuid()
|
||||
await importTypebotInDatabase(
|
||||
@@ -25,7 +25,7 @@ test.describe('Webhook step', () => {
|
||||
)
|
||||
await page.click('text=Test the request')
|
||||
await expect(page.locator('div[role="textbox"] >> nth=-1')).toContainText(
|
||||
`"Block #1": "answer value", "Block #2": "20", "Block #2 (1)": "Yes"`
|
||||
`"Group #1": "answer value", "Group #2": "20", "Group #2 (1)": "Yes"`
|
||||
)
|
||||
})
|
||||
test('Generated body should work', async ({ page }) => {
|
||||
|
||||
@@ -6,7 +6,7 @@ import cuid from 'cuid'
|
||||
|
||||
const typebotId = cuid()
|
||||
|
||||
test.describe('Code step', () => {
|
||||
test.describe('Code block', () => {
|
||||
test('code should trigger', async ({ page }) => {
|
||||
await importTypebotInDatabase(
|
||||
path.join(__dirname, '../../fixtures/typebots/logic/code.json'),
|
||||
|
||||
@@ -6,7 +6,7 @@ import cuid from 'cuid'
|
||||
|
||||
const typebotId = cuid()
|
||||
|
||||
test.describe('Condition step', () => {
|
||||
test.describe('Condition block', () => {
|
||||
test('its configuration should work', async ({ page }) => {
|
||||
await importTypebotInDatabase(
|
||||
path.join(__dirname, '../../fixtures/typebots/logic/condition.json'),
|
||||
|
||||
@@ -6,7 +6,7 @@ import cuid from 'cuid'
|
||||
|
||||
const typebotId = cuid()
|
||||
|
||||
test.describe('Redirect step', () => {
|
||||
test.describe('Redirect block', () => {
|
||||
test('its configuration should work', async ({ page, context }) => {
|
||||
await importTypebotInDatabase(
|
||||
path.join(__dirname, '../../fixtures/typebots/logic/redirect.json'),
|
||||
|
||||
@@ -6,7 +6,7 @@ import cuid from 'cuid'
|
||||
|
||||
const typebotId = cuid()
|
||||
|
||||
test.describe('Set variable step', () => {
|
||||
test.describe('Set variable block', () => {
|
||||
test('its configuration should work', async ({ page }) => {
|
||||
await importTypebotInDatabase(
|
||||
path.join(__dirname, '../../fixtures/typebots/logic/setVariable.json'),
|
||||
|
||||
@@ -30,15 +30,15 @@ test('should be configurable', async ({ page }) => {
|
||||
await page.click('text=Jump in My link typebot 2')
|
||||
await expect(page.locator('input[value="My link typebot 2"]')).toBeVisible()
|
||||
await page.click('input[placeholder="Select a block"]')
|
||||
await page.click('text=Block #2')
|
||||
await page.click('text=Group #2')
|
||||
|
||||
await page.click('text=Preview')
|
||||
await expect(typebotViewer(page).locator('text=Second block')).toBeVisible()
|
||||
|
||||
await page.click('[aria-label="Close"]')
|
||||
await page.click('text=Jump to Block #2 in My link typebot 2')
|
||||
await page.click('input[value="Block #2"]', { clickCount: 3 })
|
||||
await page.press('input[value="Block #2"]', 'Backspace')
|
||||
await page.click('text=Jump to Group #2 in My link typebot 2')
|
||||
await page.click('input[value="Group #2"]', { clickCount: 3 })
|
||||
await page.press('input[value="Group #2"]', 'Backspace')
|
||||
await page.click('button >> text=Start')
|
||||
|
||||
await page.click('text=Preview')
|
||||
|
||||
@@ -2,14 +2,14 @@ import test, { expect, Page } from '@playwright/test'
|
||||
import cuid from 'cuid'
|
||||
import { readFileSync } from 'fs'
|
||||
import prisma from 'libs/prisma'
|
||||
import { defaultTextInputOptions, InputStepType } from 'models'
|
||||
import { defaultTextInputOptions, InputBlockType } from 'models'
|
||||
import { parse } from 'papaparse'
|
||||
import path from 'path'
|
||||
import {
|
||||
createResults,
|
||||
createTypebots,
|
||||
importTypebotInDatabase,
|
||||
parseDefaultBlockWithStep,
|
||||
parseDefaultGroupWithBlock,
|
||||
} from '../services/database'
|
||||
import { deleteButtonInConfirmDialog } from '../services/selectorUtils'
|
||||
|
||||
@@ -44,8 +44,8 @@ test.describe('Results page', () => {
|
||||
await createTypebots([
|
||||
{
|
||||
id: typebotId,
|
||||
...parseDefaultBlockWithStep({
|
||||
type: InputStepType.TEXT,
|
||||
...parseDefaultGroupWithBlock({
|
||||
type: InputBlockType.TEXT,
|
||||
options: defaultTextInputOptions,
|
||||
}),
|
||||
},
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import test, { expect } from '@playwright/test'
|
||||
import cuid from 'cuid'
|
||||
import { defaultTextInputOptions, InputStepType } from 'models'
|
||||
import { defaultTextInputOptions, InputBlockType } from 'models'
|
||||
import {
|
||||
createTypebots,
|
||||
parseDefaultBlockWithStep,
|
||||
parseDefaultGroupWithBlock,
|
||||
sharedWorkspaceId,
|
||||
} from '../services/database'
|
||||
|
||||
@@ -17,8 +17,8 @@ test.beforeAll(async () => {
|
||||
id: freeTypebotId,
|
||||
name: 'Shared typebot',
|
||||
workspaceId: sharedWorkspaceId,
|
||||
...parseDefaultBlockWithStep({
|
||||
type: InputStepType.TEXT,
|
||||
...parseDefaultGroupWithBlock({
|
||||
type: InputBlockType.TEXT,
|
||||
options: {
|
||||
...defaultTextInputOptions,
|
||||
labels: {
|
||||
|
||||
Reference in New Issue
Block a user