mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-08-04 14:57:42 +00:00
test(e2e): align assertions with action groups
This commit is contained in:
parent
ac7d3cf0aa
commit
3ff2780f44
4 changed files with 20 additions and 17 deletions
|
|
@ -82,7 +82,7 @@ test.describe('activity labels', () => {
|
|||
|
||||
/**
|
||||
* The header is the feature: once a label lands it REPLACES the generic
|
||||
* "Used N tools" verb above the same tool cards.
|
||||
* "Ran N actions" verb above the same tool cards.
|
||||
*/
|
||||
test('renders the generated label as the tool-group header', async ({ page, request }) => {
|
||||
test.setTimeout(120000);
|
||||
|
|
@ -94,7 +94,7 @@ test.describe('activity labels', () => {
|
|||
await expect(
|
||||
messagesView(page).getByRole('button', { name: 'Stored two facts in memory' }),
|
||||
).toBeVisible({ timeout: 30000 });
|
||||
await expect(messagesView(page).getByRole('button', { name: 'Used 2 tools' })).toHaveCount(0);
|
||||
await expect(messagesView(page).getByRole('button', { name: /^Ran 2 actions/ })).toHaveCount(0);
|
||||
});
|
||||
|
||||
/**
|
||||
|
|
@ -141,7 +141,7 @@ test.describe('activity labels', () => {
|
|||
|
||||
/**
|
||||
* A whitespace-only label must fill null. There is deliberately no templated
|
||||
* stand-in ("ran 2 tools" only restates the cards), so the block renders
|
||||
* stand-in ("Ran 2 actions" only restates the cards), so the block renders
|
||||
* exactly as it would without the feature.
|
||||
*/
|
||||
test('leaves the generic header when the model returns a blank label', async ({
|
||||
|
|
@ -154,7 +154,7 @@ test.describe('activity labels', () => {
|
|||
|
||||
await runLabeledTurn(page, label);
|
||||
|
||||
await expect(messagesView(page).getByRole('button', { name: 'Used 2 tools' })).toBeVisible({
|
||||
await expect(messagesView(page).getByRole('button', { name: /^Ran 2 actions/ })).toBeVisible({
|
||||
timeout: 30000,
|
||||
});
|
||||
});
|
||||
|
|
@ -169,7 +169,7 @@ test.describe('activity labels', () => {
|
|||
|
||||
/** The turn still finished (asserted in runLabeledTurn) and the block kept
|
||||
* its generic header rather than rendering an empty row. */
|
||||
await expect(messagesView(page).getByRole('button', { name: 'Used 2 tools' })).toBeVisible({
|
||||
await expect(messagesView(page).getByRole('button', { name: /^Ran 2 actions/ })).toBeVisible({
|
||||
timeout: 30000,
|
||||
});
|
||||
/** At least one attempt was made and failed; the client may retry a 5xx,
|
||||
|
|
@ -191,7 +191,7 @@ test.describe('activity labels', () => {
|
|||
timeout: 60000,
|
||||
});
|
||||
|
||||
await expect(messagesView(page).getByRole('button', { name: 'Used 2 tools' })).toBeVisible();
|
||||
await expect(messagesView(page).getByRole('button', { name: /^Ran 2 actions/ })).toBeVisible();
|
||||
expect(await getLabelRequestsFor(request, label)).toHaveLength(0);
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -747,12 +747,11 @@ test.describe('agent handoffs', () => {
|
|||
});
|
||||
await expect(transferCard).toBeEnabled();
|
||||
await transferCard.click();
|
||||
await expect(
|
||||
messagesView(page).getByText('Handoff instructions:', { exact: true }),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
messagesView(page).getByText(JSON.stringify({ brief: payload }), { exact: true }),
|
||||
).toBeVisible();
|
||||
const handoffDetails = messagesView(page).getByRole('region', {
|
||||
name: 'Handoff instructions',
|
||||
});
|
||||
await expect(handoffDetails).toBeVisible();
|
||||
await expect(handoffDetails.getByText(payload, { exact: true })).toBeVisible();
|
||||
|
||||
await expect(page).toHaveURL(/\/c\/(?!new)/, { timeout: 15000 });
|
||||
const conversationUrl = page.url();
|
||||
|
|
|
|||
|
|
@ -127,7 +127,12 @@ test.describe('deferred tools across HITL resume', () => {
|
|||
const response = await sendMessage(page, `${PROMPT_MARKER}${label}`);
|
||||
expect(response.ok()).toBeTruthy();
|
||||
await expect(page).toHaveURL(/\/c\/(?!new)/, { timeout: 15000 });
|
||||
await expect(page.getByText(question, { exact: true })).toBeVisible({ timeout: 30000 });
|
||||
const liveQuestion = () =>
|
||||
page
|
||||
.getByRole('button', { name: 'Answer later in the chat' })
|
||||
.locator('..')
|
||||
.getByText(question, { exact: true });
|
||||
await expect(liveQuestion()).toBeVisible({ timeout: 30000 });
|
||||
|
||||
/** Reload the public conversation route while the graph is paused. This
|
||||
* proves the browser reconstructs the real persisted pending action,
|
||||
|
|
@ -135,7 +140,7 @@ test.describe('deferred tools across HITL resume', () => {
|
|||
const conversationPath = new URL(page.url()).pathname;
|
||||
await page.reload({ waitUntil: 'domcontentloaded' });
|
||||
await expect(page).toHaveURL(conversationPath);
|
||||
await expect(page.getByText(question, { exact: true })).toBeVisible({ timeout: 30000 });
|
||||
await expect(liveQuestion()).toBeVisible({ timeout: 30000 });
|
||||
|
||||
const option = page.getByRole('button', {
|
||||
name: new RegExp(`${escapeRegExp(optionLabel)}$`),
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ async function submitAndCapture(page: Page, submit: Locator) {
|
|||
|
||||
async function expectCompletedApprovalToolOutput(page: Page, toolCallId: string, output: string) {
|
||||
const view = messagesView(page);
|
||||
const groupToggle = view.getByRole('button', { name: /^Used \d+ tools$/ }).last();
|
||||
const groupToggle = view.getByRole('button', { name: /^Ran \d+ actions/ }).last();
|
||||
const toolCall = view.locator(`[data-testid="tool-call"][data-tool-call-id="${toolCallId}"]`);
|
||||
|
||||
// On reload, the conversation arrives asynchronously and multi-tool groups
|
||||
|
|
@ -502,8 +502,7 @@ test.describe('tool approvals', () => {
|
|||
await expect(submit).toBeEnabled();
|
||||
|
||||
const groupToggle = messagesView(page).getByRole('button', {
|
||||
name: 'Used 2 tools',
|
||||
exact: true,
|
||||
name: /^Running 2 actions/,
|
||||
});
|
||||
const groupPanel = messagesView(page).getByTestId('tool-call-group-panel').last();
|
||||
await Promise.all([
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue