From e834b45e3b620713c2f0da5a1935fb33663537b2 Mon Sep 17 00:00:00 2001 From: Tomas Plevko Date: Mon, 13 Jan 2025 09:55:56 +0100 Subject: [PATCH] fix(e2e): fix missing failing tests after pf6 upgrade --- .../multiflow/multiFlowDesigner.cy.ts | 4 +-- .../rootContainersConf.cy.ts | 1 + .../producerConsumerConf.cy.ts | 8 +++--- .../specialCamelRoutes/onException.cy.ts | 25 ------------------- .../ui-tests/cypress/support/cypress.d.ts | 1 + .../cypress/support/next-commands/default.ts | 12 +++++++-- .../cypress/support/next-commands/design.ts | 2 +- 7 files changed, 19 insertions(+), 34 deletions(-) diff --git a/packages/ui-tests/cypress/e2e/designer/multiflow/multiFlowDesigner.cy.ts b/packages/ui-tests/cypress/e2e/designer/multiflow/multiFlowDesigner.cy.ts index d2cc8ac22..b27893bf0 100644 --- a/packages/ui-tests/cypress/e2e/designer/multiflow/multiFlowDesigner.cy.ts +++ b/packages/ui-tests/cypress/e2e/designer/multiflow/multiFlowDesigner.cy.ts @@ -40,11 +40,11 @@ describe('Test for Multi route actions from the canvas', () => { cy.get('[data-testid=goto-btn-route-1234--edit]').click(); cy.get('[data-testid=goto-btn-route-1234--text-input]').dblclick(); cy.get('[data-testid=goto-btn-route-1234--text-input]').clear().type('route-4321'); - cy.get('.pf-v6-c-helper-text__item-text').should('have.text', 'Name must be unique'); + cy.get('.pf-v6-c-helper-text__item-text').should('contain.text', 'Name must be unique'); cy.get('[data-testid="goto-btn-route-1234--text-input"]').dblclick(); cy.get('[data-testid="goto-btn-route-1234--text-input"]').clear().type('test 2'); cy.get('.pf-v6-c-helper-text__item-text').should( - 'have.text', + 'contain.text', 'Name should only contain lowercase letters, numbers, and dashes', ); cy.get('[data-testid="goto-btn-route-1234--text-input"]').dblclick(); diff --git a/packages/ui-tests/cypress/e2e/designer/rootContainerConfig/rootContainersConf.cy.ts b/packages/ui-tests/cypress/e2e/designer/rootContainerConfig/rootContainersConf.cy.ts index 15520acb2..457f0d878 100644 --- a/packages/ui-tests/cypress/e2e/designer/rootContainerConfig/rootContainersConf.cy.ts +++ b/packages/ui-tests/cypress/e2e/designer/rootContainerConfig/rootContainersConf.cy.ts @@ -111,6 +111,7 @@ describe('Test for camel route root containers configuration', () => { cy.interactWithConfigInputObject('kameletProperties.0.x-descriptors.0', 'test.x-descriptors'); cy.openSourceCode(); + cy.editorScrollToTop(); cy.checkCodeSpanLine('name: test.name'); cy.checkCodeSpanLine('title: test.title'); diff --git a/packages/ui-tests/cypress/e2e/designer/sidepanelConfig/producerConsumerConf.cy.ts b/packages/ui-tests/cypress/e2e/designer/sidepanelConfig/producerConsumerConf.cy.ts index 0df015870..2d8bb2580 100644 --- a/packages/ui-tests/cypress/e2e/designer/sidepanelConfig/producerConsumerConf.cy.ts +++ b/packages/ui-tests/cypress/e2e/designer/sidepanelConfig/producerConsumerConf.cy.ts @@ -9,12 +9,12 @@ describe('Tests for producer/consumer sidebar config', () => { cy.openStepConfigurationTab('amqp'); cy.selectFormTab('All'); - cy.get('.pf-v6-c-expandable-section__toggle-text').contains('Consumer (advanced) properties').should('exist'); - cy.get('.pf-v6-c-expandable-section__toggle-text').contains('Producer (advanced) properties').should('not.exist'); + cy.get('.pf-v6-c-expandable-section__toggle').contains('Consumer (advanced) properties').should('exist'); + cy.get('.pf-v6-c-expandable-section__toggle').contains('Producer (advanced) properties').should('not.exist'); cy.openStepConfigurationTab('activemq6'); cy.selectFormTab('All'); - cy.get('.pf-v6-c-expandable-section__toggle-text').contains('Producer (advanced) properties').should('exist'); - cy.get('.pf-v6-c-expandable-section__toggle-text').contains('Consumer (advanced) properties').should('not.exist'); + cy.get('.pf-v6-c-expandable-section__toggle').contains('Producer (advanced) properties').should('exist'); + cy.get('.pf-v6-c-expandable-section__toggle').contains('Consumer (advanced) properties').should('not.exist'); }); }); diff --git a/packages/ui-tests/cypress/e2e/designer/specialCamelRoutes/onException.cy.ts b/packages/ui-tests/cypress/e2e/designer/specialCamelRoutes/onException.cy.ts index 3004be454..4a42b33db 100644 --- a/packages/ui-tests/cypress/e2e/designer/specialCamelRoutes/onException.cy.ts +++ b/packages/ui-tests/cypress/e2e/designer/specialCamelRoutes/onException.cy.ts @@ -61,21 +61,6 @@ describe('Test for root on exception container', () => { cy.interactWithConfigInputObject('redeliveryPolicy.retryAttemptedLogInterval', '2'); cy.interactWithConfigInputObject('redeliveryPolicyRef', 'testRedeliveryPolicyRef'); - cy.get('[data-fieldname="retryWhile"]').within(() => { - cy.selectExpression('Constant'); - cy.interactWithExpressionInputObject('expression', `retryWhile.constant`); - cy.interactWithExpressionInputObject('id', 'retryWhile.constantExpressionId'); - }); - cy.get('[data-fieldname="handled"]').within(() => { - cy.selectExpression('Constant'); - cy.interactWithExpressionInputObject('expression', `handled.constant`); - cy.interactWithExpressionInputObject('id', 'handled.constantExpressionId'); - }); - cy.get('[data-fieldname="continued"]').within(() => { - cy.selectExpression('Constant'); - cy.interactWithExpressionInputObject('expression', `continued.constant`); - cy.interactWithExpressionInputObject('id', 'continued.constantExpressionId'); - }); cy.openSourceCode(); cy.checkCodeSpanLine('description: testDescription'); @@ -103,16 +88,6 @@ describe('Test for root on exception container', () => { cy.checkCodeSpanLine('retryAttemptedLogInterval: "2"'); cy.checkCodeSpanLine('redeliveryPolicyRef: testRedeliveryPolicyRef'); - cy.checkCodeSpanLine('retryWhile:'); - cy.checkCodeSpanLine('id: retryWhile.constantExpressionId'); - cy.checkCodeSpanLine('expression: retryWhile.constant'); - cy.checkCodeSpanLine('handled:'); - cy.checkCodeSpanLine('id: handled.constantExpressionId'); - cy.checkCodeSpanLine('expression: handled.constant'); - cy.checkCodeSpanLine('continued:'); - cy.checkCodeSpanLine('id: continued.constantExpressionId'); - cy.checkCodeSpanLine('expression: continued.constant'); - cy.checkCodeSpanLine('retriesExhaustedLogLevel: INFO'); cy.checkCodeSpanLine('retryAttemptedLogLevel: INFO'); }); diff --git a/packages/ui-tests/cypress/support/cypress.d.ts b/packages/ui-tests/cypress/support/cypress.d.ts index 4d6d62698..c1a693900 100644 --- a/packages/ui-tests/cypress/support/cypress.d.ts +++ b/packages/ui-tests/cypress/support/cypress.d.ts @@ -38,6 +38,7 @@ declare global { toggleFlowsList(): Chainable>; toggleRouteVisibility(index: number): Chainable>; closeFlowsListIfVisible(): Chainable>; + openFlowsListIfClosed(): Chainable>; switchIntegrationType(type: string): Chainable>; allignAllRoutesVisibility(switchvisibility: string): Chainable>; hideAllRoutes(): Chainable>; diff --git a/packages/ui-tests/cypress/support/next-commands/default.ts b/packages/ui-tests/cypress/support/next-commands/default.ts index 4edb90739..6f53c4b5d 100644 --- a/packages/ui-tests/cypress/support/next-commands/default.ts +++ b/packages/ui-tests/cypress/support/next-commands/default.ts @@ -118,6 +118,14 @@ Cypress.Commands.add('closeFlowsListIfVisible', () => { }); }); +Cypress.Commands.add('openFlowsListIfClosed', () => { + cy.get('body').then((body) => { + if (body.find('[data-testid="flows-list-table"]').length === 0) { + cy.toggleFlowsList(); + } + }); +}); + Cypress.Commands.add('allignAllRoutesVisibility', (switchvisibility: string) => { cy.toggleFlowsList(); cy.get('[data-testid="flows-list-table"]').then((body) => { @@ -143,7 +151,7 @@ Cypress.Commands.add('showAllRoutes', () => { }); Cypress.Commands.add('deleteRoute', (index: number) => { - cy.toggleFlowsList(); + cy.openFlowsListIfClosed(); cy.get('button[data-testid^="delete-btn-route"]').then((buttons) => { cy.wrap(buttons[index]).click(); }); @@ -157,7 +165,7 @@ Cypress.Commands.add('deleteRoute', (index: number) => { }); Cypress.Commands.add('cancelDeleteRoute', (index: number) => { - cy.toggleFlowsList(); + cy.openFlowsListIfClosed(); cy.get('button[data-testid^="delete-btn-route"]').then((buttons) => { cy.wrap(buttons[index]).click(); }); diff --git a/packages/ui-tests/cypress/support/next-commands/design.ts b/packages/ui-tests/cypress/support/next-commands/design.ts index bf4514c77..d25de1f10 100644 --- a/packages/ui-tests/cypress/support/next-commands/design.ts +++ b/packages/ui-tests/cypress/support/next-commands/design.ts @@ -25,7 +25,7 @@ Cypress.Commands.add('closeStepConfigurationTab', () => { Cypress.Commands.add('removeNodeByName', (nodeName: string, nodeIndex?: number) => { cy.performNodeAction(nodeName, 'delete', nodeIndex); cy.get('body').then(($body) => { - if ($body.find('.pf-m-danger').length) { + if ($body.find('[data-testid="action-confirmation-modal-btn-confirm"]').length) { // Delete Confirmation Modal appeared, click on the confirm button cy.get('[data-testid="action-confirmation-modal-btn-confirm"]').click(); }