💚 Fix e2e tests

This commit is contained in:
Baptiste Arnaud 2026-03-17 14:49:59 +01:00
parent d1e2781caf
commit 2f674b96d2
No known key found for this signature in database
3 changed files with 29 additions and 41 deletions

View File

@ -17,7 +17,7 @@ test("should work as expected", async ({ page }) => {
await page.getByRole("button", { name: "Previous slide" }).click();
await expect(page.getByRole("heading", { name: "Paris" })).toBeVisible();
await page.getByRole("button", { name: "More info" }).nth(0).click();
await expect(page.getByRole("img", { name: "Attached image" })).toBeVisible();
await expect(page.getByRole("img", { name: "Title 1" })).toBeVisible();
await expect(page.getByRole("heading", { name: "Title 1" })).toBeVisible();
await expect(page.getByText("Desc 1")).toBeVisible();
await expect(page.getByRole("heading", { name: "Title 2" })).toBeVisible();

View File

@ -24,38 +24,12 @@ test("Transcript set variable should be correctly computed", async ({
await page.getByPlaceholder("Type your answer...").fill("hey 3");
await page.getByLabel("Send").click();
await expect(
page.getByTestId("guest-bubble").getByText("hey 3"),
).toBeVisible();
await expect(
page.getByText('Assistant: "How are you? You said "'),
).toBeVisible();
await expect(
page.getByText('Assistant: "How are you? You said hey"'),
).toBeVisible();
await expect(
page.getByText('Assistant: "How are you? You said hey 2"'),
).toBeVisible();
await expect(
page.getByText('Assistant: "Let me think..."', { exact: true }).nth(0),
).toBeVisible();
await expect(
page.getByText('Assistant: "Let me think..."', { exact: true }).nth(1),
).toBeVisible();
await expect(
page.getByText('Assistant: "Let me think..."', { exact: true }).nth(2),
).toBeVisible();
await expect(
page.getByText('Assistant: "How are you? You said "', { exact: true }),
).toBeVisible();
await expect(
page.getByText('Assistant: "How are you? You said hey"', { exact: true }),
).toBeVisible();
await expect(
page.getByText('Assistant: "How are you? You said hey 2"', { exact: true }),
).toBeVisible();
await expect(page.getByText('User: "hey"', { exact: true })).toBeVisible();
await expect(page.getByText('User: "hey 2"', { exact: true })).toBeVisible();
await expect(page.getByText('User: "hey 3"', { exact: true })).toBeVisible();
page.getByText(
'Assistant: "Let me think..."Assistant: "How are you? You said "User: "hey"',
),
).toHaveText(
'Assistant: "Let me think..."Assistant: "How are you? You said "User: "hey"Assistant: "Let me think..."Assistant: "How are you? You said hey"User: "hey 2"Assistant: "Let me think..."Assistant: "How are you? You said hey 2"User: "hey 3"',
);
});
test("Transcript set variable should work in loop example", async ({

View File

@ -197,13 +197,7 @@ const executeGroup = ({
const { answers, setVariableHistory, visitedEdges } = queues;
for (const block of nextGroup.group.blocks.slice(nextGroup.blockIndex ?? 0)) {
if (
currentBlockId &&
block.id === currentBlockId &&
!answers.peek() &&
!setVariableHistory.peek() &&
!visitedEdges.peek()
)
if (currentBlockId && block.id === currentBlockId && !answers.peek())
return currentTranscript;
const typebot = typebotsQueue[0]?.typebot;
@ -218,6 +212,7 @@ const executeGroup = ({
}
let nextEdgeId = block.outgoingEdgeId;
let nextReturnEdgeId = returnEdgeId;
// ──────────────────────────────────────────────────────────── Bubble blocks
if (isBubbleBlock(block)) {
@ -406,6 +401,25 @@ const executeGroup = ({
blockId: block.options.blockId,
},
});
const currentBlockIndex = nextGroup.group.blocks.findIndex(
(b) => b.id === block.id,
);
const nextBlockInGroup = nextGroup.group.blocks.at(currentBlockIndex + 1);
if (nextBlockInGroup) {
const returnVirtualEdgeId = createVirtualEdgeId({
groupId: nextGroup.group.id,
blockId: nextBlockInGroup.id,
});
typebotsQueue[0].typebot.edges.push({
id: returnVirtualEdgeId,
from: { blockId: block.id },
to: {
groupId: nextGroup.group.id,
blockId: nextBlockInGroup.id,
},
});
nextReturnEdgeId = returnVirtualEdgeId;
}
nextEdgeId = virtualId;
} else if (block.type === LogicBlockType.RETURN && returnEdgeId) {
nextEdgeId = returnEdgeId;
@ -473,7 +487,7 @@ const executeGroup = ({
currentBlockId,
sessionStore,
userMessageIndex,
returnEdgeId,
returnEdgeId: nextReturnEdgeId,
debug,
});
}