refactor(editor): ♻️ Undo / Redo buttons + structure refacto
Yet another huge refacto... While implementing undo and redo features I understood that I updated the stored typebot too many times (i.e. on each key input) so I had to rethink it entirely. I also moved around some files.
This commit is contained in:
@ -4,11 +4,11 @@ import {
|
||||
parseDefaultBlockWithStep,
|
||||
} from '../../services/database'
|
||||
import { defaultGoogleAnalyticsOptions, IntegrationStepType } from 'models'
|
||||
|
||||
const typebotId = 'google-analytics-step'
|
||||
import { generate } from 'short-uuid'
|
||||
|
||||
test.describe('Google Analytics step', () => {
|
||||
test('its configuration should work', async ({ page }) => {
|
||||
const typebotId = generate()
|
||||
await createTypebots([
|
||||
{
|
||||
id: typebotId,
|
||||
|
@ -2,10 +2,11 @@ import test, { expect, Page } from '@playwright/test'
|
||||
import { importTypebotInDatabase } from '../../services/database'
|
||||
import path from 'path'
|
||||
import { typebotViewer } from '../../services/selectorUtils'
|
||||
import { generate } from 'short-uuid'
|
||||
|
||||
test.describe.parallel('Google sheets integration', () => {
|
||||
test('Insert row should work', async ({ page }) => {
|
||||
const typebotId = 'google-sheets-insert'
|
||||
const typebotId = generate()
|
||||
await importTypebotInDatabase(
|
||||
path.join(
|
||||
__dirname,
|
||||
@ -20,10 +21,11 @@ test.describe.parallel('Google sheets integration', () => {
|
||||
await page.click('text=Select an operation')
|
||||
await page.click('text=Insert a row')
|
||||
|
||||
await page.click('text=Add a value')
|
||||
await page.click('text=Select a column')
|
||||
await page.click('text="Email" >> nth = 1')
|
||||
await page.click('button >> text="Email"')
|
||||
await page.click('[aria-label="Insert a variable"]')
|
||||
await page.click('text="Email" >> nth = 2')
|
||||
await page.click('button >> text="Email" >> nth=1')
|
||||
|
||||
await page.click('text=Add a value')
|
||||
await page.click('text=Select a column')
|
||||
@ -54,7 +56,7 @@ test.describe.parallel('Google sheets integration', () => {
|
||||
})
|
||||
|
||||
test('Update row should work', async ({ page }) => {
|
||||
const typebotId = 'google-sheets-update'
|
||||
const typebotId = generate()
|
||||
await importTypebotInDatabase(
|
||||
path.join(
|
||||
__dirname,
|
||||
@ -69,11 +71,13 @@ test.describe.parallel('Google sheets integration', () => {
|
||||
await page.click('text=Select an operation')
|
||||
await page.click('text=Update a row')
|
||||
|
||||
await page.click('text=Add a value')
|
||||
await page.click('text=Select a column')
|
||||
await page.click('text="Email" >> nth = 1')
|
||||
await page.click('button >> text="Email"')
|
||||
await page.click('[aria-label="Insert a variable"]')
|
||||
await page.click('text="Email" >> nth = 2')
|
||||
await page.click('button >> text="Email" >> nth=1')
|
||||
|
||||
await page.click('text=Add a value')
|
||||
await page.click('text=Select a column')
|
||||
await page.click('text=Last name')
|
||||
await page.fill(
|
||||
@ -102,7 +106,7 @@ test.describe.parallel('Google sheets integration', () => {
|
||||
})
|
||||
|
||||
test('Get row should work', async ({ page }) => {
|
||||
const typebotId = 'google-sheets-get'
|
||||
const typebotId = generate()
|
||||
await importTypebotInDatabase(
|
||||
path.join(
|
||||
__dirname,
|
||||
@ -118,16 +122,16 @@ test.describe.parallel('Google sheets integration', () => {
|
||||
await page.click('text=Get data from sheet')
|
||||
|
||||
await page.click('text=Select a column')
|
||||
await page.click('text="Email" >> nth = 1')
|
||||
await page.click('button >> text="Email"')
|
||||
await page.click('[aria-label="Insert a variable"]')
|
||||
await page.click('text="Email" >> nth = 2')
|
||||
await page.click('button >> text="Email" >> nth=1')
|
||||
|
||||
await page.click('text=Add a value')
|
||||
await page.click('text=Select a column')
|
||||
await page.click('text="First name"')
|
||||
await createNewVar(page, 'First name')
|
||||
|
||||
await page.click('text=Add a value')
|
||||
|
||||
await page.click('text=Select a column')
|
||||
await page.click('text="Last name"')
|
||||
await createNewVar(page, 'Last name')
|
||||
|
@ -1,8 +1,9 @@
|
||||
import test, { expect, Page } from '@playwright/test'
|
||||
import { importTypebotInDatabase } from '../../services/database'
|
||||
import path from 'path'
|
||||
import { generate } from 'short-uuid'
|
||||
|
||||
const typebotId = 'webhook-step'
|
||||
const typebotId = generate()
|
||||
|
||||
test.describe('Webhook step', () => {
|
||||
test('its configuration should work', async ({ page }) => {
|
||||
@ -23,6 +24,7 @@ test.describe('Webhook step', () => {
|
||||
)
|
||||
|
||||
await page.click('text=Query params')
|
||||
await page.click('text=Add a param')
|
||||
await page.fill('input[placeholder="e.g. email"]', 'firstParam')
|
||||
await page.fill('input[placeholder="e.g. {{Email}}"]', '{{secret 1}}')
|
||||
|
||||
@ -34,6 +36,7 @@ test.describe('Webhook step', () => {
|
||||
)
|
||||
|
||||
await page.click('text=Headers')
|
||||
await page.click('text=Add a value')
|
||||
await page.fill('input[placeholder="e.g. Content-Type"]', 'Custom-Typebot')
|
||||
await page.fill(
|
||||
'input[placeholder="e.g. application/json"]',
|
||||
@ -45,11 +48,8 @@ test.describe('Webhook step', () => {
|
||||
|
||||
await page.click('text=Variable values for test')
|
||||
await addTestVariable(page, 'secret 1', 'secret1')
|
||||
await page.click('text=Add an entry')
|
||||
await addTestVariable(page, 'secret 2', 'secret2')
|
||||
await page.click('text=Add an entry')
|
||||
await addTestVariable(page, 'secret 3', 'secret3')
|
||||
await page.click('text=Add an entry')
|
||||
await addTestVariable(page, 'secret 4', 'secret4')
|
||||
|
||||
await page.click('text=Test the request')
|
||||
@ -58,12 +58,14 @@ test.describe('Webhook step', () => {
|
||||
)
|
||||
|
||||
await page.click('text=Save in variables')
|
||||
await page.click('text=Add an entry >> nth=-1')
|
||||
await page.click('input[placeholder="Select the data"]')
|
||||
await page.click('text=data[0].name')
|
||||
})
|
||||
})
|
||||
|
||||
const addTestVariable = async (page: Page, name: string, value: string) => {
|
||||
await page.click('text=Add an entry')
|
||||
await page.click('[data-testid="variables-input"] >> nth=-1')
|
||||
await page.click(`text="${name}"`)
|
||||
await page.fill('input >> nth=-1', value)
|
||||
|
Reference in New Issue
Block a user