Skip to content

Commit

Permalink
additional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pablonyx committed Dec 5, 2024
1 parent 784ef7b commit e18da6e
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 30 deletions.
6 changes: 3 additions & 3 deletions web/src/app/admin/assistants/AssistantEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -595,13 +595,15 @@ export function AssistantEditor({
tooltip="Used to identify the Assistant in the UI."
label="Name"
placeholder="e.g. 'Email Assistant'"
aria-label="assistant-name-input"
/>

<TextFormField
tooltip="Used for identifying assistants and their use cases."
name="description"
label="Description"
placeholder="e.g. 'Use this Assistant to help draft professional emails'"
data-testid="assistant-description-input"
/>

<TextFormField
Expand All @@ -610,9 +612,7 @@ export function AssistantEditor({
label="Instructions"
isTextArea={true}
placeholder="e.g. 'You are a professional email writing assistant that always uses a polite enthusiastic tone, emphasizes action items, and leaves blanks for the human to fill in when you have unknowns'"
onChange={(e) => {
setFieldValue("system_prompt", e.target.value);
}}
data-testid="assistant-instructions-input"
/>

<div>
Expand Down
2 changes: 2 additions & 0 deletions web/src/components/admin/connectors/Field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,10 @@ export function TextFormField({
as={isTextArea ? "textarea" : "input"}
type={type}
defaultValue={value}
data-testid={name}
name={name}
id={name}
aria-label={name}
className={`
${small && sizeClass.input}
border
Expand Down
2 changes: 1 addition & 1 deletion web/tests/e2e/admin_pages.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { test, expect } from "@playwright/test";
import { verifyAdminPageNavigation } from "./utils/adminSetup";
import { verifyAdminPageNavigation } from "./utils/admin_setup";
import testCases from "./testcases.json";

for (const testCase of testCases) {
Expand Down
49 changes: 23 additions & 26 deletions web/tests/e2e/chat.spec.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
import { test, expect } from "@chromatic-com/playwright";
import { test, expect } from "@playwright/test";

test(
"Chat",
{
tag: "@admin",
},
async ({ page }, testInfo) => {
// Test simple loading
await page.goto("http://localhost:3000/chat");

// Check for the "General" text in the new UI element
await expect(
page.locator("div.flex.items-center span.font-bold")
).toHaveText("General");

// Check for the presence of the new UI element
await expect(
page.locator("div.flex.justify-center div.bg-black.rounded-full")
).toBeVisible();

// Check for the SVG icon
await expect(
page.locator("div.flex.justify-center svg.w-5.h-5")
).toBeVisible();
}
);
test("test", async ({ page }) => {
await page.goto("http://localhost:3000/chat");
await page.hover("body", { position: { x: 0, y: 100 } });
await page.getByRole("link", { name: "Manage Assistants" }).click();
await expect(page).toHaveURL("http://localhost:3000/assistants/mine");
await page.getByRole("button", { name: "Create New Assistant" }).click();
await expect(page).toHaveURL("http://localhost:3000/assistants/new");
await page.getByTestId("name").click();
await page.getByTestId("name").fill("Test");
await page.getByTestId("description").click();
await page.getByTestId("description").fill("Test");
await page.getByTestId("system_prompt").click();
await page.getByTestId("system_prompt").fill("Test");
await page.getByRole("button", { name: "Logo GPT 4o", exact: true }).click();
await page.getByRole("button", { name: "Create!" }).click();
await page.waitForURL("http://localhost:3000/chat");
await expect(page).toHaveURL("http://localhost:3000/chat");
await page.getByPlaceholder("Send a message or try using").click();
await page.getByPlaceholder("Send a message or try using").fill("Hello");
await expect(page.locator("#danswer-ai-message")).toBeVisible();
await page.locator("#danswer-human-message").click();
});

0 comments on commit e18da6e

Please sign in to comment.