-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
650 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* Getters | ||
*/ | ||
|
||
export const getExecutionsSidebar = () => cy.getByTestId('executions-sidebar'); | ||
|
||
export const getWorkflowExecutionPreviewIframe = () => cy.getByTestId('workflow-preview-iframe'); | ||
|
||
export const getExecutionPreviewBody = () => | ||
getWorkflowExecutionPreviewIframe() | ||
.its('0.contentDocument.body') | ||
.then((el) => cy.wrap(el)); | ||
|
||
export const getExecutionPreviewBodyNodes = () => | ||
getExecutionPreviewBody().findChildByTestId('canvas-node'); | ||
|
||
export const getExecutionPreviewBodyNodesByName = (name: string) => | ||
getExecutionPreviewBody().findChildByTestId('canvas-node').filter(`[data-name="${name}"]`).eq(0); | ||
|
||
export function getExecutionPreviewOutputPanelRelatedExecutionLink() { | ||
return getExecutionPreviewBody().findChildByTestId('related-execution-link'); | ||
} | ||
|
||
/** | ||
* Actions | ||
*/ | ||
|
||
export const openExecutionPreviewNode = (name: string) => | ||
getExecutionPreviewBodyNodesByName(name).dblclick(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
import { | ||
getExecutionPreviewOutputPanelRelatedExecutionLink, | ||
getExecutionsSidebar, | ||
getWorkflowExecutionPreviewIframe, | ||
openExecutionPreviewNode, | ||
} from '../composables/executions'; | ||
import { | ||
changeOutputRunSelector, | ||
getOutputPanelItemsCount, | ||
getOutputPanelRelatedExecutionLink, | ||
getOutputRunSelectorInput, | ||
getOutputTableHeaders, | ||
getOutputTableRows, | ||
getOutputTbodyCell, | ||
} from '../composables/ndv'; | ||
import { | ||
clickExecuteWorkflowButton, | ||
clickZoomToFit, | ||
getCanvasNodes, | ||
navigateToNewWorkflowPage, | ||
openNode, | ||
pasteWorkflow, | ||
saveWorkflowOnButtonClick, | ||
} from '../composables/workflow'; | ||
import SUBWORKFLOW_DEBUGGING_EXAMPLE from '../fixtures/Subworkflow-debugging-execute-workflow.json'; | ||
|
||
describe('Subworkflow debugging', () => { | ||
beforeEach(() => { | ||
navigateToNewWorkflowPage(); | ||
pasteWorkflow(SUBWORKFLOW_DEBUGGING_EXAMPLE); | ||
saveWorkflowOnButtonClick(); | ||
getCanvasNodes().should('have.length', 11); | ||
clickZoomToFit(); | ||
|
||
clickExecuteWorkflowButton(); | ||
}); | ||
|
||
describe('can inspect sub executed workflow', () => { | ||
it('(Run once with all items/ Wait for Sub-workflow completion) (default behavior)', () => { | ||
openNode('Execute Workflow with param'); | ||
|
||
getOutputPanelItemsCount().should('contain.text', '2 items, 1 sub-execution'); | ||
getOutputPanelRelatedExecutionLink().should('contain.text', 'Inspect Sub-Execution'); | ||
getOutputPanelRelatedExecutionLink().should('have.attr', 'href'); | ||
|
||
// ensure workflow executed and waited on output | ||
getOutputTableHeaders().should('have.length', 2); | ||
getOutputTbodyCell(1, 0).should('have.text', 'world Natalie Moore'); | ||
}); | ||
|
||
it('(Run once for each item/ Wait for Sub-workflow completion)', () => { | ||
openNode('Execute Workflow with param1'); | ||
|
||
getOutputPanelItemsCount().should('contain.text', '2 items, 2 sub-execution'); | ||
getOutputPanelRelatedExecutionLink().should('not.exist'); | ||
|
||
// ensure workflow executed and waited on output | ||
getOutputTableHeaders().should('have.length', 3); | ||
getOutputTbodyCell(1, 0).find('a').should('have.attr', 'href'); | ||
getOutputTbodyCell(1, 1).should('have.text', 'world Natalie Moore'); | ||
}); | ||
|
||
it('(Run once with all items/ Wait for Sub-workflow completion)', () => { | ||
openNode('Execute Workflow with param2'); | ||
|
||
getOutputPanelItemsCount().should('not.exist'); | ||
getOutputPanelRelatedExecutionLink().should('contain.text', 'Inspect Sub-Execution'); | ||
getOutputPanelRelatedExecutionLink().should('have.attr', 'href'); | ||
|
||
// ensure workflow executed but returned same data as input | ||
getOutputRunSelectorInput().should('have.value', '2 of 2 (3 items, 1 sub-execution)'); | ||
getOutputTableHeaders().should('have.length', 6); | ||
getOutputTableHeaders().eq(0).should('have.text', 'uid'); | ||
getOutputTableRows().should('have.length', 4); | ||
getOutputTbodyCell(1, 1).should('include.text', '[email protected]'); | ||
|
||
changeOutputRunSelector('1 of 2 (2 items, 1 sub-execution)'); | ||
getOutputRunSelectorInput().should('have.value', '1 of 2 (2 items, 1 sub-execution)'); | ||
getOutputTableHeaders().should('have.length', 6); | ||
getOutputTableHeaders().eq(0).should('have.text', 'uid'); | ||
getOutputTableRows().should('have.length', 3); | ||
getOutputTbodyCell(1, 1).should('include.text', '[email protected]'); | ||
}); | ||
|
||
it('(Run once for each item/ Wait for Sub-workflow completion)', () => { | ||
openNode('Execute Workflow with param3'); | ||
|
||
// ensure workflow executed but returned same data as input | ||
getOutputRunSelectorInput().should('have.value', '2 of 2 (3 items, 3 sub-executions)'); | ||
getOutputTableHeaders().should('have.length', 7); | ||
getOutputTableHeaders().eq(1).should('have.text', 'uid'); | ||
getOutputTableRows().should('have.length', 4); | ||
getOutputTbodyCell(1, 0).find('a').should('have.attr', 'href'); | ||
getOutputTbodyCell(1, 2).should('include.text', '[email protected]'); | ||
|
||
changeOutputRunSelector('1 of 2 (2 items, 2 sub-executions)'); | ||
getOutputRunSelectorInput().should('have.value', '1 of 2 (2 items, 2 sub-executions)'); | ||
getOutputTableHeaders().should('have.length', 7); | ||
getOutputTableHeaders().eq(1).should('have.text', 'uid'); | ||
getOutputTableRows().should('have.length', 3); | ||
|
||
getOutputTbodyCell(1, 0).find('a').should('have.attr', 'href'); | ||
getOutputTbodyCell(1, 2).should('include.text', '[email protected]'); | ||
}); | ||
}); | ||
|
||
it('can inspect parent executions', () => { | ||
cy.url().then((workflowUrl) => { | ||
openNode('Execute Workflow with param'); | ||
|
||
getOutputPanelItemsCount().should('contain.text', '2 items, 1 sub-execution'); | ||
getOutputPanelRelatedExecutionLink().should('contain.text', 'Inspect Sub-Execution'); | ||
getOutputPanelRelatedExecutionLink().should('have.attr', 'href'); | ||
|
||
// ensure workflow executed and waited on output | ||
getOutputTableHeaders().should('have.length', 2); | ||
getOutputTbodyCell(1, 0).should('have.text', 'world Natalie Moore'); | ||
|
||
// cypress cannot handle new tabs so removing it | ||
getOutputPanelRelatedExecutionLink().invoke('removeAttr', 'target').click(); | ||
|
||
getExecutionsSidebar().should('be.visible'); | ||
getWorkflowExecutionPreviewIframe().should('be.visible'); | ||
openExecutionPreviewNode('Execute Workflow Trigger'); | ||
|
||
getExecutionPreviewOutputPanelRelatedExecutionLink().should( | ||
'include.text', | ||
'Inspect Parent Execution', | ||
); | ||
|
||
getExecutionPreviewOutputPanelRelatedExecutionLink() | ||
.invoke('removeAttr', 'target') | ||
.click({ force: true }); | ||
|
||
cy.url().then((currentUrl) => { | ||
expect(currentUrl === workflowUrl); | ||
}); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.