refactor: change endpoint monitor/builds to use useQuery (#2622)
* ✨ (constants.ts): add BUILDS endpoint to URLs constants ✨ (index.ts): create index file for builds-related queries ✨ (use-delete-builds.ts): implement useDeleteFLowPool hook for deleting builds * ✨ (chatView): integrate useDeleteFlowPool hook for deleting flow pool ♻️ (chatView): refactor clearChat function to use mutateFlowPool for deletion * ♻️ (use-delete-builds.ts): rename useDeleteFLowPool to useDeleteBuilds for clarity ♻️ (index.tsx): update import and usage of useDeleteFLowPool to useDeleteBuilds * ✨ (API): add use-get-builds query to fetch build data ✨ (PageComponent): integrate use-get-builds query for fetching builds ✨ (flowStore): add setters for inputs, outputs, and hasIO in flowStore * ♻️ (flowStore.ts): refactor hasIO to derive its value from inputs and outputs 🔥 (flowStore.ts): remove unused resetFlow function to clean up the codebase * ♻️ (use-get-builds.ts): refactor useGetBuildsQuery to remove unused params ✨ (PageComponent): add logic to handle flow state, inputs, outputs, and viewport ♻️ (flowStore): refactor and add resetFlow method to handle flow state reset * ✅ (chatComponent): add data-testid attributes for better testability ✅ (generalBugs-shard-3.spec.ts): add end-to-end test for playground button state --------- Co-authored-by: anovazzi1 <otavio2204@gmail.com>
This commit is contained in:
parent
0fcba55f51
commit
a811834b93
10 changed files with 203 additions and 25 deletions
|
|
@ -196,3 +196,58 @@ test("should copy code from playground modal", async ({ page }) => {
|
|||
expect(clipboardContent.length).toBeGreaterThan(0);
|
||||
expect(clipboardContent).toContain("Hello");
|
||||
});
|
||||
|
||||
test("playground button should be enabled or disabled", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
await page.locator("span").filter({ hasText: "My Collection" }).isVisible();
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
let modalCount = 0;
|
||||
try {
|
||||
const modalTitleElement = await page?.getByTestId("modal-title");
|
||||
if (modalTitleElement) {
|
||||
modalCount = await modalTitleElement.count();
|
||||
}
|
||||
} catch (error) {
|
||||
modalCount = 0;
|
||||
}
|
||||
|
||||
while (modalCount === 0) {
|
||||
await page.getByText("New Project", { exact: true }).click();
|
||||
await page.waitForTimeout(5000);
|
||||
modalCount = await page.getByTestId("modal-title")?.count();
|
||||
}
|
||||
|
||||
await page.waitForSelector('[data-testid="blank-flow"]', {
|
||||
timeout: 30000,
|
||||
});
|
||||
|
||||
await page.getByTestId("blank-flow").click();
|
||||
await page.waitForSelector('[data-testid="extended-disclosure"]', {
|
||||
timeout: 30000,
|
||||
});
|
||||
|
||||
await page.getByTestId("playground-btn-flow").click({ force: true });
|
||||
|
||||
expect(await page.getByText("Langflow Chat").isHidden());
|
||||
|
||||
await page.getByPlaceholder("Search").click();
|
||||
await page.getByPlaceholder("Search").fill("chat output");
|
||||
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
await page
|
||||
.locator('//*[@id="outputsChat Output"]')
|
||||
.dragTo(page.locator('//*[@id="react-flow-id"]'));
|
||||
await page.mouse.up();
|
||||
await page.mouse.down();
|
||||
await page.waitForSelector('[title="fit view"]', {
|
||||
timeout: 100000,
|
||||
});
|
||||
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
await page.getByTestId("playground-btn-flow-io").click({ force: true });
|
||||
|
||||
expect(await page.getByText("Langflow Chat").isVisible());
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue