mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-19 01:40:15 +01:00
* feat(api): refresh token logic * feat(client): refresh token logic * feat(data-provider): refresh token logic * fix: SSE uses esm * chore: add default refresh token expiry to AuthService, add message about env var not set when generating a token * chore: update scripts to more compatible bun methods, ran bun install again * chore: update env.example and playwright workflow with JWT_REFRESH_SECRET * chore: update breaking changes docs * chore: add timeout to url visit * chore: add default SESSION_EXPIRY in generateToken logic, add act script for testing github actions * fix(e2e): refresh automatically in development environment to pass e2e tests
53 lines
2 KiB
TypeScript
53 lines
2 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.locator('[id="headlessui-menu-button-\\:r0\\:"]').click();
|
|
const navBar = await page.locator('[id="headlessui-menu-button-\\:r0\\:"]').isVisible();
|
|
expect(navBar).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.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');
|
|
});
|
|
});
|