-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(settings): ✨ Add create result on page refresh option
- Loading branch information
1 parent
e3e07dd
commit 260819f
Showing
5 changed files
with
91 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import test, { expect } from '@playwright/test' | ||
import { createTypebots, parseDefaultBlockWithStep } from '../services/database' | ||
import { generate } from 'short-uuid' | ||
import { defaultSettings, defaultTextInputOptions, InputStepType } from 'models' | ||
|
||
test('Result should be in storage by default', async ({ page }) => { | ||
const typebotId = generate() | ||
await createTypebots([ | ||
{ | ||
id: typebotId, | ||
...parseDefaultBlockWithStep({ | ||
type: InputStepType.TEXT, | ||
options: defaultTextInputOptions, | ||
}), | ||
}, | ||
]) | ||
await page.goto(`/${typebotId}-public`) | ||
await page.waitForResponse( | ||
(resp) => | ||
resp.request().url().includes(`/api/typebots/${typebotId}/results`) && | ||
resp.status() === 200 && | ||
resp.request().method() === 'POST' | ||
) | ||
await page.reload() | ||
const resultId = await page.evaluate(() => sessionStorage.getItem('resultId')) | ||
expect(resultId).toBeDefined() | ||
}) | ||
|
||
test.describe('Create result on page refresh enabled', () => { | ||
test('should work', async ({ page }) => { | ||
const typebotId = generate() | ||
await createTypebots([ | ||
{ | ||
id: typebotId, | ||
settings: { | ||
...defaultSettings, | ||
general: { | ||
...defaultSettings.general, | ||
isNewResultOnRefreshEnabled: true, | ||
}, | ||
}, | ||
...parseDefaultBlockWithStep({ | ||
type: InputStepType.TEXT, | ||
options: defaultTextInputOptions, | ||
}), | ||
}, | ||
]) | ||
await page.goto(`/${typebotId}-public`) | ||
await page.waitForResponse( | ||
(resp) => | ||
resp.request().url().includes(`/api/typebots/${typebotId}/results`) && | ||
resp.status() === 200 && | ||
resp.request().method() === 'POST' | ||
) | ||
await page.reload() | ||
await page.waitForResponse( | ||
(resp) => | ||
resp.request().url().includes(`/api/typebots/${typebotId}/results`) && | ||
resp.status() === 200 && | ||
resp.request().method() === 'POST' | ||
) | ||
const resultId = await page.evaluate(() => | ||
sessionStorage.getItem('resultId') | ||
) | ||
expect(resultId).toBe(null) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
260819f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
builder-v2 – ./apps/builder
builder-v2-typebot-io.vercel.app
app.typebot.io
builder-v2-git-main-typebot-io.vercel.app
260819f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
viewer-v2 – ./apps/viewer
demo.wemakebots.xyz
app.yvon.earth
88584434.therpm.club
bot.matthesv.de
viewer.typebot.io
zap.fundviser.in
92109660.therpm.club
bot.contakit.com
chat.hayuri.id
chat.matthesv.de
bot.digitalpointer.id
bot.pratikmandalia.com
bot.outstandbrand.com
invite.bridesquadapp.com
criar.somaperuzzo.com
link.venturasuceder.com
typebot-viewer.vercel.app
chat.thehomebuyersusa.com
bot.adventureconsulting.hu
chat.atlasoutfittersk9.com
tarian.theiofoundation.org
bot.pinpointinteractive.com
viewer-v2-typebot-io.vercel.app
viewer-v2-git-main-typebot-io.vercel.app