Skip to content
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

fix(editor): Fix canvas selection breaking after interacting with node actions #7466

Merged
merged 3 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions cypress/e2e/12-canvas-actions.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,4 +198,30 @@ describe('Canvas Actions', () => {
cy.get('body').type('{shift}', { release: false }).type('{leftArrow}');
WorkflowPage.getters.selectedNodes().should('have.length', 2);
});

it('should not break lasso selection when dragging node action buttons', () => {
WorkflowPage.actions.addNodeToCanvas(MANUAL_TRIGGER_NODE_NAME);
WorkflowPage.getters
.canvasNodes()
.last()
.findChildByTestId('disable-node-button').as('disableNodeButton');
cy.drag('@disableNodeButton', [200, 200]);
WorkflowPage.actions.testLassoSelection([100, 100], [200, 200]);
});

it('should not break lasso selection with multiple clicks on node action buttons', () => {
WorkflowPage.actions.addNodeToCanvas(MANUAL_TRIGGER_NODE_NAME);
WorkflowPage.actions.testLassoSelection([100, 100], [200, 200]);
WorkflowPage.getters
.canvasNodes()
.last().as('lastNode');
cy.get('@lastNode').findChildByTestId('disable-node-button').as('disableNodeButton');
for (let i = 0; i < 20; i++) {
cy.get('@lastNode').realHover();
cy.get('@disableNodeButton').should('be.visible');
cy.get('@disableNodeButton').realTouch();
cy.getByTestId('execute-workflow-button').realHover();
WorkflowPage.actions.testLassoSelection([100, 100], [200, 200]);
}
});
});
7 changes: 7 additions & 0 deletions cypress/pages/workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,5 +327,12 @@ export class WorkflowPage extends BasePage {
shouldHaveWorkflowName: (name: string) => {
this.getters.workflowNameInputContainer().invoke('attr', 'title').should('include', name);
},
testLassoSelection: (from: [number, number], to: [number, number]) => {
cy.getByTestId('node-view-wrapper').trigger('mousedown', from[0], from[1], { force: true });
cy.getByTestId('node-view-wrapper').trigger('mousemove', to[0], to[1], { force: true });
cy.get('#select-box').should('be.visible');
cy.getByTestId('node-view-wrapper').trigger('mouseup', to[0], to[1], { force: true });
cy.get('#select-box').should('not.be.visible');
},
};
}
3 changes: 3 additions & 0 deletions packages/editor-ui/src/stores/canvas.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,9 @@ export const useCanvasStore = defineStore('canvas', () => {
if (moveNodes.length > 1) {
historyStore.stopRecordingUndo();
}
if (uiStore.isActionActive('dragActive')) {
uiStore.removeActiveAction('dragActive');
}
}
},
filter: '.node-description, .node-description .node-name, .node-description .node-subtitle',
Expand Down
1 change: 1 addition & 0 deletions packages/editor-ui/src/views/NodeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<div
class="node-view-wrapper"
:class="workflowClasses"
data-test-id="node-view-wrapper"
@touchstart="mouseDown"
@touchend="mouseUp"
@touchmove="mouseMoveNodeWorkflow"
Expand Down
Loading