LibreChat/e2e/specs/mock/compaction.helpers.ts
lia-by-librechat[bot] f4154b649e
Some checks failed
Publish `@librechat/client` to NPM / pack (push) Has been cancelled
Publish `librechat-data-provider` to NPM / pack (push) Has been cancelled
Publish `@librechat/data-schemas` to NPM / pack (push) Has been cancelled
Docker Dev Images Build / publish (push) Has been cancelled
Sync Helm Chart Tags / Ignore non-main push (push) Has been cancelled
Sync Helm Chart Tags / Sync chart tags (push) Has been cancelled
Publish `@librechat/client` to NPM / publish-npm (push) Has been cancelled
Publish `librechat-data-provider` to NPM / publish-npm (push) Has been cancelled
Publish `@librechat/data-schemas` to NPM / publish-npm (push) Has been cancelled
🦿 chore: Bump Agents SDK to 4.2.1 (#17664)
* 🦿 chore: Bump Agents SDK to 4.2.0

* test: Adapt Compaction Fixtures to Retained Recent Turns

* test: Preserve the Azure Reasoning Token Contract

* chore: Bump Agents SDK to 4.2.1

---------

Co-authored-by: Lia <lia@librechat.ai>
2026-10-31 15:17:05 -04:00

22 lines
896 B
TypeScript

import { expect } from '@playwright/test';
import type { Page } from '@playwright/test';
import { messagesView, replyPrompt, replyText, sendMessageAndWaitForCompletion } from './helpers';
/** Prepend older exchanges: compaction preserves the last two user-led turns. */
export async function sendCompactionHistory(
page: Page,
label: string,
turns = 2,
): Promise<string[]> {
const transcript: string[] = [];
for (let index = 0; index < turns; index++) {
const turnLabel = `history-${index + 1}-${label}`;
const prompt = replyPrompt(turnLabel);
const reply = replyText(turnLabel);
await sendMessageAndWaitForCompletion(page, prompt);
await expect(messagesView(page).getByText(reply, { exact: true })).toBeVisible();
await expect(page.getByRole('button', { name: 'Stop generating' })).toBeHidden();
transcript.push(prompt, reply);
}
return transcript;
}