mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-12 15:44:06 -08:00
fix(editor): Fix canvas selection breaking after interacting with node actions (#7466)
Sometimes canvas selection stops working after users interact with node action buttons (for example if node is moved by dragging one of the buttons) NOTE: Ticket number in the branch name is wrong, this fixes ADO-1226
This commit is contained in:
parent
b50376cf52
commit
bc473655fb
|
@ -198,4 +198,30 @@ describe('Canvas Actions', () => {
|
||||||
cy.get('body').type('{shift}', { release: false }).type('{leftArrow}');
|
cy.get('body').type('{shift}', { release: false }).type('{leftArrow}');
|
||||||
WorkflowPage.getters.selectedNodes().should('have.length', 2);
|
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]);
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -327,5 +327,12 @@ export class WorkflowPage extends BasePage {
|
||||||
shouldHaveWorkflowName: (name: string) => {
|
shouldHaveWorkflowName: (name: string) => {
|
||||||
this.getters.workflowNameInputContainer().invoke('attr', 'title').should('include', name);
|
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');
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -271,6 +271,9 @@ export const useCanvasStore = defineStore('canvas', () => {
|
||||||
if (moveNodes.length > 1) {
|
if (moveNodes.length > 1) {
|
||||||
historyStore.stopRecordingUndo();
|
historyStore.stopRecordingUndo();
|
||||||
}
|
}
|
||||||
|
if (uiStore.isActionActive('dragActive')) {
|
||||||
|
uiStore.removeActiveAction('dragActive');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
filter: '.node-description, .node-description .node-name, .node-description .node-subtitle',
|
filter: '.node-description, .node-description .node-name, .node-description .node-subtitle',
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
<div
|
<div
|
||||||
class="node-view-wrapper"
|
class="node-view-wrapper"
|
||||||
:class="workflowClasses"
|
:class="workflowClasses"
|
||||||
|
data-test-id="node-view-wrapper"
|
||||||
@touchstart="mouseDown"
|
@touchstart="mouseDown"
|
||||||
@touchend="mouseUp"
|
@touchend="mouseUp"
|
||||||
@touchmove="mouseMoveNodeWorkflow"
|
@touchmove="mouseMoveNodeWorkflow"
|
||||||
|
|
Loading…
Reference in a new issue