Skip to content

Commit

Permalink
Merge branch 'feat-4626-dynamic-providers' of https://github.com/lang…
Browse files Browse the repository at this point in the history
…flow-ai/langflow into feat-4626-dynamic-providers
  • Loading branch information
erichare committed Nov 18, 2024
2 parents f40be3e + 35f3d19 commit 489cdfe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
1 change: 0 additions & 1 deletion src/frontend/tests/core/features/group.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ test.describe("group node test", () => {
.getByRole("heading", { name: "Basic Prompting" })
.first()
.click();
await page.waitForTimeout(1000);
await page.getByTestId("fit_view").first().click();

await page.getByTestId("title-OpenAI").click();
Expand Down
23 changes: 13 additions & 10 deletions src/frontend/tests/core/features/keyboardComponentSearch.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,33 @@ test("user can search and add components using keyboard shortcuts", async ({

while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
await page.waitForSelector('[data-testid="modal-title"]', {
timeout: 3000,
});
modalCount = await page.getByTestId("modal-title")?.count();
}

// Start with blank flow
await page.getByTestId("blank-flow").click();
await page.waitForTimeout(1000);
await page.waitForSelector('[data-testid="sidebar-search-input"]', {
timeout: 1000,
});

// Press "/" to activate search
await page.keyboard.press("/");
await page.waitForTimeout(500);

// Verify search is focused and disclosures are closed when search is empty
await expect(page.getByTestId("sidebar-search-input")).toBeFocused();
await expect(page.getByTestId("sidebar-search-input")).toBeFocused({
timeout: 1000,
});
await expect(page.getByTestId("inputsChat Input")).not.toBeVisible();

// Type "chat" to search for chat components
await page.keyboard.type("chat");
await page.waitForTimeout(500);

await expect(page.getByTestId("inputsChat Input")).toBeVisible({
timeout: 1000,
});

// Verify disclosures open when search has content
await expect(page.getByTestId("inputsChat Input")).toBeVisible();
Expand All @@ -54,29 +62,25 @@ test("user can search and add components using keyboard shortcuts", async ({

// Press Space to select the component
await page.keyboard.press("Space");
await page.waitForTimeout(500);

// Verify component was added to flow
const addedComponent = await page.locator(".react-flow__node").first();
await expect(addedComponent).toBeVisible();

// Clear search input and verify disclosures are closed
await page.getByTestId("sidebar-search-input").clear();
await page.waitForTimeout(500);
await expect(page.getByTestId("inputsChat Input")).not.toBeVisible();

// Test Enter key selection
await page.keyboard.press("/");
await page.keyboard.type("prompt");
await page.waitForTimeout(500);

// Verify disclosures open with new search
await expect(page.getByTestId("promptsPrompt")).toBeVisible();

await page.keyboard.press("Tab");
await page.keyboard.press("Tab");
await page.keyboard.press("Enter");
await page.waitForTimeout(500);

// Verify second component was added
const nodeCount = await page.locator(".react-flow__node").count();
Expand All @@ -85,7 +89,6 @@ test("user can search and add components using keyboard shortcuts", async ({
// Verify search is cleared and disclosures are closed after adding component
await page.keyboard.press("/");
await page.getByTestId("sidebar-search-input").clear();
await page.waitForTimeout(500);
await expect(page.getByTestId("sidebar-search-input")).toHaveValue("");
await expect(page.getByTestId("inputsChat Input")).not.toBeVisible();

Expand Down

0 comments on commit 489cdfe

Please sign in to comment.