fix: Improve update_flow data consistency, refine error handling, and add folder-moving tests (#5516)
* 🐛 (flows.py): Fix issue where flow data was not being properly updated in the database during flow update 📝 (flows.py): Improve error handling and rollback database session in case of exceptions during flow update 📝 (flows.py): Refactor code to handle unique constraint errors and provide more informative error messages 📝 (utils.py): Refactor get_webhook_component_in_flow function to handle cases where flow_data may not have 'nodes' attribute * ✨ (sideBarFolderButtons/index.tsx): add unique id attribute to sidebar folder buttons for improved accessibility and testing ✨ (general-bugs-move-flow-from-folder.spec.ts): add test to ensure user can move flow from one folder to another in the frontend application * 🐛 (flows.py): remove unnecessary session rollback to prevent potential data inconsistency ♻️ (service.py): refactor with_session method to handle session commit and rollback more effectively * style: adjust line breaks for readability * style: reorder imports * fix: ruff error try300 * [autofix.ci] apply automated fixes * fix: mypy error module has no attribute "timeout" * 🐛 (flows.py): remove unnecessary error handling code and improve exception handling for better error propagation and clarity * [autofix.ci] apply automated fixes * Update src/backend/base/langflow/services/database/service.py Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org> * use model dump besides overwrite value * [autofix.ci] apply automated fixes * 📝 (chat.py): improve code readability by refactoring session handling and adding comments for clarity 🔧 (chat.py): refactor code to create a fresh session for database operations and improve session management in build_flow function * [autofix.ci] apply automated fixes * refactor: remove unused session parameter from build_flow function in chat.py --------- Co-authored-by: italojohnny <italojohnnydosanjos@gmail.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
This commit is contained in:
parent
02c76a9db5
commit
e7a2005188
6 changed files with 93 additions and 25 deletions
|
|
@ -373,6 +373,7 @@ const SideBarFoldersButtonsComponent = ({
|
|||
onDrop={(e) => onDrop(e, item.id!)}
|
||||
key={item.id}
|
||||
data-testid={`sidebar-nav-${item.name}`}
|
||||
id={`sidebar-nav-${item.name}`}
|
||||
isActive={checkPathName(item.id!)}
|
||||
onClick={() => handleChangeFolder!(item.id!)}
|
||||
className={cn(
|
||||
|
|
|
|||
|
|
@ -0,0 +1,54 @@
|
|||
import { expect, test } from "@playwright/test";
|
||||
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
|
||||
|
||||
test("user must be able to move flow from folder", async ({ page }) => {
|
||||
const randomName = Math.random().toString(36).substring(2, 15);
|
||||
|
||||
await awaitBootstrapTest(page);
|
||||
|
||||
await page.getByTestId("side_nav_options_all-templates").click();
|
||||
await page.getByRole("heading", { name: "Basic Prompting" }).click();
|
||||
|
||||
await page.waitForSelector('[data-testid="flow_name"]', {
|
||||
timeout: 3000,
|
||||
});
|
||||
|
||||
await page.getByTestId("flow_name").click();
|
||||
await page.getByText("Flow Settings").first().click();
|
||||
await page.getByPlaceholder("Flow name").fill(randomName);
|
||||
|
||||
await page.getByTestId("save-flow-settings").click();
|
||||
|
||||
await page.getByText("Changes saved successfully").isVisible();
|
||||
|
||||
await page.getByTestId("icon-ChevronLeft").click();
|
||||
await page.waitForSelector('[data-testid="add-folder-button"]', {
|
||||
timeout: 3000,
|
||||
});
|
||||
|
||||
await page.getByTestId("add-folder-button").click();
|
||||
|
||||
//wait for the folder to be created and changed to the new folder
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await page.getByTestId("sidebar-nav-My Projects").click();
|
||||
|
||||
await page.getByText(randomName).hover();
|
||||
|
||||
await page
|
||||
.getByTestId("list-card")
|
||||
.first()
|
||||
.dragTo(page.locator('//*[@id="sidebar-nav-New Folder"]'));
|
||||
|
||||
//wait for the drag and drop to be completed
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await page.getByTestId("sidebar-nav-New Folder").click();
|
||||
|
||||
await page.waitForSelector('[data-testid="list-card"]', {
|
||||
timeout: 3000,
|
||||
});
|
||||
|
||||
const flowNameCount = await page.getByText(randomName).count();
|
||||
expect(flowNameCount).toBeGreaterThan(0);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue