mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-09-11 00:49:59 +00:00
🧪 test: Fix file-provisioning e2e composer selectors
- Add data-testid to the Run Code / File Search items in ToolsDropdown so the ephemeral toggle helpers can target them like Skills/Memory. - enableCodeInterpreter/enableFileSearch click by testid and assert the badge as a checkbox (CheckboxButton renders an Ariakit Checkbox, not a button). - The legacy Upload to Code Environment / Upload for File Search options only render once the ephemeral capability is enabled, so the immediate tests enable it first; the legacy-dropdown assertion checks the always-present provider option.
This commit is contained in:
parent
68b9c4cc5f
commit
e001e56481
4 changed files with 16 additions and 9 deletions
|
|
@ -167,7 +167,7 @@ const ToolsDropdown = ({ disabled }: ToolsDropdownProps) => {
|
|||
onClick: handleFileSearchToggle,
|
||||
hideOnClick: false,
|
||||
render: (props) => (
|
||||
<div {...props}>
|
||||
<div {...props} data-testid="tools-menu-file-search">
|
||||
<div className="flex items-center gap-2">
|
||||
<VectorIcon className="icon-md" />
|
||||
<span>{localize('com_assistants_file_search')}</span>
|
||||
|
|
@ -317,7 +317,7 @@ const ToolsDropdown = ({ disabled }: ToolsDropdownProps) => {
|
|||
onClick: handleCodeInterpreterToggle,
|
||||
hideOnClick: false,
|
||||
render: (props) => (
|
||||
<div {...props}>
|
||||
<div {...props} data-testid="tools-menu-run-code">
|
||||
<div className="flex items-center gap-2">
|
||||
<TerminalSquareIcon className="icon-md" aria-hidden="true" />
|
||||
<span>{localize('com_ui_run_code')}</span>
|
||||
|
|
|
|||
|
|
@ -38,6 +38,9 @@ test.describe('file provisioning — immediate (legacy dropdown)', () => {
|
|||
await page.goto(NEW_CHAT_PATH, { timeout: 10000 });
|
||||
await selectMockEndpoint(page, MOCK_ENDPOINTS[0]);
|
||||
await resetProvisioning(page);
|
||||
// The legacy "Upload to Code Environment" option only appears once the
|
||||
// ephemeral execute_code capability is enabled.
|
||||
await enableCodeInterpreter(page);
|
||||
|
||||
const fileName = `${uniqueName('code')}.csv`;
|
||||
const response = await uploadViaLegacyOption(page, 'Upload to Code Environment', {
|
||||
|
|
@ -60,6 +63,9 @@ test.describe('file provisioning — immediate (legacy dropdown)', () => {
|
|||
await page.goto(NEW_CHAT_PATH, { timeout: 10000 });
|
||||
await selectMockEndpoint(page, MOCK_ENDPOINTS[0]);
|
||||
await resetProvisioning(page);
|
||||
// The legacy "Upload for File Search" option only appears once the ephemeral
|
||||
// file_search capability is enabled.
|
||||
await enableFileSearch(page);
|
||||
|
||||
const fileName = `${uniqueName('search')}.csv`;
|
||||
const response = await uploadViaLegacyOption(page, 'Upload for File Search', {
|
||||
|
|
|
|||
|
|
@ -93,17 +93,17 @@ export async function enableMemory(page: Page) {
|
|||
/** Enable the ephemeral Code Interpreter (execute_code) capability from the tool menu. */
|
||||
export async function enableCodeInterpreter(page: Page) {
|
||||
await page.getByRole('button', { name: 'Tools Options' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Run Code' }).click();
|
||||
await page.getByTestId('tools-menu-run-code').click();
|
||||
await page.keyboard.press('Escape');
|
||||
await expect(page.getByRole('button', { name: 'Run Code' })).toBeVisible();
|
||||
await expect(page.getByRole('checkbox', { name: 'Run Code' })).toBeVisible();
|
||||
}
|
||||
|
||||
/** Enable the ephemeral File Search capability from the composer tool menu. */
|
||||
export async function enableFileSearch(page: Page) {
|
||||
await page.getByRole('button', { name: 'Tools Options' }).click();
|
||||
await page.getByRole('menuitem', { name: 'File Search' }).click();
|
||||
await page.getByTestId('tools-menu-file-search').click();
|
||||
await page.keyboard.press('Escape');
|
||||
await expect(page.getByRole('button', { name: 'File Search' })).toBeVisible();
|
||||
await expect(page.getByRole('checkbox', { name: 'File Search' })).toBeVisible();
|
||||
}
|
||||
|
||||
/** The conversation messages container. */
|
||||
|
|
|
|||
|
|
@ -153,9 +153,10 @@ test.describe('unified file upload', () => {
|
|||
await expect(page.locator('#attach-file-menu-button')).toBeVisible({ timeout: 15000 });
|
||||
await expect(page.locator('#attach-file-button')).toHaveCount(0);
|
||||
|
||||
// Opening it reveals the classic per-tool-resource options.
|
||||
// Opening it reveals the classic multi-option menu (its always-present entry is
|
||||
// the provider upload; the code/file_search options are gated on those ephemeral
|
||||
// capabilities being enabled first).
|
||||
await page.locator('#attach-file-menu-button').click();
|
||||
await expect(page.getByRole('menuitem', { name: 'Upload to Code Environment' })).toBeVisible();
|
||||
await expect(page.getByRole('menuitem', { name: 'Upload for File Search' })).toBeVisible();
|
||||
await expect(page.getByText('Upload to Provider')).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue