Fix Keys Spec

This commit is contained in:
Dan Orlando 2024-02-26 13:14:37 -07:00
parent d1eb7fcfc7
commit 6f250e0d6b
2 changed files with 10 additions and 10 deletions

View file

@ -10,7 +10,7 @@ async function register(page: Page, user: User) {
await page.getByRole('link', { name: 'Sign up' }).click(); await page.getByRole('link', { name: 'Sign up' }).click();
await page.getByLabel('Full name').click(); await page.getByLabel('Full name').click();
await page.getByLabel('Full name').fill('test'); await page.getByLabel('Full name').fill('test');
await page.getByText('Username (optional)').click(); await page.getByLabel('Username (optional)').click();
await page.getByLabel('Username (optional)').fill('test'); await page.getByLabel('Username (optional)').fill('test');
await page.getByLabel('Email').click(); await page.getByLabel('Email').click();
await page.getByLabel('Email').fill(user.email); await page.getByLabel('Email').fill(user.email);
@ -57,7 +57,7 @@ async function authenticate(config: FullConfig, user: User) {
await page.goto(baseURL, { timeout }); await page.goto(baseURL, { timeout });
await register(page, user); await register(page, user);
try { try {
await page.waitForURL(`${baseURL}/chat/new`, { timeout }); await page.waitForURL(`${baseURL}/c/new`, { timeout });
} catch (error) { } catch (error) {
console.error('Error:', error); console.error('Error:', error);
const userExists = page.getByTestId('registration-error'); const userExists = page.getByTestId('registration-error');
@ -78,7 +78,7 @@ async function authenticate(config: FullConfig, user: User) {
console.log('🤖: ✔️ user successfully logged out'); console.log('🤖: ✔️ user successfully logged out');
await login(page, user); await login(page, user);
await page.waitForURL(`${baseURL}/chat/new`, { timeout }); await page.waitForURL(`${baseURL}/c/new`, { timeout });
console.log('🤖: ✔️ user successfully authenticated'); console.log('🤖: ✔️ user successfully authenticated');
await page.context().storageState({ path: storageState as string }); await page.context().storageState({ path: storageState as string });

View file

@ -2,7 +2,7 @@ import { expect, test } from '@playwright/test';
import type { Page } from '@playwright/test'; import type { Page } from '@playwright/test';
const enterTestKey = async (page: Page, endpoint: string) => { const enterTestKey = async (page: Page, endpoint: string) => {
await page.getByTestId('new-conversation-menu').click(); await page.locator('.hide-scrollbar > .group').click();
await page.getByTestId(`endpoint-item-${endpoint}`).hover({ force: true }); await page.getByTestId(`endpoint-item-${endpoint}`).hover({ force: true });
await page.getByRole('button', { name: 'Set API Key' }).click(); await page.getByRole('button', { name: 'Set API Key' }).click();
await page.getByTestId(`input-${endpoint}`).fill('test'); await page.getByTestId(`input-${endpoint}`).fill('test');
@ -16,13 +16,13 @@ test.describe('Key suite', () => {
await page.goto('http://localhost:3080/', { timeout: 5000 }); await page.goto('http://localhost:3080/', { timeout: 5000 });
const endpoint = 'chatGPTBrowser'; const endpoint = 'chatGPTBrowser';
const newTopicButton = page.getByTestId('new-conversation-menu'); const newTopicButton = page.locator('.hide-scrollbar > .group');
await newTopicButton.click(); await newTopicButton.click();
const endpointItem = page.getByTestId(`endpoint-item-${endpoint}`); const endpointItem = page.getByTestId(`endpoint-item-${endpoint}`);
await endpointItem.click(); await endpointItem.click();
let setKeyButton = page.getByRole('button', { name: 'Set API key first' }); let setKeyButton = page.getByRole('button', { name: 'Set API Key' });
expect(setKeyButton.count()).toBeTruthy(); expect(setKeyButton.count()).toBeTruthy();
@ -51,15 +51,15 @@ test.describe('Key suite', () => {
test('Test Setting and Revoking Keys from Settings', async ({ page }) => { test('Test Setting and Revoking Keys from Settings', async ({ page }) => {
await page.goto('http://localhost:3080/', { timeout: 5000 }); await page.goto('http://localhost:3080/', { timeout: 5000 });
const endpoint = 'bingAI'; const endpoint = 'chatGPTBrowser';
const newTopicButton = page.getByTestId('new-conversation-menu'); const newTopicButton = page.locator('.hide-scrollbar > .group');
await newTopicButton.click(); await newTopicButton.click();
const endpointItem = page.getByTestId(`endpoint-item-${endpoint}`); const endpointItem = page.getByTestId(`endpoint-item-${endpoint}`);
await endpointItem.click(); await endpointItem.click();
let setKeyButton = page.getByRole('button', { name: 'Set API key first' }); let setKeyButton = page.getByRole('button', { name: 'Set API Key' });
expect(setKeyButton.count()).toBeTruthy(); expect(setKeyButton.count()).toBeTruthy();
@ -80,7 +80,7 @@ test.describe('Key suite', () => {
await page.getByRole('button', { name: 'Close' }).click(); await page.getByRole('button', { name: 'Close' }).click();
setKeyButton = page.getByRole('button', { name: 'Set API key first' }); setKeyButton = page.getByRole('button', { name: 'Set API Key' });
expect(setKeyButton.count()).toBeTruthy(); expect(setKeyButton.count()).toBeTruthy();
}); });
}); });