mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-09 22:24:05 -08:00
fix(editor): Prevent running workflows using keyboard shortcuts if execution is disabled (#9644)
This commit is contained in:
parent
7aea8243fe
commit
e9e3b254fe
|
@ -312,6 +312,33 @@ describe('Workflow Actions', () => {
|
|||
WorkflowPage.getters.canvasNodePlusEndpointByName(EDIT_FIELDS_SET_NODE_NAME).click();
|
||||
WorkflowPage.getters.nodeCreatorSearchBar().should('be.visible');
|
||||
});
|
||||
|
||||
it('should run workflow on button click', () => {
|
||||
WorkflowPage.actions.addInitialNodeToCanvas(MANUAL_TRIGGER_NODE_NAME);
|
||||
WorkflowPage.actions.saveWorkflowOnButtonClick();
|
||||
WorkflowPage.getters.executeWorkflowButton().click();
|
||||
WorkflowPage.getters.successToast().should('contain.text', 'Workflow executed successfully');
|
||||
});
|
||||
|
||||
it('should run workflow using keyboard shortcut', () => {
|
||||
WorkflowPage.actions.addInitialNodeToCanvas(MANUAL_TRIGGER_NODE_NAME);
|
||||
WorkflowPage.actions.saveWorkflowOnButtonClick();
|
||||
cy.get('body').type(META_KEY, { delay: 500, release: false }).type('{enter}');
|
||||
WorkflowPage.getters.successToast().should('contain.text', 'Workflow executed successfully');
|
||||
});
|
||||
|
||||
it('should not run empty workflows', () => {
|
||||
// Clear the canvas
|
||||
cy.get('body').type(META_KEY, { delay: 500, release: false }).type('a');
|
||||
cy.get('body').type('{backspace}');
|
||||
WorkflowPage.getters.canvasNodes().should('have.length', 0);
|
||||
// Button should be disabled
|
||||
WorkflowPage.getters.executeWorkflowButton().should('be.disabled');
|
||||
// Keyboard shortcut should not work
|
||||
cy.get('body').type(META_KEY, { delay: 500, release: false }).type('{enter}');
|
||||
WorkflowPage.getters.successToast().should('not.exist');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('Menu entry Push To Git', () => {
|
||||
|
|
|
@ -1643,7 +1643,7 @@ export default defineComponent({
|
|||
source: NODE_CREATOR_OPEN_SOURCES.TAB,
|
||||
createNodeActive: !this.createNodeActive && !this.isReadOnlyRoute && !this.readOnlyEnv,
|
||||
});
|
||||
} else if (e.key === 'Enter' && ctrlModifier && !readOnly) {
|
||||
} else if (e.key === 'Enter' && ctrlModifier && !readOnly && !this.isExecutionDisabled) {
|
||||
void this.onRunWorkflow();
|
||||
} else if (e.key === 'S' && shiftModifier && !readOnly) {
|
||||
void this.onAddNodes({ nodes: [{ type: STICKY_NODE_TYPE }], connections: [] });
|
||||
|
|
Loading…
Reference in a new issue