2
0

refactor: ♻️ Rename step to block

This commit is contained in:
Baptiste Arnaud
2022-06-11 07:27:38 +02:00
parent 8751766d0e
commit 2df8338505
297 changed files with 4292 additions and 3989 deletions

View File

@ -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,

View File

@ -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,
},

View File

@ -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,
}),
},

View File

@ -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,