LibreChat/e2e/specs/mock/scenarios/composer-frame.spec.ts
Marco Beretta 6cacfb0007
Some checks failed
Backend Unit Tests / Build packages (push) Waiting to run
Backend Unit Tests / Codegraph select (push) Waiting to run
Backend Unit Tests / TypeScript type checks (push) Blocked by required conditions
Backend Unit Tests / Circular dependency checks (push) Waiting to run
Backend Unit Tests / Tests: api (shard 1/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 2/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 3/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: data-provider (push) Blocked by required conditions
Backend Unit Tests / Tests: data-schemas (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 1/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 2/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 3/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 4/4) (push) Blocked by required conditions
Backend Unit Tests / backend (push) Blocked by required conditions
Channel Gateway / gateway (push) Waiting to run
Codegraph E2E Vote Gate / Gate (push) Waiting to run
Codegraph E2E Votes / vote (shard 1/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 10/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 2/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 3/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 4/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 5/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 6/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 7/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 8/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 9/10) (push) Waiting to run
Docker Dev Branch Images Build / publish (push) Waiting to run
Frontend Unit Tests / Client build recovery regression (push) Waiting to run
Frontend Unit Tests / Codegraph select (push) Waiting to run
Frontend Unit Tests / Build packages (push) Waiting to run
Frontend Unit Tests / TypeScript type checks (client) (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/chat (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/client (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 1/2) (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 2/2) (push) Blocked by required conditions
Frontend Unit Tests / Vite build verification (push) Blocked by required conditions
Frontend Unit Tests / frontend (push) Blocked by required conditions
Sync Locize Translations & Create Translation PR / Sync Translation Keys with Locize (push) Waiting to run
Sync Locize Translations & Create Translation PR / Create Translation PR on Version Published (push) Blocked by required conditions
Playwright E2E Tests / Codegraph select (push) Waiting to run
Playwright E2E Tests / Shard timings (push) Waiting to run
Playwright E2E Tests / e2e () (push) Blocked by required conditions
Playwright E2E Tests / MCP list_changed (replica count 1) (push) Blocked by required conditions
Playwright E2E Tests / MCP list_changed (replica count 2) (push) Blocked by required conditions
Playwright E2E Tests / MCP Apps (browser and server) (push) Waiting to run
Playwright E2E Tests / e2e (push) Blocked by required conditions
Playwright Shard Timings / Record shard timings (push) Waiting to run
Sync README Translations / Test Translation Helpers (push) Has been cancelled
Sync README Translations / Translate README (push) Has been cancelled
🖼️ feat: Let a Theme Ask for a Welcome Backdrop (#18125)
Add theme-selected welcome backdrops and focus the composer when the welcome greeting settles. Preserve popup and touch-device focus behavior, with acceptance coverage for themes, focus, and composer layout.
2026-11-14 22:59:26 +01:00

48 lines
2.1 KiB
TypeScript

import { expect, test } from '@playwright/test';
import { MOCK_ENDPOINTS, NEW_CHAT_PATH, selectMockEndpoint } from '../helpers';
/**
* The composer layout, drawn by the chat package's frame: a click on the surface's empty area
* returns focus to the draft, while a popup trigger inside it keeps focus so its menu can open
* and close normally (#15624). On a touch screen the draft is left alone instead.
*/
test.describe.configure({ timeout: 120_000 });
test.describe('composer frame', () => {
test('a click on the surface focuses the draft, a popup trigger keeps it @scenario:composer-surface-click-focuses-draft', async ({
page,
}) => {
await page.addInitScript(() => {
window.addEventListener('librechat:welcome-greeting-settled', () => {
document.documentElement.dataset.greetingSettled = 'true';
});
});
await page.goto(NEW_CHAT_PATH, { timeout: 10000 });
await selectMockEndpoint(page, MOCK_ENDPOINTS[0]);
const input = page.getByRole('textbox', { name: 'Message input' });
const surface = page.getByTestId('composer-surface');
/* Let the welcome autofocus finish before testing the frame's separate click behavior. */
await expect(page.locator('html')).toHaveAttribute('data-greeting-settled', 'true', {
timeout: 20000,
});
await page.locator('body').click({ position: { x: 5, y: 5 } });
await expect(input).not.toBeFocused();
const box = await surface.boundingBox();
expect(box).not.toBeNull();
await surface.click({ position: { x: (box?.width ?? 0) / 2, y: (box?.height ?? 0) - 6 } });
/* A coarse pointer leaves focus alone so the on-screen keyboard does not open on a stray tap. */
const coarse = await page.evaluate(() => window.matchMedia('(pointer: coarse)').matches);
if (coarse) {
await expect(input).not.toBeFocused();
return;
}
await expect(input).toBeFocused();
const trigger = surface.locator('[aria-haspopup]:not([aria-haspopup="false"])').first();
await trigger.click();
await expect(input).not.toBeFocused();
await page.keyboard.press('Escape');
});
});