Add client side action e2e test

This commit is contained in:
Baptiste Arnaud 2025-05-07 08:21:29 +02:00
parent 6715e068be
commit 009e18dcf3
No known key found for this signature in database
2 changed files with 85 additions and 0 deletions

View File

@ -0,0 +1,70 @@
{
"version": "6.1",
"id": "cmadjs01m0001f63rw64lwp1z",
"name": "My typebot",
"events": [
{
"id": "lhnsbzt5yzoevcsbj1ysfquu",
"graphCoordinates": { "x": 0, "y": 0 },
"type": "start",
"outgoingEdgeId": "s4r3grxnxmvczspz49uxqc7q"
}
],
"groups": [
{
"id": "aa1fpxpe8eeov325fm07q9yq",
"graphCoordinates": { "x": 250, "y": 75 },
"title": "Group #1",
"blocks": [
{
"id": "argl00xpck0rrluny8jnwbw3",
"type": "Set variable",
"options": {
"isExecutedOnClient": true,
"isCode": true,
"expressionToEvaluate": "document.location.port",
"variableId": "vggtwtqnbcynlw0b0f52dc6kw"
}
},
{
"id": "kouofwhknpq3knimbhuk91r0",
"type": "text",
"content": {
"richText": [
{ "type": "p", "children": [{ "text": "{{Location}}" }] }
]
}
}
]
}
],
"edges": [
{
"from": { "eventId": "lhnsbzt5yzoevcsbj1ysfquu" },
"to": { "groupId": "aa1fpxpe8eeov325fm07q9yq" },
"id": "s4r3grxnxmvczspz49uxqc7q"
}
],
"variables": [
{
"id": "vggtwtqnbcynlw0b0f52dc6kw",
"name": "Location",
"isSessionVariable": true
}
],
"theme": {},
"selectedThemeTemplateId": null,
"settings": {},
"createdAt": "2025-05-07T06:18:32.890Z",
"updatedAt": "2025-05-07T06:19:09.980Z",
"icon": null,
"folderId": null,
"publicId": null,
"customDomain": null,
"workspaceId": "proWorkspace",
"resultsTablePreferences": null,
"isArchived": false,
"isClosed": false,
"whatsAppCredentialsId": null,
"riskLevel": null
}

View File

@ -0,0 +1,15 @@
import test, { expect } from "@playwright/test";
import { createId } from "@typebot.io/lib/createId";
import { importTypebotInDatabase } from "@typebot.io/playwright/databaseActions";
import { getTestAsset } from "./utils/playwright";
test("client side exec should work", async ({ page }) => {
const typebotId = createId();
await importTypebotInDatabase(getTestAsset("typebots/setVariable.json"), {
id: typebotId,
publicId: `${typebotId}-public`,
});
await page.goto(`/${typebotId}-public`);
await expect(page.getByText("3001")).toBeVisible();
});