Skip to content

Commit

Permalink
Merge branch 'master' into ADO-1933-fix-tigger-connections
Browse files Browse the repository at this point in the history
* master:
  fix(core): Ensure only leader handles waiting executions (#9014)
  fix(editor): Fix execution with wait node (#9051)
  fix(editor): Issue showing Auth2 callback section when all properties are overriden (#8999)
  fix(editor): Rerun failed nodes in manual executions (#9050)
  fix(editor): Canvas showing error toast when clicking outside of "import workflow by url" modal (#9001)
  fix: Workflows executed from other workflows not stopping (#9010)
  fix: Fix missing input panel in node details view (#9043)
  fix(editor): Prevent saving workflow while another save is in progress (#9048)
  • Loading branch information
MiloradFilipovic committed Apr 4, 2024
2 parents 46fea16 + 217b07d commit f060d46
Show file tree
Hide file tree
Showing 18 changed files with 943 additions and 59 deletions.
25 changes: 25 additions & 0 deletions cypress/e2e/1338-ADO-ndv-missing-input-panel.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { v4 as uuid } from 'uuid';
import { NDV, WorkflowPage as WorkflowPageClass } from '../pages';

const workflowPage = new WorkflowPageClass();
const ndv = new NDV();

describe('ADO-1338-ndv-missing-input-panel', () => {
beforeEach(() => {
workflowPage.actions.visit();
});

it('should show the input and output panels when node is missing input and output data', () => {
cy.createFixtureWorkflow('Test_ado_1338.json', uuid());

// Execute the workflow
workflowPage.getters.zoomToFitButton().click();
workflowPage.getters.executeWorkflowButton().click();
// Check success toast (works because Cypress waits enough for the element to show after the http request node has finished)
workflowPage.getters.successToast().should('be.visible');

workflowPage.actions.openNode('Discourse1');
ndv.getters.inputPanel().should('be.visible');
ndv.getters.outputPanel().should('be.visible');
});
});
25 changes: 25 additions & 0 deletions cypress/e2e/2-credentials.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,4 +236,29 @@ describe('Credentials', () => {
.find('input')
.should('have.value', NEW_QUERY_AUTH_ACCOUNT_NAME);
});

it('should not show OAuth redirect URL section when OAuth2 credentials are overridden', () => {
cy.intercept('/types/credentials.json', { middleware: true }, (req) => {
req.headers['cache-control'] = 'no-cache, no-store';

req.on('response', (res) => {
const credentials = res.body || [];

const index = credentials.findIndex((c) => c.name === 'slackOAuth2Api');

credentials[index] = {
...credentials[index],
__overwrittenProperties: ['clientId', 'clientSecret'],
};
});
});

workflowPage.actions.visit(true);
workflowPage.actions.addNodeToCanvas('Slack');
workflowPage.actions.openNode('Slack');
workflowPage.getters.nodeCredentialsSelect().click();
getVisibleSelect().find('li').last().click();
credentialsModal.getters.credentialAuthTypeRadioButtons().first().click();
nodeDetailsView.getters.copyInput().should('not.exist');
});
});
74 changes: 74 additions & 0 deletions cypress/e2e/39-import-workflow.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import { WorkflowPage } from '../pages';
import { MessageBox as MessageBoxClass } from '../pages/modals/message-box';

const workflowPage = new WorkflowPage();
const messageBox = new MessageBoxClass();

before(() => {
cy.fixture('Onboarding_workflow.json').then((data) => {
cy.intercept('GET', '/rest/workflows/from-url*', {
body: { data },
}).as('downloadWorkflowFromURL');
});
});

describe('Import workflow', () => {
describe('From URL', () => {
it('should import workflow', () => {
workflowPage.actions.visit(true);
workflowPage.getters.workflowMenu().click();
workflowPage.getters.workflowMenuItemImportFromURLItem().click();

messageBox.getters.modal().should('be.visible');

messageBox.getters.content().type('https://fakepage.com/workflow.json');

messageBox.getters.confirm().click();

workflowPage.actions.zoomToFit();

workflowPage.getters.canvasNodes().should('have.length', 4);

workflowPage.getters.errorToast().should('not.exist');

workflowPage.getters.successToast().should('not.exist');
});

it('clicking outside modal should not show error toast', () => {
workflowPage.actions.visit(true);

workflowPage.getters.workflowMenu().click();
workflowPage.getters.workflowMenuItemImportFromURLItem().click();

cy.get('body').click(0, 0);

workflowPage.getters.errorToast().should('not.exist');
});

it('canceling modal should not show error toast', () => {
workflowPage.actions.visit(true);

workflowPage.getters.workflowMenu().click();
workflowPage.getters.workflowMenuItemImportFromURLItem().click();
messageBox.getters.cancel().click();

workflowPage.getters.errorToast().should('not.exist');
});
});

describe('From File', () => {
it('should import workflow', () => {
workflowPage.actions.visit(true);

workflowPage.getters.workflowMenu().click();
workflowPage.getters.workflowMenuItemImportFromFile().click();
workflowPage.getters
.workflowImportInput()
.selectFile('cypress/fixtures/Test_workflow-actions_paste-data.json', { force: true });
cy.waitForLoad(false);
workflowPage.actions.zoomToFit();
workflowPage.getters.canvasNodes().should('have.length', 5);
workflowPage.getters.nodeConnections().should('have.length', 5);
});
});
});
43 changes: 17 additions & 26 deletions cypress/e2e/7-workflow-actions.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import { getVisibleSelect } from '../utils';
import { WorkflowExecutionsTab } from '../pages';

const NEW_WORKFLOW_NAME = 'Something else';
const IMPORT_WORKFLOW_URL =
'https://gist.githubusercontent.com/OlegIvaniv/010bd3f45c8a94f8eb7012e663a8b671/raw/3afea1aec15573cc168d9af7e79395bd76082906/test-workflow.json';
const DUPLICATE_WORKFLOW_NAME = 'Duplicated workflow';
const DUPLICATE_WORKFLOW_TAG = 'Duplicate';

Expand Down Expand Up @@ -108,6 +106,23 @@ describe('Workflow Actions', () => {
cy.wait('@saveWorkflow');
cy.wrap(null).then(() => expect(interceptCalledCount).to.eq(1));
});

it('should not save workflow twice when save is in progress', () => {
// This happens when users click save button from workflow name input
// In this case blur on the input saves the workflow and then click on the button saves it again
WorkflowPage.actions.visit();
WorkflowPage.getters.workflowNameInput().invoke('val').then((oldName) => {
WorkflowPage.getters.workflowNameInputContainer().click();
WorkflowPage.getters.workflowNameInput().type('{selectall}');
WorkflowPage.getters.workflowNameInput().type('Test');
WorkflowPage.getters.saveButton().click();
WorkflowPage.getters.workflowNameInput().should('have.value', 'Test');
cy.visit(WorkflowPages.url);
// There should be no workflow with the old name (duplicate save)
WorkflowPages.getters.workflowCards().contains(String(oldName)).should('not.exist');
});
});

it('should copy nodes', () => {
WorkflowPage.actions.addNodeToCanvas(SCHEDULE_TRIGGER_NODE_NAME);
WorkflowPage.actions.addNodeToCanvas(CODE_NODE_NAME);
Expand All @@ -129,30 +144,6 @@ describe('Workflow Actions', () => {
});
});

it('should import workflow from url', () => {
WorkflowPage.getters.workflowMenu().should('be.visible');
WorkflowPage.getters.workflowMenu().click();
WorkflowPage.getters.workflowMenuItemImportFromURLItem().should('be.visible');
WorkflowPage.getters.workflowMenuItemImportFromURLItem().click();
cy.get('.el-message-box').should('be.visible');
cy.get('.el-message-box').find('input').type(IMPORT_WORKFLOW_URL);
cy.get('body').type('{enter}');
cy.waitForLoad(false);
WorkflowPage.actions.zoomToFit();
WorkflowPage.getters.canvasNodes().should('have.length', 2);
WorkflowPage.getters.nodeConnections().should('have.length', 1);
});

it('should import workflow from file', () => {
WorkflowPage.getters
.workflowImportInput()
.selectFile('cypress/fixtures/Test_workflow-actions_paste-data.json', { force: true });
cy.waitForLoad(false);
WorkflowPage.actions.zoomToFit();
WorkflowPage.getters.canvasNodes().should('have.length', 5);
WorkflowPage.getters.nodeConnections().should('have.length', 5);
});

it('should update workflow settings', () => {
cy.visit(WorkflowPages.url);
WorkflowPages.getters.workflowCards().then((cards) => {
Expand Down
Loading

0 comments on commit f060d46

Please sign in to comment.