Skip to content

Commit

Permalink
Add unsaved workflow duplicate test
Browse files Browse the repository at this point in the history
  • Loading branch information
OlegIvaniv committed Mar 30, 2023
1 parent 67d948d commit 46c9f49
Showing 1 changed file with 41 additions and 30 deletions.
71 changes: 41 additions & 30 deletions cypress/e2e/7-workflow-actions.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,37 +190,48 @@ describe('Workflow Actions', () => {
cy.url().should('include', '/workflow/new');
});

it('should duplicate workflow', () => {
// Stub window.open so new tab is not getting opened
cy.window().then((win) => {
cy.stub(win, 'open').as('open');
describe('duplicate workflow', () => {
function duplicateWorkflow() {
WorkflowPage.getters.workflowMenu().should('be.visible');
WorkflowPage.getters.workflowMenu().click();
WorkflowPage.getters.workflowMenuItemDuplicate().click();
WorkflowPage.getters.duplicateWorkflowModal().should('be.visible');
WorkflowPage.getters.duplicateWorkflowModal().find('input').first().should('be.visible');
WorkflowPage.getters.duplicateWorkflowModal().find('input').first().type('{selectall}');
WorkflowPage.getters
.duplicateWorkflowModal()
.find('input')
.first()
.type(DUPLICATE_WORKFLOW_NAME);
WorkflowPage.getters
.duplicateWorkflowModal()
.find('.el-select__tags input')
.type(DUPLICATE_WORKFLOW_TAG);
WorkflowPage.getters.duplicateWorkflowModal().find('.el-select__tags input').type('{enter}');
WorkflowPage.getters.duplicateWorkflowModal().find('.el-select__tags input').type('{enter}');
WorkflowPage.getters
.duplicateWorkflowModal()
.find('button')
.contains('Duplicate')
.should('be.visible');
WorkflowPage.getters.duplicateWorkflowModal().find('button').contains('Duplicate').click();
WorkflowPage.getters.errorToast().should('not.exist');
}

beforeEach(() => {
// Stub window.open so new tab is not getting opened
cy.window().then((win) => {
cy.stub(win, 'open').as('open');
});
WorkflowPage.actions.addNodeToCanvas(MANUAL_TRIGGER_NODE_NAME);
});

WorkflowPage.actions.addNodeToCanvas(MANUAL_TRIGGER_NODE_NAME);
WorkflowPage.actions.saveWorkflowOnButtonClick();
WorkflowPage.getters.workflowMenu().should('be.visible');
WorkflowPage.getters.workflowMenu().click();
WorkflowPage.getters.workflowMenuItemDuplicate().click();
WorkflowPage.getters.duplicateWorkflowModal().should('be.visible');
WorkflowPage.getters.duplicateWorkflowModal().find('input').first().should('be.visible');
WorkflowPage.getters.duplicateWorkflowModal().find('input').first().type('{selectall}');
WorkflowPage.getters
.duplicateWorkflowModal()
.find('input')
.first()
.type(DUPLICATE_WORKFLOW_NAME);
WorkflowPage.getters
.duplicateWorkflowModal()
.find('.el-select__tags input')
.type(DUPLICATE_WORKFLOW_TAG);
WorkflowPage.getters.duplicateWorkflowModal().find('.el-select__tags input').type('{enter}');
WorkflowPage.getters.duplicateWorkflowModal().find('.el-select__tags input').type('{enter}');
WorkflowPage.getters
.duplicateWorkflowModal()
.find('button')
.contains('Duplicate')
.should('be.visible');
WorkflowPage.getters.duplicateWorkflowModal().find('button').contains('Duplicate').click();
WorkflowPage.getters.errorToast().should('not.exist');
it('should duplicate unsaved workflow', () => {
duplicateWorkflow();
});
it('should duplicate saved workflow', () => {
WorkflowPage.actions.saveWorkflowOnButtonClick();
duplicateWorkflow();
});
});
});

0 comments on commit 46c9f49

Please sign in to comment.