test(editor): Update workflow actions tests for the new canvas (no-changelog) (#12245)

Co-authored-by: Alex Grozav <alex@grozav.com>
This commit is contained in:
Milorad FIlipović
2025-01-08 12:11:11 +01:00
committed by GitHub
parent 3006ccf41b
commit 8cce588209
2 changed files with 22 additions and 2 deletions

View File

@@ -171,9 +171,16 @@ describe('Workflow Actions', () => {
cy.get('#node-creator').should('not.exist');
WorkflowPage.actions.hitSelectAll();
cy.get('.jtk-drag-selected').should('have.length', 2);
WorkflowPage.actions.hitCopy();
successToast().should('exist');
// Both nodes should be copied
cy.window()
.its('navigator.clipboard')
.then((clip) => clip.readText())
.then((text) => {
const copiedWorkflow = JSON.parse(text);
expect(copiedWorkflow.nodes).to.have.length(2);
});
});
it('should paste nodes (both current and old node versions)', () => {
@@ -345,7 +352,15 @@ describe('Workflow Actions', () => {
WorkflowPage.actions.hitDeleteAllNodes();
WorkflowPage.getters.canvasNodes().should('have.length', 0);
// Button should be disabled
WorkflowPage.getters.executeWorkflowButton().should('be.disabled');
cy.ifCanvasVersion(
() => {
WorkflowPage.getters.executeWorkflowButton().should('be.disabled');
},
() => {
// In new canvas, button does not exist when there are no nodes
WorkflowPage.getters.executeWorkflowButton().should('not.exist');
},
);
// Keyboard shortcut should not work
WorkflowPage.actions.hitExecuteWorkflow();
successToast().should('not.exist');

View File

@@ -697,6 +697,11 @@ function onPinNodes(ids: string[], source: PinDataSource) {
}
async function onSaveWorkflow() {
const workflowIsSaved = !uiStore.stateIsDirty;
if (workflowIsSaved) {
return;
}
const saved = await workflowHelpers.saveCurrentWorkflow();
if (saved) {
canvasEventBus.emit('saved:workflow');