mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-16 16:30:15 +01:00
feat(api): initial Redis support; fix(SearchBar): proper debounce (#1039)
* 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
This commit is contained in:
parent
4ac0c04e83
commit
5145121eb7
29 changed files with 461 additions and 171 deletions
|
|
@ -1,8 +1,10 @@
|
|||
import { Page, FullConfig, chromium } from '@playwright/test';
|
||||
import cleanupUser from './cleanupUser';
|
||||
import dotenv from 'dotenv';
|
||||
dotenv.config();
|
||||
|
||||
type User = { email: string; name: string; password: string };
|
||||
const timeout = 3500;
|
||||
|
||||
async function register(page: Page, user: User) {
|
||||
await page.getByRole('link', { name: 'Sign up' }).click();
|
||||
|
|
@ -52,18 +54,31 @@ async function authenticate(config: FullConfig, user: User) {
|
|||
});
|
||||
console.log('🤖: ✔️ localStorage: set Nav as Visible', storageState);
|
||||
|
||||
await page.goto(baseURL, { timeout: 5000 });
|
||||
await page.goto(baseURL, { timeout });
|
||||
await register(page, user);
|
||||
await page.waitForURL(`${baseURL}/chat/new`);
|
||||
try {
|
||||
await page.waitForURL(`${baseURL}/chat/new`, { timeout });
|
||||
} catch (error) {
|
||||
console.error('Error:', error);
|
||||
const userExists = page.getByTestId('registration-error');
|
||||
if (userExists) {
|
||||
console.log('🤖: 🚨 user already exists');
|
||||
await cleanupUser(user);
|
||||
await page.goto(baseURL, { timeout });
|
||||
await register(page, user);
|
||||
} else {
|
||||
throw new Error('🤖: 🚨 user failed to register');
|
||||
}
|
||||
}
|
||||
console.log('🤖: ✔️ user successfully registered');
|
||||
|
||||
// Logout
|
||||
await logout(page, user);
|
||||
await page.waitForURL(`${baseURL}/login`);
|
||||
await page.waitForURL(`${baseURL}/login`, { timeout });
|
||||
console.log('🤖: ✔️ user successfully logged out');
|
||||
|
||||
await login(page, user);
|
||||
await page.waitForURL(`${baseURL}/chat/new`);
|
||||
await page.waitForURL(`${baseURL}/chat/new`, { timeout });
|
||||
console.log('🤖: ✔️ user successfully authenticated');
|
||||
|
||||
await page.context().storageState({ path: storageState as string });
|
||||
|
|
|
|||
|
|
@ -38,14 +38,6 @@ test.beforeAll(async ({ browser }) => {
|
|||
await page.close();
|
||||
});
|
||||
|
||||
test.afterAll(async () => {
|
||||
console.log('🤖: clearing conversations after message tests.');
|
||||
const page = await beforeAfterAllContext.newPage();
|
||||
await clearConvos(page);
|
||||
await page.close();
|
||||
await beforeAfterAllContext.close();
|
||||
});
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto(initialUrl, { timeout: 5000 });
|
||||
});
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@ test.describe('Navigation suite', () => {
|
|||
test('Navigation bar', async ({ page }) => {
|
||||
await page.goto('http://localhost:3080/', { timeout: 5000 });
|
||||
|
||||
await page.locator('[id="headlessui-menu-button-\\:r0\\:"]').click();
|
||||
const navBar = await page.locator('[id="headlessui-menu-button-\\:r0\\:"]').isVisible();
|
||||
expect(navBar).toBeTruthy();
|
||||
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.locator('[id="headlessui-menu-button-\\:r0\\:"]').click();
|
||||
await page.getByTestId('nav-user').click();
|
||||
await page.getByText('Settings').click();
|
||||
|
||||
const modal = await page.getByRole('dialog', { name: 'Settings' }).isVisible();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue