2
0

🐛 (payment) Fix payment redirection

This commit is contained in:
Baptiste Arnaud
2024-06-26 10:59:11 +02:00
parent 6db0464fd7
commit 6af47a8cfe
16 changed files with 182 additions and 38 deletions

View File

@@ -0,0 +1,94 @@
{
"version": "6",
"id": "clxvjgawa0003lu4yp38homts",
"name": "Lead Generation",
"events": [
{
"id": "k6kY6gwRE6noPoYQNGzgUq",
"outgoingEdgeId": "oNvqaqNExdSH2kKEhKZHuE",
"graphCoordinates": { "x": 0, "y": 0 },
"type": "start"
}
],
"groups": [
{
"id": "kinRXxYop2X4d7F9qt8WNB",
"title": "Welcome",
"graphCoordinates": { "x": 1, "y": 148 },
"blocks": [
{
"id": "sc1y8VwDabNJgiVTBi4qtif",
"type": "text",
"content": {
"richText": [
{
"type": "p",
"children": [
{ "text": "Welcome to " },
{ "bold": true, "text": "AA" },
{ "text": " (Awesome Agency)" }
]
}
]
}
},
{
"id": "xccq75m3fe7l6ads4wcvian0",
"type": "payment input",
"options": {
"credentialsId": "stripe",
"amount": "10"
}
},
{
"id": "wo8xv8kqc8dpwadvoepv3bua",
"type": "text",
"content": {
"richText": [
{ "type": "p", "children": [{ "text": "Thank you!" }] }
]
}
}
]
}
],
"edges": [
{
"id": "oNvqaqNExdSH2kKEhKZHuE",
"from": { "eventId": "k6kY6gwRE6noPoYQNGzgUq" },
"to": { "groupId": "kinRXxYop2X4d7F9qt8WNB" }
}
],
"variables": [
{
"id": "vml1jtton0xpmnk2vkwog488g",
"name": "Attachments",
"isSessionVariable": true
},
{
"id": "giiLFGw5xXBCHzvp1qAbdX",
"name": "Name",
"isSessionVariable": true
},
{
"id": "v3VFChNVSCXQ2rXv4DrJ8Ah",
"name": "Email",
"isSessionVariable": true
}
],
"theme": {},
"selectedThemeTemplateId": null,
"settings": {},
"createdAt": "2024-06-26T07:53:07.882Z",
"updatedAt": "2024-06-26T08:12:50.867Z",
"icon": "🤝",
"folderId": null,
"publicId": "lead-generation-38homts",
"customDomain": null,
"workspaceId": "proWorkspace",
"resultsTablePreferences": null,
"isArchived": false,
"isClosed": false,
"whatsAppCredentialsId": null,
"riskLevel": null
}

View File

@@ -0,0 +1,22 @@
import { createId } from '@paralleldrive/cuid2'
import test, { expect } from '@playwright/test'
import { getTestAsset } from './utils/playwright'
import { importTypebotInDatabase } from '@typebot.io/playwright/databaseActions'
test('Payment redirection should work', async ({ page }) => {
const typebotId = createId()
await importTypebotInDatabase(getTestAsset('typebots/payment.json'), {
id: typebotId,
publicId: `${typebotId}-public`,
})
await page.goto(`/${typebotId}-public`)
const paypalButton = page
.frameLocator('iframe[title="Secure payment input frame"]')
.getByTestId('paypal')
await expect(paypalButton).toBeVisible()
await page.waitForTimeout(1000)
await paypalButton.click()
await page.getByRole('button', { name: 'Pay $' }).click()
await page.getByRole('link', { name: 'Authorize Test Payment' }).click()
await expect(page.getByText('Thank you!')).toBeVisible()
})