Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Add run linking tests #6061

Merged
merged 11 commits into from
Apr 24, 2023
25 changes: 21 additions & 4 deletions cypress/e2e/24-ndv-paired-item.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,20 +103,33 @@ describe('NDV', () => {

ndv.actions.switchInputMode('Table');
ndv.actions.switchOutputMode('Table');
cy.wait(50);

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');
ndv.getters.inputHoveringItem().should('have.text', '1000').realHover();
ndv.getters.backToCanvas().realHover(); // reset to default hover

ndv.getters.inputTableRow(1)
.should('have.text', '1000')
.invoke('attr', 'data-test-id')
.should('equal', 'hovering-item');
ndv.getters.inputTableRow(1).realHover();
cy.wait(50);
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)');
ndv.getters.inputHoveringItem().should('have.text', '1111').realHover();
ndv.getters.backToCanvas().realHover(); // reset to default hover

ndv.getters.inputTableRow(1)
.should('have.text', '1111')
.invoke('attr', 'data-test-id')
.should('equal', 'hovering-item');
ndv.getters.inputTableRow(1).realHover();
cy.wait(50);
ndv.getters.outputHoveringItem().should('have.text', '1111');
ndv.getters.parameterExpressionPreview('value').should('include.text', '1111');
});
Expand Down Expand Up @@ -200,7 +213,11 @@ describe('NDV', () => {
ndv.actions.switchOutputMode('Table');

ndv.getters.backToCanvas().realHover(); // reset to default hover
ndv.getters.inputHoveringItem().should('have.text', '1111').realHover();
ndv.getters.inputTableRow(1)
.should('have.text', '1111')
.invoke('attr', 'data-test-id')
.should('equal', 'hovering-item');
ndv.getters.inputTableRow(1).realHover();
ndv.getters.outputHoveringItem().should('not.exist');
ndv.getters.parameterExpressionPreview('value').should('include.text', '1111');

Expand Down
67 changes: 66 additions & 1 deletion cypress/e2e/5-ndv.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,5 +163,70 @@ describe('NDV', () => {
ndv.getters.outputPanel().find('[class*=_pagination]').should('not.exist');
ndv.getters.outputPanel().find('[data-test-id=run-data-schema-item] [data-test-id=run-data-schema-item]').should('have.length', 20);
})
})
});

it('can link and unlink run selectors between input and output', () => {
cy.fixture('Test_workflow_5.json').then((data) => {
OlegIvaniv marked this conversation as resolved.
Show resolved Hide resolved
cy.get('body').paste(JSON.stringify(data));
});
workflowPage.actions.zoomToFit();
workflowPage.actions.executeWorkflow();
workflowPage.actions.openNode('Set3');

ndv.getters.inputRunSelector()
.should('exist')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary? I think next find should fail if the element is not there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if I understood correctly, this is like a wait until the element exists..

.find('input')
.should('include.value', '2 of 2 (6 items)');
ndv.getters.outputRunSelector()
.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)');
ndv.getters.inputRunSelector()
.find('input')
.should('include.value', '1 of 2 (6 items)');
ndv.getters.inputTbodyCell(1, 0).should('have.text', '1111');
ndv.getters.outputTbodyCell(1, 0).should('have.text', '1111');

ndv.getters.inputTbodyCell(1, 0).click(); // remove tooltip
ndv.actions.changeInputRunSelector('2 of 2 (6 items)');
ndv.getters.outputRunSelector()
.find('input')
.should('include.value', '2 of 2 (6 items)');

// unlink
ndv.actions.toggleOutputRunLinking();
ndv.getters.inputTbodyCell(1, 0).click(); // remove tooltip
ndv.actions.changeOutputRunSelector('1 of 2 (6 items)');
ndv.getters.inputRunSelector()
.should('exist')
.find('input')
.should('include.value', '2 of 2 (6 items)');

// link again
ndv.actions.toggleOutputRunLinking();
ndv.getters.inputTbodyCell(1, 0).click(); // remove tooltip
ndv.getters.inputRunSelector()
.find('input')
.should('include.value', '1 of 2 (6 items)');

// unlink again
ndv.actions.toggleInputRunLinking();
ndv.getters.inputTbodyCell(1, 0).click(); // remove tooltip
ndv.actions.changeInputRunSelector('2 of 2 (6 items)');
ndv.getters.outputRunSelector()
.find('input')
.should('include.value', '1 of 2 (6 items)');

// link again
ndv.actions.toggleInputRunLinking();
ndv.getters.inputTbodyCell(1, 0).click(); // remove tooltip
ndv.getters.outputRunSelector()
.find('input')
.should('include.value', '2 of 2 (6 items)');
});
});