mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-23 03:40:14 +01:00
* refactor: use keyv for search caching with 1 min expirations * feat: keyvRedis; chore: bump keyv, bun.lockb, add jsconfig for vscode file resolution * feat: api/search redis support * refactor(redis) use ioredis cluster for keyv fix(OpenID): when redis is configured, use redis memory store for express-session * fix: revert using uri for keyvredis * fix(SearchBar): properly debounce search queries, fix weird render behaviors * refactor: add authentication to search endpoint and show error messages in results * feat: redis support for violation logs * fix(logViolation): ensure a number is always being stored in cache * feat(concurrentLimiter): uses clearPendingReq, clears pendingReq on abort, redis support * fix(api/search/enable): query only when authenticated * feat(ModelService): redis support * feat(checkBan): redis support * refactor(api/search): consolidate keyv logic * fix(ci): add default empty value for REDIS_URI * refactor(keyvRedis): use condition to initialize keyvRedis assignment * refactor(connectDb): handle disconnected state (should create a new conn) * fix(ci/e2e): handle case where cleanUp did not successfully run * fix(getDefaultEndpoint): return endpoint from localStorage if defined and endpointsConfig is default * ci(e2e): remove afterAll messages as startup/cleanUp will clear messages * ci(e2e): remove teardown for CI until further notice * chore: bump playwright/test * ci(e2e): reinstate teardown as CI issue is specific to github env * fix(ci): click settings menu trigger by testid
53 lines
1.9 KiB
TypeScript
53 lines
1.9 KiB
TypeScript
import { expect, test } from '@playwright/test';
|
|
|
|
test.describe('Navigation suite', () => {
|
|
test('Navigation bar', async ({ page }) => {
|
|
await page.goto('http://localhost:3080/', { timeout: 5000 });
|
|
|
|
await page.getByTestId('nav-user').click();
|
|
const navSettings = await page.getByTestId('nav-user').isVisible();
|
|
expect(navSettings).toBeTruthy();
|
|
});
|
|
|
|
test('Settings modal', async ({ page }) => {
|
|
await page.goto('http://localhost:3080/', { timeout: 5000 });
|
|
await page.getByTestId('nav-user').click();
|
|
await page.getByText('Settings').click();
|
|
|
|
const modal = await page.getByRole('dialog', { name: 'Settings' }).isVisible();
|
|
expect(modal).toBeTruthy();
|
|
|
|
const modalTitle = await page.getByRole('heading', { name: 'Settings' }).textContent();
|
|
expect(modalTitle?.length).toBeGreaterThan(0);
|
|
expect(modalTitle).toEqual('Settings');
|
|
|
|
const modalTabList = await page.getByRole('tablist', { name: 'Settings' }).isVisible();
|
|
expect(modalTabList).toBeTruthy();
|
|
|
|
const generalTabPanel = await page.getByRole('tabpanel', { name: 'General' }).isVisible();
|
|
expect(generalTabPanel).toBeTruthy();
|
|
|
|
const modalClearConvos = await page.getByRole('button', { name: 'Clear' }).isVisible();
|
|
expect(modalClearConvos).toBeTruthy();
|
|
|
|
const modalTheme = page.getByRole('combobox').first();
|
|
expect(modalTheme.isVisible()).toBeTruthy();
|
|
|
|
async function changeMode(theme: string) {
|
|
// change the value to 'dark' and 'light' and see if the theme changes
|
|
await modalTheme.selectOption({ label: theme });
|
|
await page.waitForTimeout(1000);
|
|
|
|
// Check if the HTML element has the theme class
|
|
const html = await page.$eval(
|
|
'html',
|
|
(element, theme) => element.classList.contains(theme.toLowerCase()),
|
|
theme,
|
|
);
|
|
expect(html).toBeTruthy();
|
|
}
|
|
|
|
await changeMode('Dark');
|
|
await changeMode('Light');
|
|
});
|
|
});
|