Compare commits

...

3 Commits

Author SHA1 Message Date
Dan Orlando
ab4fc6eeb1 add test id to TitleButton 2024-02-26 14:38:21 -07:00
Dan Orlando
55ce33aa6a Fix landing spec 2024-02-26 13:19:20 -07:00
Dan Orlando
6f250e0d6b Fix Keys Spec 2024-02-26 13:14:37 -07:00
5 changed files with 15 additions and 15 deletions

View File

@@ -5,7 +5,7 @@ export default function TitleButton({ primaryText = '', secondaryText = '' }) {
<Trigger asChild>
<div
className="group flex cursor-pointer items-center gap-1 rounded-xl px-3 py-2 text-lg font-medium hover:bg-gray-50 radix-state-open:bg-gray-50 dark:hover:bg-black/10 dark:radix-state-open:bg-black/20"
// type="button"
data-testid="title-button"
>
<div>
{primaryText}{' '}

View File

@@ -10,7 +10,7 @@ async function register(page: Page, user: User) {
await page.getByRole('link', { name: 'Sign up' }).click();
await page.getByLabel('Full name').click();
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('Email').click();
await page.getByLabel('Email').fill(user.email);
@@ -57,7 +57,7 @@ async function authenticate(config: FullConfig, user: User) {
await page.goto(baseURL, { timeout });
await register(page, user);
try {
await page.waitForURL(`${baseURL}/chat/new`, { timeout });
await page.waitForURL(`${baseURL}/c/new`, { timeout });
} catch (error) {
console.error('Error:', error);
const userExists = page.getByTestId('registration-error');
@@ -78,7 +78,7 @@ async function authenticate(config: FullConfig, user: User) {
console.log('🤖: ✔️ user successfully logged out');
await login(page, user);
await page.waitForURL(`${baseURL}/chat/new`, { timeout });
await page.waitForURL(`${baseURL}/c/new`, { timeout });
console.log('🤖: ✔️ user successfully authenticated');
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';
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.getByRole('button', { name: 'Set API Key' }).click();
await page.getByTestId(`input-${endpoint}`).fill('test');
@@ -16,13 +16,13 @@ test.describe('Key suite', () => {
await page.goto('http://localhost:3080/', { timeout: 5000 });
const endpoint = 'chatGPTBrowser';
const newTopicButton = page.getByTestId('new-conversation-menu');
const newTopicButton = page.getByTestId('title-button');
await newTopicButton.click();
const endpointItem = page.getByTestId(`endpoint-item-${endpoint}`);
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();
@@ -51,15 +51,15 @@ test.describe('Key suite', () => {
test('Test Setting and Revoking Keys from Settings', async ({ page }) => {
await page.goto('http://localhost:3080/', { timeout: 5000 });
const endpoint = 'bingAI';
const endpoint = 'chatGPTBrowser';
const newTopicButton = page.getByTestId('new-conversation-menu');
const newTopicButton = page.getByTestId('title-button');
await newTopicButton.click();
const endpointItem = page.getByTestId(`endpoint-item-${endpoint}`);
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();
@@ -80,7 +80,7 @@ test.describe('Key suite', () => {
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();
});
});

View File

@@ -3,8 +3,8 @@ import { expect, test } from '@playwright/test';
test.describe('Landing suite', () => {
test('Landing title', async ({ page }) => {
await page.goto('http://localhost:3080/', { timeout: 5000 });
const pageTitle = await page.textContent('#landing-title');
expect(pageTitle?.length).toBeGreaterThan(0);
const pageTitle = page.getByText('How can I help you today?');
expect(pageTitle).toBeTruthy();
});
test('Create Conversation', async ({ page }) => {

View File

@@ -1,7 +1,7 @@
import { expect, test } from '@playwright/test';
import type { Response, Page, BrowserContext } from '@playwright/test';
const basePath = 'http://localhost:3080/chat/';
const basePath = 'http://localhost:3080/c/';
const initialUrl = `${basePath}new`;
const endpoints = ['google', 'openAI', 'azureOpenAI', 'bingAI', 'chatGPTBrowser', 'gptPlugins'];
const endpoint = endpoints[1];
@@ -50,7 +50,7 @@ test.describe('Messaging suite', () => {
test('textbox should be focused after generation, test expected navigation, & test editing messages', async ({
page,
}) => {
test.setTimeout(120000);
test.setTimeout(10000);
const message = 'hi';
await page.goto(initialUrl, { timeout: 5000 });
await page.locator('#new-conversation-menu').click();