diff --git a/apps/builder/.gitignore b/apps/builder/.gitignore
new file mode 100644
index 000000000..5566491b9
--- /dev/null
+++ b/apps/builder/.gitignore
@@ -0,0 +1,2 @@
+cypress/videos
+cypress/screenshots
\ No newline at end of file
diff --git a/apps/builder/components/board/Board.tsx b/apps/builder/components/board/Board.tsx
index a059904ca..6e4f45538 100644
--- a/apps/builder/components/board/Board.tsx
+++ b/apps/builder/components/board/Board.tsx
@@ -1,13 +1,13 @@
import { Flex } from '@chakra-ui/react'
import React from 'react'
-import StepsList from './StepTypesList'
import Graph from './graph/Graph'
import { DndContext } from 'contexts/DndContext'
+import StepTypesList from './StepTypesList'
export const Board = () => (
-
+
diff --git a/apps/builder/components/board/graph/Graph.tsx b/apps/builder/components/board/graph/Graph.tsx
index 6ba686290..7976e2fd0 100644
--- a/apps/builder/components/board/graph/Graph.tsx
+++ b/apps/builder/components/board/graph/Graph.tsx
@@ -10,7 +10,6 @@ import { StartBlockNode } from './BlockNode/StartBlockNode'
const Graph = () => {
const { draggedStepType, setDraggedStepType, draggedStep, setDraggedStep } =
useDnd()
- const graphRef = useRef(null)
const graphContainerRef = useRef(null)
const { typebot } = useTypebot()
const {
@@ -59,8 +58,8 @@ const Graph = () => {
addNewBlock({
step: draggedStep,
type: draggedStepType,
- x: e.x - graphPosition.x - blockWidth / 3,
- y: e.y - graphPosition.y - 20,
+ x: e.clientX - graphPosition.x - blockWidth / 3,
+ y: e.clientY - graphPosition.y - 20,
})
setDraggedStep(undefined)
setDraggedStepType(undefined)
@@ -69,11 +68,10 @@ const Graph = () => {
if (!typebot) return <>>
return (
-
+
{
label: 'Start',
},
],
- title: 'Start',
+ title: 'Home',
}
- prisma.typebot.createMany({
+ const blocks: Block[] = [
+ {
+ id: 'block1',
+ title: 'Block1',
+ graphCoordinates: { x: 150, y: 150 },
+ steps: [
+ { id: 'step1', blockId: 'block1', type: StepType.TEXT, content: '' },
+ {
+ id: 'step2',
+ blockId: 'block1',
+ type: StepType.DATE_PICKER,
+ content: '',
+ },
+ ],
+ },
+ {
+ id: 'block2',
+ title: 'Block2',
+ graphCoordinates: { x: 300, y: 300 },
+ steps: [
+ { id: 'step1', blockId: 'block2', type: StepType.TEXT, content: '' },
+ ],
+ },
+ ]
+ return prisma.typebot.createMany({
data: [
{ id: 'typebot1', name: 'Typebot #1', ownerId: 'test2', startBlock },
+ {
+ id: 'typebot2',
+ name: 'Typebot #2',
+ ownerId: 'test2',
+ startBlock,
+ blocks,
+ },
],
})
}
diff --git a/apps/builder/cypress/tests/auth.ts b/apps/builder/cypress/tests/auth.ts
deleted file mode 100644
index 882d1c2cb..000000000
--- a/apps/builder/cypress/tests/auth.ts
+++ /dev/null
@@ -1,104 +0,0 @@
-describe('SignIn page', () => {
- beforeEach(() => {
- cy.signOut()
- })
-
- it('can continue with Google', () => {
- cy.visit('/signin')
- const username = Cypress.env('GOOGLE_USER')
- const password = Cypress.env('GOOGLE_PW')
- const loginUrl = Cypress.env('SITE_NAME')
- const cookieName = Cypress.env('COOKIE_NAME')
- exectueSocialLogin(
- 'GoogleSocialLogin',
- username,
- password,
- loginUrl,
- cookieName
- )
- })
-
- it('can continue with GitHub', () => {
- cy.visit('/signin')
- const username = Cypress.env('GITHUB_USER')
- const password = Cypress.env('GITHUB_PW')
- const loginUrl = Cypress.env('SITE_NAME')
- const cookieName = Cypress.env('COOKIE_NAME')
- exectueSocialLogin(
- 'GitHubSocialLogin',
- username,
- password,
- loginUrl,
- cookieName
- )
- })
-
- it('can continue with Facebook', () => {
- cy.visit('/signin')
- const username = Cypress.env('FACEBOOK_USER')
- const password = Cypress.env('FACEBOOK_PW')
- const loginUrl = Cypress.env('SITE_NAME')
- const cookieName = Cypress.env('COOKIE_NAME')
- exectueSocialLogin(
- 'FacebookSocialLogin',
- username,
- password,
- loginUrl,
- cookieName,
- [
- 'button[data-testid="cookie-policy-dialog-manage-button"]',
- 'button[data-testid="cookie-policy-manage-dialog-accept-button"]',
- ]
- )
- })
-
- // We don't test email sign in because disabling email sending is not straightforward
-})
-
-const exectueSocialLogin = (
- task: 'FacebookSocialLogin' | 'GoogleSocialLogin' | 'GitHubSocialLogin',
- username: string,
- password: string,
- loginUrl: string,
- cookieName: string,
- trackingConsentSelectors?: string[]
-) => {
- const selectorId =
- task === 'FacebookSocialLogin'
- ? 'facebook'
- : task === 'GoogleSocialLogin'
- ? 'google'
- : 'github'
- const socialLoginOptions = {
- username,
- password,
- loginUrl,
- headless: true,
- logs: true,
- isPopup: false,
- loginSelector: `[data-testid="${selectorId}"]`,
- postLoginSelector: `[data-testid="authenticated"]`,
- trackingConsentSelectors,
- }
-
- cy.task(task, socialLoginOptions).then(({ cookies }: any) => {
- const cookie = cookies
- .filter((cookie: any) => cookie.name === cookieName)
- .pop()
- if (cookie) {
- cy.setCookie(cookie.name, cookie.value, {
- domain: cookie.domain,
- expiry: cookie.expires,
- httpOnly: cookie.httpOnly,
- path: cookie.path,
- secure: cookie.secure,
- })
-
- Cypress.Cookies.defaults({
- preserve: cookieName,
- })
- }
- cy.visit('/typebots')
- cy.findByRole('button', { name: 'Create a folder' }).should('exist')
- })
-}
diff --git a/apps/builder/cypress/tests/board.ts b/apps/builder/cypress/tests/board.ts
index b876d1816..80ae0df5e 100644
--- a/apps/builder/cypress/tests/board.ts
+++ b/apps/builder/cypress/tests/board.ts
@@ -3,8 +3,10 @@ describe('BoardPage', () => {
cy.task('seed')
cy.signOut()
})
+
it('steps should be droppable', () => {
cy.signIn('test2@gmail.com')
cy.visit('/typebots/typebot1')
+ // Can't find an easy way to implement this
})
})
diff --git a/apps/builder/cypress/tests/dashboard.ts b/apps/builder/cypress/tests/dashboard.ts
index f9e34eda2..a5eeb5f8a 100644
--- a/apps/builder/cypress/tests/dashboard.ts
+++ b/apps/builder/cypress/tests/dashboard.ts
@@ -29,11 +29,11 @@ describe('Dashboard page', () => {
it('should be droppable', () => {
cy.signIn('test2@gmail.com')
cy.visit('/typebots')
- cy.findByTestId('typebot-button').mouseMoveBy(-100, 0, {
+ cy.findByTestId('typebot-button-typebot1').mouseMoveBy(-100, 0, {
delay: 120,
})
cy.visit('/typebots/folders/folder1')
- cy.findByTestId('typebot-button').mouseMoveBy(-300, -100, {
+ cy.findByTestId('typebot-button-typebot1').mouseMoveBy(-300, -100, {
delay: 120,
})
cy.visit('/typebots')
diff --git a/apps/builder/cypress/tsconfig.json b/apps/builder/cypress/tsconfig.json
index 3dbbe026f..440f3aeb1 100644
--- a/apps/builder/cypress/tsconfig.json
+++ b/apps/builder/cypress/tsconfig.json
@@ -9,6 +9,7 @@
"isolatedModules": false,
"allowJs": true,
"noEmit": true,
- "downlevelIteration": true
+ "downlevelIteration": true,
+ "jsx": "react"
}
}
diff --git a/apps/builder/package.json b/apps/builder/package.json
index f7a6f9c27..b22a75ca7 100644
--- a/apps/builder/package.json
+++ b/apps/builder/package.json
@@ -2,7 +2,7 @@
"name": "builder",
"version": "0.1.0",
"scripts": {
- "dev": "next dev",
+ "dev": "next dev -p 3000",
"build": "next build",
"start": "next start",
"lint": "next lint",
diff --git a/package.json b/package.json
index bf5893c14..2986b5ff3 100644
--- a/package.json
+++ b/package.json
@@ -6,14 +6,11 @@
"apps/*"
],
"scripts": {
- "builder": "yarn workspace builder",
- "viewer": "yarn workspace viewer",
- "db": "yarn workspace db",
- "bot-engine": "yarn workspace bot-engine",
- "db:up": "docker-compose up -d && yarn db prisma db push",
+ "docker:up": "docker-compose up -d",
"db:nuke": "docker-compose down --volumes --remove-orphans",
+ "dev": "dotenv -e .env yarn docker:up && dotenv -e .env turbo run dev --parallel",
"build": "dotenv -e .env turbo run build",
- "dev": "dotenv -e .env yarn db:up && turbo run dev --parallel",
+ "test": "dotenv -e .env turbo run dev test",
"lint": "turbo run lint"
},
"devDependencies": {
@@ -33,7 +30,7 @@
},
"test": {
"dependsOn": [
- "^build"
+ "^dev"
],
"outputs": []
},
diff --git a/packages/db/package.json b/packages/db/package.json
index b1326afc2..99cae86b2 100644
--- a/packages/db/package.json
+++ b/packages/db/package.json
@@ -12,6 +12,7 @@
"@prisma/client": "latest"
},
"scripts": {
+ "dev": "yarn prisma db push",
"build": "prisma generate && prisma migrate deploy"
}
}