mirror of
https://github.com/n8n-io/n8n.git
synced 2026-10-17 05:29:44 +02:00
test: Remove flaky Chat Hub conversation flow e2e test (no-changelog) (#40728)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
3ba522910b
commit
c4f84e2f78
|
|
@ -57,64 +57,5 @@ test.describe(
|
|||
// generated title text, which drifts as fixtures are re-recorded.
|
||||
await expect(n8n.chatHubChat.sidebar.getConversations().first()).toBeVisible();
|
||||
});
|
||||
|
||||
test('conversation flow', async ({ n8n, anthropicCredential: _ }) => {
|
||||
await n8n.navigate.toChatHub();
|
||||
await n8n.chatHubChat.dismissWelcomeScreen();
|
||||
await expect(n8n.chatHubChat.getModelSelectorButton()).toContainText(/claude/i); // auto-select a model
|
||||
|
||||
// STEP: send first prompt
|
||||
await n8n.chatHubChat.getChatInput().fill('Hi');
|
||||
await n8n.chatHubChat.getSendButton().click();
|
||||
await expect(n8n.chatHubChat.getChatMessages().nth(0)).toHaveText('Hi'); // user-typed, assert exact
|
||||
await n8n.chatHubChat.expectReplyAt(1); // assistant reply streamed in (content is non-deterministic)
|
||||
// Message counts are structural (not model content), so they stay exact.
|
||||
await expect(n8n.chatHubChat.getChatMessages()).toHaveCount(2);
|
||||
|
||||
// Capture the first assistant reply so alternatives can be compared
|
||||
// structurally without hardcoding drift-prone model text.
|
||||
const firstReply = await n8n.chatHubChat.getMessageContentAt(1).innerText();
|
||||
|
||||
// STEP: send 2nd prompt
|
||||
await n8n.chatHubChat.getChatInput().fill('How are you?');
|
||||
await n8n.chatHubChat.getSendButton().click();
|
||||
await expect(n8n.chatHubChat.getChatMessages().nth(0)).toContainText('Hi'); // user-typed, assert exact
|
||||
await n8n.chatHubChat.expectReplyAt(1);
|
||||
await expect(n8n.chatHubChat.getChatMessages().nth(2)).toContainText('How are you?'); // user-typed, assert exact
|
||||
await n8n.chatHubChat.expectReplyAt(3);
|
||||
await expect(n8n.chatHubChat.getChatMessages()).toHaveCount(4);
|
||||
|
||||
// STEP: regenerate response to first prompt - the alternative must differ
|
||||
await n8n.chatHubChat.clickRegenerateButtonAt(1);
|
||||
await expect(n8n.chatHubChat.getChatMessages()).toHaveCount(2);
|
||||
await expect
|
||||
.poll(async () => await n8n.chatHubChat.getMessageContentAt(1).innerText())
|
||||
.not.toBe(firstReply);
|
||||
|
||||
// STEP: switch to previous alternative - restores the original reply
|
||||
await n8n.chatHubChat.clickPrevAlternativeButtonAt(1);
|
||||
await expect(n8n.chatHubChat.getChatMessages()).toHaveCount(4);
|
||||
await expect
|
||||
.poll(async () => await n8n.chatHubChat.getMessageContentAt(1).innerText())
|
||||
.toBe(firstReply);
|
||||
|
||||
// STEP: edit 2nd prompt
|
||||
await n8n.chatHubChat.clickEditButtonAt(2);
|
||||
await n8n.chatHubChat.getEditorAt(2).fill('Hola');
|
||||
await n8n.chatHubChat.getSendButtonAt(2).click();
|
||||
await expect(n8n.chatHubChat.getChatMessages().nth(2)).toContainText('Hola'); // user-typed, assert exact
|
||||
await n8n.chatHubChat.expectReplyAt(3); // assistant reply streamed in (content is non-deterministic)
|
||||
await expect(n8n.chatHubChat.getChatMessages()).toHaveCount(4);
|
||||
|
||||
// STEP: reload page and verify persistence
|
||||
await n8n.page.reload();
|
||||
await expect(n8n.chatHubChat.getChatMessages()).toHaveCount(4);
|
||||
await expect(n8n.chatHubChat.getChatMessages().nth(0)).toContainText('Hi'); // user-typed, assert exact
|
||||
await expect
|
||||
.poll(async () => await n8n.chatHubChat.getMessageContentAt(1).innerText())
|
||||
.toBe(firstReply); // restored alternative persisted across reload
|
||||
await expect(n8n.chatHubChat.getChatMessages().nth(2)).toContainText('Hola'); // user-typed, assert exact
|
||||
await n8n.chatHubChat.expectReplyAt(3);
|
||||
});
|
||||
},
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user