LibreChat/e2e/specs/nav.spec.ts
Marco Beretta 9ad47b6660
style: update graphics (#1138)
* style: update new icon and NavLinks scale

* style: new username update

* refactor(Dropdown); style: general settings

* style(Dropdown); adjust theme

* style: dropdown and settings text

* fix(Dropdown) system theme not working

* style: topbar sticky; fix: general's menu settings transparent with light theme

* fix(SubmitButton) stop generate button

* fix: user_provided dialog for new dropdown

* fix: TS error 'display'

* fix(EditPresetDialog): for new dropdown

* style: added green send button

* converted textchat in tsx

* style(SubmitButton): tooltip

* test: fixed ThemeSelector and LangSelector

* removed transition-opacity

* fix all tests

* removed empty cn call

* chore: Update General.tsx to add Arabic option

---------

Co-authored-by: Danny Avila <110412045+danny-avila@users.noreply.github.com>
2023-11-16 08:42:03 -05:00

58 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.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.getByTestId('theme-selector');
expect(modalTheme).toBeTruthy();
async function changeMode(theme: string) {
// Ensure Element Visibility:
await page.waitForSelector('[data-testid="theme-selector"]');
await modalTheme.click();
await page.click(`[data-theme="${theme}"]`);
// Wait for the theme change
await page.waitForTimeout(1000);
// Check if the HTML element has the theme class
const html = await page.$eval(
'html',
(element, selectedTheme) => element.classList.contains(selectedTheme.toLowerCase()),
theme,
);
expect(html).toBeTruthy();
}
await changeMode('dark');
await changeMode('light');
});
});