🐛 (payment) Fix payment redirection
This commit is contained in:
94
apps/viewer/src/test/assets/typebots/payment.json
Normal file
94
apps/viewer/src/test/assets/typebots/payment.json
Normal 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
|
||||
}
|
||||
22
apps/viewer/src/test/payment.spec.ts
Normal file
22
apps/viewer/src/test/payment.spec.ts
Normal 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()
|
||||
})
|
||||
Reference in New Issue
Block a user