Updating Tests and Fixing Related Bugs (#2319)
* 🐛 (tableNodeCellRender): fix templateValue check to use Object.keys ✨ (textAreaComponent): add Case component for conditional rendering ♻️ (editNodeModal): remove commented-out useEffect code ✅ (basicExamples.spec): update test selectors and increase timeout values ✅ (filterEdge.spec.ts): update test IDs to match new naming conventions ✅ (inputListComponent.spec.ts, intComponent.spec.ts): update test IDs and streamline test steps for consistency and clarity ✅ (keyPairListComponent.spec.ts): update test ID for model element ✅ (keyPairListComponent.spec.ts): add steps to test editing model options and saving changes * ✅ (tests): update end-to-end tests for chat input/output and modal components - Update test selectors for better accuracy - Add keyboard interaction in chatInputOutputUser.spec.ts - Improve file handling in chat image upload test - Refine prompt modal component tests for better validation - Enhance twoEdges.spec.ts with additional view controls * ♻️ (tests): refactor repeated click actions into reusable function in e2e tests * ✅ (tests): replace waitForTimeout with waitForSelector in end-to-end tests * ✅ (typescript_test.yml): add --debug flag to Playwright test command for better debugging * ✅ (typescript_test.yml): enable trace option in Playwright tests for better debugging * ✅ (typescript_test.yml): reduce Playwright test workers from 2 to 1 to improve stability ✅ (textInputOutput.spec.ts): add waitFor visibility checks to ensure elements are visible before interaction * ✅ (tests): update paths for test assets to correct locations ✅ (tests): add waitForSelector to ensure elements are loaded before interaction * ✅ (typescript_test.yml): increase Playwright workers from 1 to 2 to speed up tests ✅ (chatInputOutputUser.spec.ts): increase timeout for AI response to 100000ms ✅ (chatInputOutputUser.spec.ts): correct file path for image upload test ✅ (deleteComponentFlows.spec.ts): change waitFor to target last checkbox-component ✅ (store.spec.ts): increase timeout for share button to 100000ms * 🐛 (flows.py): ensure flow names are unique by appending a number if necessary * Apply Ruff formatting --------- Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org> Co-authored-by: Cristhianzl <Cristhianzl@users.noreply.github.com>
This commit is contained in:
parent
2fe2024a58
commit
4077135ba7
26 changed files with 381 additions and 222 deletions
|
|
@ -209,6 +209,23 @@ def update_flow(
|
|||
webhook_component = get_webhook_component_in_flow(db_flow.data)
|
||||
db_flow.webhook = webhook_component is not None
|
||||
db_flow.updated_at = datetime.now(timezone.utc)
|
||||
|
||||
# First check if the flow.name is unique
|
||||
# there might be flows with name like: "MyFlow", "MyFlow (1)", "MyFlow (2)"
|
||||
# so we need to check if the name is unique with `like` operator
|
||||
# if we find a flow with the same name, we add a number to the end of the name
|
||||
# based on the highest number found
|
||||
flow_from_db = session.exec(select(Flow).where(Flow.id == flow_id, Flow.user_id == current_user.id)).first()
|
||||
if flow_from_db:
|
||||
flows = session.exec(
|
||||
select(Flow).where(Flow.name.like(f"{flow.name} (%")).where(Flow.user_id == current_user.id) # type: ignore
|
||||
).all()
|
||||
if flows:
|
||||
numbers = [int(flow.name.split("(")[1].split(")")[0]) for flow in flows]
|
||||
flow.name = f"{flow.name} ({max(numbers) + 1})"
|
||||
else:
|
||||
flow.name = f"{flow.name} (1)"
|
||||
|
||||
if db_flow.folder_id is None:
|
||||
default_folder = session.exec(select(Folder).where(Folder.name == DEFAULT_FOLDER_NAME)).first()
|
||||
if default_folder:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue