-
Notifications
You must be signed in to change notification settings - Fork 0
test: stabilize editor quality and e2e baseline #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 22 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| import { describe, expect, it } from 'vitest'; | ||
| import useUILayoutStore from './uiLayoutStore.ts'; | ||
| import useWorkflowStore from './workflowStore.ts'; | ||
|
|
||
| describe('persisted store test storage', () => { | ||
| it('provides browser-compatible localStorage methods', () => { | ||
| expect(globalThis.localStorage).toMatchObject({ | ||
| getItem: expect.any(Function), | ||
| setItem: expect.any(Function), | ||
| removeItem: expect.any(Function), | ||
| clear: expect.any(Function), | ||
| }); | ||
| }); | ||
|
|
||
| it('can reset persisted stores without a storage setItem error', () => { | ||
| expect(() => { | ||
| useWorkflowStore.setState({ | ||
| nodes: [], | ||
| edges: [], | ||
| selectedNodeId: null, | ||
| selectedEdgeId: null, | ||
| nodeCounter: 0, | ||
| undoStack: [], | ||
| redoStack: [], | ||
| toasts: [], | ||
| tabs: [], | ||
| activeTabId: 'default', | ||
| }); | ||
|
|
||
| useUILayoutStore.setState({ | ||
| projectSwitcherCollapsed: false, | ||
| nodePaletteCollapsed: false, | ||
| propertyPanelCollapsed: false, | ||
| yamlPaneVisible: true, | ||
| }); | ||
| }).not.toThrow(); | ||
| }); | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import { describe, expect, it } from 'vitest'; | ||
| import { useWorkflowStore } from './workflowStore.ts'; | ||
| import type { WorkflowConfig } from '../types/workflow.ts'; | ||
|
|
||
| describe('workflow store export', () => { | ||
| it('exports module-only configs without requiring workflow or trigger sections', () => { | ||
| const config: WorkflowConfig = { | ||
| modules: [ | ||
| { | ||
| name: 'my-server', | ||
| type: 'http.server', | ||
| config: { address: ':8080' }, | ||
| }, | ||
| ], | ||
| workflows: {}, | ||
| triggers: {}, | ||
| _originalKeys: ['modules'], | ||
| }; | ||
|
|
||
| useWorkflowStore.getState().importFromConfig(config); | ||
| const node = useWorkflowStore.getState().nodes[0]; | ||
| useWorkflowStore.getState().updateNodeConfig(node.id, { address: ':9090' }); | ||
|
|
||
| expect(() => useWorkflowStore.getState().exportToConfig()).not.toThrow(); | ||
| expect(useWorkflowStore.getState().exportToConfig()).toMatchObject({ | ||
| modules: [ | ||
| { | ||
| name: 'my-server', | ||
| type: 'http.server', | ||
| config: { address: ':9090' }, | ||
| }, | ||
| ], | ||
| }); | ||
|
Comment on lines
+24
to
+33
|
||
| }); | ||
| }); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -472,10 +472,10 @@ const useWorkflowStore = create<WorkflowStore>()( | |
| ? { modules: [], workflows: {}, triggers: {}, ...importedPassthrough } | ||
| : undefined; | ||
| const config = nodesToConfig(nodes, edges, moduleTypeMap, originalConfig); | ||
| if (Object.keys(config.workflows).length === 0 && Object.keys(importedWorkflows).length > 0) { | ||
| if (Object.keys(config.workflows ?? {}).length === 0 && Object.keys(importedWorkflows).length > 0) { | ||
| config.workflows = importedWorkflows; | ||
| } | ||
| if (Object.keys(config.triggers).length === 0 && Object.keys(importedTriggers).length > 0) { | ||
| if (Object.keys(config.triggers ?? {}).length === 0 && Object.keys(importedTriggers).length > 0) { | ||
| config.triggers = importedTriggers; | ||
|
Comment on lines
+475
to
479
|
||
| } | ||
| if (Object.keys(importedPipelines).length > 0) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The selector
page.getByText('▶HTTP1')is brittle because it depends on the disclosure glyph and the filtered type count being rendered as contiguous text. Since the NodePalette header is composed of multiple elements (triangle + label + count), prefer a locator that targets the category label (e.g., locate the category row that contains textHTTPand click it) without hard-coding the glyph/count, to reduce E2E flakiness when UI text/layout changes.