mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-19 18:00:15 +01:00
61 lines
No EOL
3.2 KiB
TypeScript
61 lines
No EOL
3.2 KiB
TypeScript
// import { expect, test } from '@playwright/test';
|
|
// import type { Page } from '@playwright/test';
|
|
//
|
|
// const initialNewChatSelector = '[data-testid="nav-new-chat-button"]';
|
|
//
|
|
//
|
|
// const enterTestKey = async (page: Page, expectedEndpointText: string) => {
|
|
// // Open a new conversation
|
|
// await page.locator(initialNewChatSelector).click();
|
|
// // Open the LLM Endpoint Menu
|
|
// const llmButton = page.getByRole('button', { name: /LLM Endpoint Menu/i });
|
|
// await llmButton.waitFor({ state: 'visible', timeout: 5000 });
|
|
// await llmButton.click();
|
|
// // In a real app you might choose an endpoint from a list.
|
|
// // Here we simply assert that the button text contains the expected endpoint.
|
|
// const buttonText = await llmButton.textContent();
|
|
// expect(buttonText?.trim()).toContain(expectedEndpointText);
|
|
// // (You would fill in the API key modal here if it existed.)
|
|
// };
|
|
//
|
|
// test.describe('Key suite', () => {
|
|
// test('Test Setting and Revoking Keys', async ({ page }) => {
|
|
// await page.goto('http://localhost:3080/', { timeout: 5000 });
|
|
// // Accept terms if the modal is shown.
|
|
// await acceptTermsIfPresent(page);
|
|
// // For this test we use "Azure OpenAI" (from the provided HTML) as the endpoint.
|
|
// await enterTestKey(page, 'Azure OpenAI');
|
|
// // (If your app shows a “Submit” button for keys, verify its existence.)
|
|
// const submitButton = page.getByTestId('submit-button');
|
|
// expect(await submitButton.count()).toBeGreaterThan(0);
|
|
// // For revoking, simulate clicking the same endpoint button and (if present) clicking “Revoke”
|
|
// await page.locator(initialNewChatSelector).click();
|
|
// // Open endpoint menu again
|
|
// const llmButton = page.getByRole('button', { name: /LLM Endpoint Menu/i });
|
|
// await llmButton.click();
|
|
// // For example, if a "Revoke" button appears, check it (update selector as needed)
|
|
// const revokeButton = page.getByRole('button', { name: 'Revoke' });
|
|
// // We check that the revoke button is visible or count > 0.
|
|
// expect(await revokeButton.count()).toBeGreaterThan(0);
|
|
// // (Click and confirm if that is your workflow.)
|
|
// await revokeButton.click();
|
|
// // Finally, check that the key is no longer set by verifying the original button text.
|
|
// const refreshedText = await llmButton.textContent();
|
|
// expect(refreshedText?.trim()).toContain('Azure OpenAI');
|
|
// });
|
|
//
|
|
// test('Test Setting and Revoking Keys from Settings', async ({ page }) => {
|
|
// await page.goto('http://localhost:3080/', { timeout: 5000 });
|
|
// // Accept terms if the modal is shown.
|
|
// await acceptTermsIfPresent(page);
|
|
// // Open a new chat and choose endpoint
|
|
// await page.locator(initialNewChatSelector).click();
|
|
// await enterTestKey(page, 'Azure OpenAI');
|
|
// // In this test we simulate opening the settings dropdown.
|
|
// await page.getByTestId('nav-user').click();
|
|
// // Instead of expecting a modal dialog, we check that the dropdown includes "Settings"
|
|
// const settingsOption = await page.getByText('Settings');
|
|
// expect(await settingsOption.isVisible()).toBeTruthy();
|
|
// // (If clicking Settings opens a dedicated page or modal, add further assertions here.)
|
|
// });
|
|
// });
|