2023-04-21 05:08:51 -07:00
|
|
|
import { WorkflowPage, NDV } from '../pages';
|
|
|
|
import { v4 as uuid } from 'uuid';
|
|
|
|
|
|
|
|
const workflowPage = new WorkflowPage();
|
|
|
|
const ndv = new NDV();
|
|
|
|
|
|
|
|
describe('NDV', () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
workflowPage.actions.visit();
|
|
|
|
workflowPage.actions.renameWorkflow(uuid());
|
|
|
|
workflowPage.actions.saveWorkflowOnButtonClick();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('maps paired input and output items', () => {
|
|
|
|
cy.fixture('Test_workflow_5.json').then((data) => {
|
|
|
|
cy.get('body').paste(JSON.stringify(data));
|
|
|
|
});
|
|
|
|
workflowPage.actions.zoomToFit();
|
|
|
|
|
|
|
|
workflowPage.actions.executeWorkflow();
|
|
|
|
|
|
|
|
workflowPage.actions.openNode('Item Lists');
|
|
|
|
|
|
|
|
ndv.getters.inputPanel().contains('6 items').should('exist');
|
|
|
|
ndv.getters.outputPanel().contains('6 items').should('exist');
|
|
|
|
|
|
|
|
ndv.actions.switchInputMode('Table');
|
|
|
|
ndv.actions.switchOutputMode('Table');
|
|
|
|
|
|
|
|
// input to output
|
2023-08-16 08:13:57 -07:00
|
|
|
ndv.getters.inputTableRow(1).should('exist');
|
2023-07-31 02:55:22 -07:00
|
|
|
|
2023-08-16 08:13:57 -07:00
|
|
|
ndv.getters.inputTableRow(1).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
|
2023-04-21 05:08:51 -07:00
|
|
|
|
2023-07-28 00:51:07 -07:00
|
|
|
ndv.getters.inputTableRow(1).realHover();
|
|
|
|
ndv.getters.outputTableRow(4).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
|
2023-04-21 05:08:51 -07:00
|
|
|
|
2023-07-28 00:51:07 -07:00
|
|
|
ndv.getters.inputTableRow(2).realHover();
|
|
|
|
ndv.getters.outputTableRow(2).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
|
|
|
|
|
|
|
|
ndv.getters.inputTableRow(3).realHover();
|
|
|
|
ndv.getters.outputTableRow(6).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
|
2023-04-21 05:08:51 -07:00
|
|
|
|
|
|
|
// output to input
|
2023-07-28 00:51:07 -07:00
|
|
|
ndv.getters.outputTableRow(1).realHover();
|
|
|
|
ndv.getters.inputTableRow(4).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
|
2023-04-21 05:08:51 -07:00
|
|
|
|
2023-07-28 00:51:07 -07:00
|
|
|
ndv.getters.outputTableRow(4).realHover();
|
|
|
|
ndv.getters.inputTableRow(1).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
|
2023-04-21 05:08:51 -07:00
|
|
|
|
2023-07-28 00:51:07 -07:00
|
|
|
ndv.getters.outputTableRow(2).realHover();
|
|
|
|
ndv.getters.inputTableRow(2).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
|
2023-04-21 05:08:51 -07:00
|
|
|
|
2023-07-28 00:51:07 -07:00
|
|
|
ndv.getters.outputTableRow(6).realHover();
|
|
|
|
ndv.getters.inputTableRow(3).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
|
|
|
|
|
|
|
|
ndv.getters.outputTableRow(1).realHover();
|
|
|
|
ndv.getters.inputTableRow(4).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
|
2023-04-21 05:08:51 -07:00
|
|
|
});
|
|
|
|
|
|
|
|
it('maps paired input and output items based on selected input node', () => {
|
|
|
|
cy.fixture('Test_workflow_5.json').then((data) => {
|
|
|
|
cy.get('body').paste(JSON.stringify(data));
|
|
|
|
});
|
|
|
|
workflowPage.actions.zoomToFit();
|
|
|
|
workflowPage.actions.executeWorkflow();
|
|
|
|
workflowPage.actions.openNode('Set2');
|
|
|
|
|
|
|
|
ndv.getters.inputPanel().contains('6 items').should('exist');
|
2023-07-28 00:51:07 -07:00
|
|
|
ndv.getters
|
|
|
|
.outputRunSelector()
|
|
|
|
.find('input')
|
2023-04-21 05:08:51 -07:00
|
|
|
.should('exist')
|
2023-07-28 00:51:07 -07:00
|
|
|
.should('have.value', '2 of 2 (6 items)');
|
2023-04-21 05:08:51 -07:00
|
|
|
|
|
|
|
ndv.actions.switchInputMode('Table');
|
|
|
|
ndv.actions.switchOutputMode('Table');
|
|
|
|
|
|
|
|
ndv.getters.backToCanvas().realHover(); // reset to default hover
|
|
|
|
ndv.getters.outputHoveringItem().should('not.exist');
|
|
|
|
ndv.getters.parameterExpressionPreview('value').should('include.text', '1111');
|
|
|
|
|
|
|
|
ndv.actions.selectInputNode('Set1');
|
2023-04-24 02:07:32 -07:00
|
|
|
ndv.getters.backToCanvas().realHover(); // reset to default hover
|
|
|
|
|
2023-08-16 08:13:57 -07:00
|
|
|
ndv.getters.inputTableRow(1).should('have.text', '1000');
|
2023-07-31 02:55:22 -07:00
|
|
|
|
2023-08-16 08:13:57 -07:00
|
|
|
ndv.getters.inputTableRow(1).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
|
2023-07-31 02:55:22 -07:00
|
|
|
|
2023-08-16 08:13:57 -07:00
|
|
|
ndv.getters.inputTableRow(1).realHover();
|
2023-04-24 02:07:32 -07:00
|
|
|
cy.wait(50);
|
2023-04-21 05:08:51 -07:00
|
|
|
ndv.getters.outputHoveringItem().should('have.text', '1000');
|
|
|
|
ndv.getters.parameterExpressionPreview('value').should('include.text', '1000');
|
|
|
|
|
|
|
|
ndv.actions.selectInputNode('Item Lists');
|
|
|
|
ndv.actions.changeOutputRunSelector('1 of 2 (6 items)');
|
2023-04-24 02:07:32 -07:00
|
|
|
ndv.getters.backToCanvas().realHover(); // reset to default hover
|
|
|
|
|
2023-08-16 08:13:57 -07:00
|
|
|
ndv.getters.inputTableRow(1).should('have.text', '1111');
|
2023-07-31 02:55:22 -07:00
|
|
|
|
2023-08-16 08:13:57 -07:00
|
|
|
ndv.getters.inputTableRow(1).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
|
2023-04-24 02:07:32 -07:00
|
|
|
ndv.getters.inputTableRow(1).realHover();
|
|
|
|
cy.wait(50);
|
2023-04-21 05:08:51 -07:00
|
|
|
ndv.getters.outputHoveringItem().should('have.text', '1111');
|
|
|
|
ndv.getters.parameterExpressionPreview('value').should('include.text', '1111');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('maps paired input and output items based on selected run', () => {
|
|
|
|
cy.fixture('Test_workflow_5.json').then((data) => {
|
|
|
|
cy.get('body').paste(JSON.stringify(data));
|
|
|
|
});
|
|
|
|
workflowPage.actions.zoomToFit();
|
|
|
|
workflowPage.actions.executeWorkflow();
|
|
|
|
workflowPage.actions.openNode('Set3');
|
|
|
|
|
2023-07-28 00:51:07 -07:00
|
|
|
ndv.getters
|
|
|
|
.inputRunSelector()
|
2023-04-21 05:08:51 -07:00
|
|
|
.should('exist')
|
|
|
|
.find('input')
|
|
|
|
.should('include.value', '2 of 2 (6 items)');
|
2023-07-28 00:51:07 -07:00
|
|
|
ndv.getters
|
|
|
|
.outputRunSelector()
|
2023-04-21 05:08:51 -07:00
|
|
|
.should('exist')
|
|
|
|
.find('input')
|
|
|
|
.should('include.value', '2 of 2 (6 items)');
|
|
|
|
|
|
|
|
ndv.actions.switchInputMode('Table');
|
|
|
|
ndv.actions.switchOutputMode('Table');
|
|
|
|
|
|
|
|
ndv.actions.changeOutputRunSelector('1 of 2 (6 items)');
|
2023-07-28 00:51:07 -07:00
|
|
|
ndv.getters.inputRunSelector().find('input').should('include.value', '1 of 2 (6 items)');
|
|
|
|
ndv.getters.outputRunSelector().find('input').should('include.value', '1 of 2 (6 items)');
|
2023-04-21 05:08:51 -07:00
|
|
|
|
2023-08-16 08:13:57 -07:00
|
|
|
ndv.getters.inputTableRow(1).should('have.text', '1111');
|
|
|
|
ndv.getters.inputTableRow(1).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
|
2023-07-31 02:55:22 -07:00
|
|
|
ndv.getters.outputTableRow(1).should('have.text', '1111');
|
|
|
|
ndv.getters.outputTableRow(1).realHover();
|
|
|
|
|
|
|
|
ndv.getters.outputTableRow(3).should('have.text', '4444');
|
|
|
|
ndv.getters.outputTableRow(3).realHover();
|
2023-04-21 05:08:51 -07:00
|
|
|
|
2023-08-16 08:13:57 -07:00
|
|
|
ndv.getters.inputTableRow(3).should('have.text', '4444');
|
|
|
|
ndv.getters.inputTableRow(3).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
|
2023-04-21 05:08:51 -07:00
|
|
|
|
|
|
|
ndv.actions.changeOutputRunSelector('2 of 2 (6 items)');
|
|
|
|
cy.wait(50);
|
|
|
|
|
2023-07-31 02:55:22 -07:00
|
|
|
ndv.getters.inputTableRow(1).should('have.text', '1000');
|
|
|
|
ndv.getters.inputTableRow(1).realHover();
|
|
|
|
|
2023-08-16 08:13:57 -07:00
|
|
|
ndv.getters.outputTableRow(1).should('have.text', '1000');
|
2023-07-28 00:51:07 -07:00
|
|
|
ndv.getters
|
|
|
|
.outputTableRow(1)
|
2023-04-21 05:08:51 -07:00
|
|
|
.should('have.text', '1000')
|
|
|
|
.invoke('attr', 'data-test-id')
|
|
|
|
.should('equal', 'hovering-item');
|
|
|
|
|
2023-07-31 02:55:22 -07:00
|
|
|
ndv.getters.outputTableRow(3).should('have.text', '2000');
|
|
|
|
ndv.getters.outputTableRow(3).realHover();
|
|
|
|
|
2023-08-16 08:13:57 -07:00
|
|
|
ndv.getters.inputTableRow(3).should('have.text', '2000');
|
2023-07-31 02:55:22 -07:00
|
|
|
|
2023-08-16 08:13:57 -07:00
|
|
|
ndv.getters.inputTableRow(3).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
|
2023-04-21 05:08:51 -07:00
|
|
|
});
|
|
|
|
|
|
|
|
it('resolves expression with default item when input node is not parent, while still pairing items', () => {
|
|
|
|
cy.fixture('Test_workflow_5.json').then((data) => {
|
|
|
|
cy.get('body').paste(JSON.stringify(data));
|
|
|
|
});
|
|
|
|
workflowPage.actions.zoomToFit();
|
|
|
|
workflowPage.actions.executeWorkflow();
|
|
|
|
workflowPage.actions.openNode('Set2');
|
|
|
|
|
|
|
|
ndv.getters.inputPanel().contains('6 items').should('exist');
|
2023-07-28 00:51:07 -07:00
|
|
|
ndv.getters
|
|
|
|
.outputRunSelector()
|
|
|
|
.find('input')
|
2023-04-21 05:08:51 -07:00
|
|
|
.should('exist')
|
2023-07-28 00:51:07 -07:00
|
|
|
.should('have.value', '2 of 2 (6 items)');
|
2023-04-21 05:08:51 -07:00
|
|
|
|
|
|
|
ndv.actions.switchInputMode('Table');
|
|
|
|
ndv.actions.switchOutputMode('Table');
|
|
|
|
|
|
|
|
ndv.getters.backToCanvas().realHover(); // reset to default hover
|
2023-08-16 08:13:57 -07:00
|
|
|
ndv.getters.inputTableRow(1).should('have.text', '1111');
|
2023-07-31 02:55:22 -07:00
|
|
|
|
2023-08-16 08:13:57 -07:00
|
|
|
ndv.getters.inputTableRow(1).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
|
2023-04-24 02:07:32 -07:00
|
|
|
ndv.getters.inputTableRow(1).realHover();
|
2023-04-21 05:08:51 -07:00
|
|
|
ndv.getters.outputHoveringItem().should('not.exist');
|
|
|
|
ndv.getters.parameterExpressionPreview('value').should('include.text', '1111');
|
|
|
|
|
|
|
|
ndv.actions.selectInputNode('Code1');
|
|
|
|
ndv.getters.inputTableRow(1).realHover();
|
2023-08-16 08:13:57 -07:00
|
|
|
ndv.getters.inputTableRow(1).should('have.text', '1000');
|
2023-07-31 02:55:22 -07:00
|
|
|
|
2023-08-16 08:13:57 -07:00
|
|
|
ndv.getters.inputTableRow(1).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
|
2023-07-28 00:51:07 -07:00
|
|
|
ndv.getters.outputTableRow(1).should('have.text', '1000');
|
2023-04-21 05:08:51 -07:00
|
|
|
ndv.getters.parameterExpressionPreview('value').should('include.text', '1000');
|
|
|
|
|
|
|
|
ndv.actions.selectInputNode('Code');
|
|
|
|
|
|
|
|
ndv.getters.inputTableRow(1).realHover();
|
2023-08-16 08:13:57 -07:00
|
|
|
ndv.getters.inputTableRow(1).should('have.text', '6666');
|
2023-07-31 02:55:22 -07:00
|
|
|
|
2023-08-16 08:13:57 -07:00
|
|
|
ndv.getters.inputTableRow(1).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
|
2023-07-31 02:55:22 -07:00
|
|
|
|
2023-04-21 05:08:51 -07:00
|
|
|
ndv.getters.outputHoveringItem().should('not.exist');
|
|
|
|
ndv.getters.parameterExpressionPreview('value').should('include.text', '1000');
|
|
|
|
|
|
|
|
ndv.actions.selectInputNode('When clicking');
|
|
|
|
|
|
|
|
ndv.getters.inputTableRow(1).realHover();
|
2023-07-28 00:51:07 -07:00
|
|
|
ndv.getters
|
|
|
|
.inputTableRow(1)
|
|
|
|
.should('have.text', "This is an item, but it's empty.")
|
|
|
|
.realHover();
|
2023-07-31 02:55:22 -07:00
|
|
|
|
2023-04-21 05:08:51 -07:00
|
|
|
ndv.getters.outputHoveringItem().should('have.length', 6);
|
|
|
|
ndv.getters.parameterExpressionPreview('value').should('include.text', '1000');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('can pair items between input and output across branches and runs', () => {
|
|
|
|
cy.fixture('Test_workflow_5.json').then((data) => {
|
|
|
|
cy.get('body').paste(JSON.stringify(data));
|
|
|
|
});
|
|
|
|
workflowPage.actions.zoomToFit();
|
|
|
|
workflowPage.actions.executeWorkflow();
|
|
|
|
workflowPage.actions.openNode('IF');
|
|
|
|
|
|
|
|
ndv.actions.switchInputMode('Table');
|
|
|
|
ndv.actions.switchOutputMode('Table');
|
|
|
|
|
|
|
|
ndv.actions.switchOutputBranch('False Branch (2 items)');
|
2023-07-31 02:55:22 -07:00
|
|
|
ndv.getters.outputTableRow(1).should('have.text', '8888');
|
|
|
|
ndv.getters.outputTableRow(1).realHover();
|
|
|
|
|
2023-08-16 08:13:57 -07:00
|
|
|
ndv.getters.inputTableRow(5).should('have.text', '8888');
|
2023-07-31 02:55:22 -07:00
|
|
|
|
2023-08-16 08:13:57 -07:00
|
|
|
ndv.getters.inputTableRow(5).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
|
2023-04-21 05:08:51 -07:00
|
|
|
|
2023-07-31 02:55:22 -07:00
|
|
|
ndv.getters.outputTableRow(2).should('have.text', '9999');
|
|
|
|
ndv.getters.outputTableRow(2).realHover();
|
|
|
|
|
2023-08-16 08:13:57 -07:00
|
|
|
ndv.getters.inputTableRow(6).should('have.text', '9999');
|
2023-07-31 02:55:22 -07:00
|
|
|
|
2023-08-16 08:13:57 -07:00
|
|
|
ndv.getters.inputTableRow(6).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
|
2023-04-21 05:08:51 -07:00
|
|
|
|
|
|
|
ndv.actions.close();
|
2023-06-19 10:32:11 -07:00
|
|
|
|
2023-04-21 05:08:51 -07:00
|
|
|
workflowPage.actions.openNode('Set5');
|
2023-06-19 10:32:11 -07:00
|
|
|
|
|
|
|
ndv.actions.switchInputBranch('True Branch');
|
2023-07-28 00:51:07 -07:00
|
|
|
ndv.actions.changeOutputRunSelector('1 of 2 (2 items)');
|
2023-08-16 08:13:57 -07:00
|
|
|
ndv.getters.outputTableRow(1).should('have.text', '8888');
|
2023-07-31 02:55:22 -07:00
|
|
|
ndv.getters.outputTableRow(1).realHover();
|
|
|
|
cy.wait(100);
|
2023-04-21 05:08:51 -07:00
|
|
|
ndv.getters.inputHoveringItem().should('not.exist');
|
|
|
|
|
2023-08-16 08:13:57 -07:00
|
|
|
ndv.getters.inputTableRow(1).should('have.text', '1111');
|
2023-07-31 02:55:22 -07:00
|
|
|
ndv.getters.inputTableRow(1).realHover();
|
|
|
|
cy.wait(100);
|
2023-04-21 05:08:51 -07:00
|
|
|
ndv.getters.outputHoveringItem().should('not.exist');
|
|
|
|
|
2023-06-19 10:32:11 -07:00
|
|
|
ndv.actions.switchInputBranch('False Branch');
|
2023-07-31 02:55:22 -07:00
|
|
|
ndv.getters.inputTableRow(1).should('have.text', '8888');
|
|
|
|
ndv.getters.inputTableRow(1).realHover();
|
2023-04-21 05:08:51 -07:00
|
|
|
|
2023-07-28 00:51:07 -07:00
|
|
|
ndv.actions.changeOutputRunSelector('2 of 2 (4 items)');
|
2023-07-31 02:55:22 -07:00
|
|
|
ndv.getters.outputTableRow(1).should('have.text', '1111');
|
|
|
|
ndv.getters.outputTableRow(1).realHover();
|
2023-06-19 10:32:11 -07:00
|
|
|
|
2023-07-28 00:51:07 -07:00
|
|
|
ndv.actions.changeOutputRunSelector('1 of 2 (2 items)');
|
2023-07-31 02:55:22 -07:00
|
|
|
ndv.getters.inputTableRow(1).should('have.text', '8888');
|
|
|
|
ndv.getters.inputTableRow(1).realHover();
|
2023-06-19 10:32:11 -07:00
|
|
|
ndv.getters.outputHoveringItem().should('have.text', '8888');
|
2023-04-21 05:08:51 -07:00
|
|
|
// todo there's a bug here need to fix ADO-534
|
|
|
|
// ndv.getters.outputHoveringItem().should('not.exist');
|
|
|
|
});
|
|
|
|
});
|