mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-09-22 06:00:56 +02:00

* chore: remove all bing code * chore: remove bing code and auto-focus effects * chore: add back escapeRegExp helper function for regex special character handling * chore: remove deprecated fields from settings and conversation schema * fix: ensure default endpoint is set correctly in conversation setup * feat: add disableFocus option to newConversation for improved search behavior
63 lines
2.1 KiB
TypeScript
63 lines
2.1 KiB
TypeScript
import { expect, test } from '@playwright/test';
|
|
|
|
test.describe('Settings suite', () => {
|
|
test('Last OpenAI settings', async ({ page }) => {
|
|
await page.goto('http://localhost:3080/', { timeout: 5000 });
|
|
await page.evaluate(() =>
|
|
window.localStorage.setItem(
|
|
'lastConversationSetup',
|
|
JSON.stringify({
|
|
conversationId: 'new',
|
|
title: 'New Chat',
|
|
endpoint: 'openAI',
|
|
createdAt: '',
|
|
updatedAt: '',
|
|
}),
|
|
),
|
|
);
|
|
await page.goto('http://localhost:3080/', { timeout: 5000 });
|
|
|
|
const initialLocalStorage = await page.evaluate(() => window.localStorage);
|
|
const lastConvoSetup = JSON.parse(initialLocalStorage.lastConversationSetup);
|
|
expect(lastConvoSetup.endpoint).toEqual('openAI');
|
|
|
|
const newTopicButton = page.getByTestId('new-conversation-menu');
|
|
await newTopicButton.click();
|
|
|
|
// includes the icon + endpoint names in obj property
|
|
const endpointItem = page.getByTestId('endpoint-item-openAI');
|
|
await endpointItem.click();
|
|
|
|
await page.getByTestId('text-input').click();
|
|
const button1 = page.getByRole('button', { name: 'Mode: BingAI' });
|
|
const button2 = page.getByRole('button', { name: 'Mode: Sydney' });
|
|
|
|
try {
|
|
await button1.click({ timeout: 100 });
|
|
} catch (e) {
|
|
// console.log('Bing button', e);
|
|
}
|
|
|
|
try {
|
|
await button2.click({ timeout: 100 });
|
|
} catch (e) {
|
|
// console.log('Sydney button', e);
|
|
}
|
|
await page.getByRole('option', { name: 'Sydney' }).click();
|
|
await page.getByRole('tab', { name: 'Balanced' }).click();
|
|
|
|
// Change Endpoint to see if settings will persist
|
|
await newTopicButton.click();
|
|
await page.getByRole('menuitemradio', { name: 'ChatGPT OpenAI' }).click();
|
|
|
|
// Close endpoint menu & re-select BingAI
|
|
await page.getByTestId('text-input').click();
|
|
await newTopicButton.click();
|
|
await endpointItem.click();
|
|
|
|
// Check if the settings persisted
|
|
const localStorage = await page.evaluate(() => window.localStorage);
|
|
const button = page.getByRole('button', { name: 'Mode: Sydney' });
|
|
expect(button.count()).toBeTruthy();
|
|
});
|
|
});
|