From feb2ba09b9181fcc7ef191ded2dd596acad2e9d6 Mon Sep 17 00:00:00 2001 From: Mutasem Aldmour <4711238+mutdmour@users.noreply.github.com> Date: Mon, 24 Apr 2023 11:07:32 +0200 Subject: [PATCH] test: Add run linking tests (#6061) * test: Add link/unlink test * test: Add run linking * test: uncomment other tests * test: change click * test: bring back tests, update click * test: fix flaky paired item test * test: update flaky tests * test: add timeouts * test: update import --- cypress/e2e/24-ndv-paired-item.cy.ts | 25 +++++++++-- cypress/e2e/5-ndv.cy.ts | 65 +++++++++++++++++++++++++++- 2 files changed, 85 insertions(+), 5 deletions(-) diff --git a/cypress/e2e/24-ndv-paired-item.cy.ts b/cypress/e2e/24-ndv-paired-item.cy.ts index 133cc808bb..05f5dd8581 100644 --- a/cypress/e2e/24-ndv-paired-item.cy.ts +++ b/cypress/e2e/24-ndv-paired-item.cy.ts @@ -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'); }); @@ -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'); diff --git a/cypress/e2e/5-ndv.cy.ts b/cypress/e2e/5-ndv.cy.ts index c9c82e50fa..749fb4434e 100644 --- a/cypress/e2e/5-ndv.cy.ts +++ b/cypress/e2e/5-ndv.cy.ts @@ -163,5 +163,68 @@ 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.createFixtureWorkflow('Test_workflow_5.json', 'Test'); + workflowPage.actions.zoomToFit(); + workflowPage.actions.executeWorkflow(); + workflowPage.actions.openNode('Set3'); + + ndv.getters.inputRunSelector() + .should('exist') + .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)'); + }); });