diff --git a/cypress/e2e/09-step_actions_from_canvas/step_actions_from_canvas.cy.js b/cypress/e2e/09-step_actions_from_canvas/step_actions_from_canvas.cy.js index 2f282b1a3..11a3f715b 100644 --- a/cypress/e2e/09-step_actions_from_canvas/step_actions_from_canvas.cy.js +++ b/cypress/e2e/09-step_actions_from_canvas/step_actions_from_canvas.cy.js @@ -3,7 +3,7 @@ describe('Test for Step actions from the canvas', () => { cy.intercept('/v1/deployments*').as('getDeployments'); cy.intercept('/v1/integrations/dsls').as('getDSLs'); cy.intercept('/v1/view-definitions').as('getViewDefinitions'); - cy.intercept('/v2/integrations*').as('getIntegration'); + cy.intercept('POST', '/v2/integrations*').as('getIntegration'); cy.openHomePage(); cy.uploadFixture('TimerLogCamelRoute.yaml'); @@ -50,7 +50,7 @@ describe('Test for Step actions from the canvas', () => { // CHECK that YAML not contains the 'timer:null' cy.get('.code-editor').should('not.contain.text', 'timer:null'); - cy.syncUpCodeChanges(); + cy.waitAndsyncUpCodeChanges() // CHECK that the step is deleted cy.get('[data-testid="viz-step-timer"]').should('not.exist'); @@ -78,7 +78,7 @@ describe('Test for Step actions from the canvas', () => { // CHECK that YAML not contains the 'timer:null' cy.get('.code-editor').should('not.contain.text', 'timer:null'); - cy.syncUpCodeChanges(); + cy.waitAndsyncUpCodeChanges() // CHECK that the step is deleted cy.get('[data-testid="viz-step-timer"]').should('not.exist'); @@ -107,7 +107,7 @@ describe('Test for Step actions from the canvas', () => { // CHECK that YAML not contains the 'timer:null' cy.get('.code-editor').should('not.contain.text', 'timer:null'); - cy.syncUpCodeChanges(); + cy.waitAndsyncUpCodeChanges() // CHECK that the step is deleted cy.get('[data-testid="viz-step-timer"]').should('not.exist'); @@ -123,7 +123,13 @@ describe('Test for Step actions from the canvas', () => { it('User appends a step(+ button to the right of the node)', () => { cy.deleteStep('log'); + //Wait for backend sync + cy.wait('@getIntegration'); + cy.wait('@getViewDefinitions'); cy.appendStepMiniCatalog('timer', 'aggregate'); + //Wait for backend sync + cy.wait('@getIntegration'); + cy.wait('@getViewDefinitions'); cy.appendStepMiniCatalog('aggregate', 'log', 'end'); // CHECK that stepNodes are in the correct order @@ -134,7 +140,7 @@ describe('Test for Step actions from the canvas', () => { cy.get('.stepNode').should('have.length', 3); // CHECK YAML contains the 'aggregate: {}' cy.checkCodeSpanLine('aggregate: {}'); - cy.syncUpCodeChanges(); + cy.waitAndsyncUpCodeChanges() // CHECK that stepNodes are in the correct order cy.get('.stepNode').eq(0).should('have.attr', 'data-testid', 'viz-step-timer'); @@ -172,9 +178,15 @@ describe('Test for Step actions from the canvas', () => { cy.get('[data-testid="kaoto-right-drawer"]').should('be.visible'); cy.deleteStep('log'); + //Wait for backend sync + cy.wait('@getIntegration'); + cy.wait('@getViewDefinitions'); cy.get('[data-testid="kaoto-right-drawer"]').should('not.be.visible'); cy.openStepConfigurationTab('timer'); + //Wait for backend sync + cy.wait('@getIntegration'); + cy.wait('@getViewDefinitions'); cy.get('[data-testid="kaoto-right-drawer"]').should('be.visible'); cy.deleteStep('choice'); cy.get('[data-testid="kaoto-right-drawer"]').should('be.visible'); diff --git a/cypress/e2e/10-branching_actions_from_canvas/branches_from_canvas.cy.js b/cypress/e2e/10-branching_actions_from_canvas/branches_from_canvas.cy.js index 948dc4af3..372fd6386 100644 --- a/cypress/e2e/10-branching_actions_from_canvas/branches_from_canvas.cy.js +++ b/cypress/e2e/10-branching_actions_from_canvas/branches_from_canvas.cy.js @@ -3,7 +3,7 @@ describe('Test for Branching actions from the canvas', () => { cy.intercept('/v1/deployments*').as('getDeployments'); cy.intercept('/v1/integrations/dsls').as('getDSLs'); cy.intercept('/v1/view-definitions').as('getViewDefinitions'); - cy.intercept('/v2/integrations*').as('getIntegration'); + cy.intercept('POST', '/v2/integrations*').as('getIntegration'); cy.openHomePage(); cy.uploadFixture('EipAction.yaml'); @@ -30,7 +30,7 @@ describe('Test for Branching actions from the canvas', () => { cy.get('[data-testid="viz-step-slot"]').should('have.length', 1); cy.get('.stepNode').eq(10).should('have.attr', 'data-testid', 'viz-step-slot'); - cy.syncUpCodeChanges() + cy.waitAndsyncUpCodeChanges() // CHECK after Sync your code button click cy.get('[data-testid="viz-step-choice"]').should('have.length', 2); @@ -46,7 +46,7 @@ describe('Test for Branching actions from the canvas', () => { cy.get('.stepNode').eq(11).should('have.attr', 'data-testid', 'viz-step-kamelet:sink'); cy.get('.code-editor').should('not.contain.text', '{{?bar}}') - cy.syncUpCodeChanges() + cy.waitAndsyncUpCodeChanges() // CHECK after Sync your code button click cy.get('[data-testid="viz-step-marshal"]').should('not.exist'); @@ -90,7 +90,7 @@ describe('Test for Branching actions from the canvas', () => { cy.get('.stepNode').eq(6).should('have.attr', 'data-testid', 'viz-step-activemq'); cy.get('[data-testid="viz-step-activemq"]').should('be.visible'); - cy.syncUpCodeChanges() + cy.waitAndsyncUpCodeChanges() // CHECK after Sync your code button click cy.get('.stepNode').eq(4).should('have.attr', 'data-testid', 'viz-step-digitalocean'); @@ -108,7 +108,7 @@ describe('Test for Branching actions from the canvas', () => { cy.get('.stepNode').eq(6).should('have.attr', 'data-testid', 'viz-step-set-header'); cy.get('[data-testid="viz-step-activemq"]').should('be.visible'); - cy.syncUpCodeChanges() + cy.waitAndsyncUpCodeChanges() // CHECK after Sync your code button click cy.get('.stepNode').eq(4).should('have.attr', 'data-testid', 'viz-step-activemq'); @@ -129,7 +129,7 @@ describe('Test for Branching actions from the canvas', () => { cy.get('.stepNode').eq(13).should('have.attr', 'data-testid', 'viz-step-filter'); cy.get('[data-testid="viz-step-activemq"]').should('be.visible'); - cy.syncUpCodeChanges() + cy.waitAndsyncUpCodeChanges() // CHECK after Sync your code button click cy.get('.stepNode').eq(5).should('have.attr', 'data-testid', 'viz-step-set-header'); diff --git a/cypress/e2e/10-branching_actions_from_canvas/branches_step_actions_from_canvas.cy.js b/cypress/e2e/10-branching_actions_from_canvas/branches_step_actions_from_canvas.cy.js index 3469e58ca..7847001d1 100644 --- a/cypress/e2e/10-branching_actions_from_canvas/branches_step_actions_from_canvas.cy.js +++ b/cypress/e2e/10-branching_actions_from_canvas/branches_step_actions_from_canvas.cy.js @@ -23,9 +23,9 @@ describe('User completes normal actions on steps in a branch', () => { cy.checkCodeSpanLine('oAuthToken: token'); }); - it(' User deletes a step in a branch', () => { + it('User deletes a step in a branch', () => { cy.deleteStep('digitalocean'); - cy.syncUpCodeChanges(); + cy.waitAndsyncUpCodeChanges(); // CHECK that digitalocean step is deleted cy.get('[data-testid="viz-step-digitalocean"]').should('not.exist'); diff --git a/cypress/e2e/10-branching_actions_from_canvas/nested_branches_from_canvas.cy.js b/cypress/e2e/10-branching_actions_from_canvas/nested_branches_from_canvas.cy.js index 8855badc4..66ba751cb 100644 --- a/cypress/e2e/10-branching_actions_from_canvas/nested_branches_from_canvas.cy.js +++ b/cypress/e2e/10-branching_actions_from_canvas/nested_branches_from_canvas.cy.js @@ -3,7 +3,7 @@ describe('Test for Nested Branching actions from the canvas', () => { cy.intercept('/v1/deployments*').as('getDeployments'); cy.intercept('/v1/integrations/dsls').as('getDSLs'); cy.intercept('/v1/view-definitions').as('getViewDefinitions'); - cy.intercept('/v2/integrations*').as('getIntegration'); + cy.intercept('POST', '/v2/integrations*').as('getIntegration'); cy.openHomePage(); cy.uploadFixture('EipAction.yaml'); @@ -69,7 +69,7 @@ describe('Test for Nested Branching actions from the canvas', () => { cy.get('.stepNode').eq(9).should('have.attr', 'data-testid', 'viz-step-slot'); cy.get('.stepNode').eq(10).should('have.attr', 'data-testid', 'viz-step-log'); - cy.syncUpCodeChanges() + cy.waitAndsyncUpCodeChanges() // CHECK after Sync your code button click cy.get('.stepNode').eq(9).should('have.attr', 'data-testid', 'viz-step-slot'); @@ -94,7 +94,6 @@ describe('Test for Nested Branching actions from the canvas', () => { // CHECK test setup cy.get('.stepNode').eq(9).should('have.attr', 'data-testid', 'viz-step-amqp'); cy.get('.stepNode').eq(10).should('have.attr', 'data-testid', 'viz-step-slot'); - cy.appendStepMiniCatalog('amqp', 'activemq'); // CHECK that there are activemq->amqp in the nested branch and second branch step is slot @@ -102,7 +101,7 @@ describe('Test for Nested Branching actions from the canvas', () => { cy.get('.stepNode').eq(10).should('have.attr', 'data-testid', 'viz-step-activemq'); cy.get('.stepNode').eq(11).should('have.attr', 'data-testid', 'viz-step-slot'); - cy.syncUpCodeChanges() + cy.waitAndsyncUpCodeChanges() // CHECK after Sync your code button click cy.get('.stepNode').eq(9).should('have.attr', 'data-testid', 'viz-step-amqp'); @@ -127,8 +126,7 @@ describe('Test for Nested Branching actions from the canvas', () => { // CHECK test setup cy.get('.stepNode').eq(9).should('have.attr', 'data-testid', 'viz-step-amqp'); - cy.get('.stepNode').eq(10).should('have.attr', 'data-testid', 'viz-step-slot'); - + cy.get('.stepNode').eq(10).should('have.attr', 'data-testid', 'viz-step-slot'); cy.prependStepMiniCatalog('amqp', 'activemq'); // CHECK that there are amqp->activemq in the nested branch and second branch step is slot @@ -136,7 +134,7 @@ describe('Test for Nested Branching actions from the canvas', () => { cy.get('.stepNode').eq(10).should('have.attr', 'data-testid', 'viz-step-amqp'); cy.get('.stepNode').eq(11).should('have.attr', 'data-testid', 'viz-step-slot'); - cy.syncUpCodeChanges() + cy.waitAndsyncUpCodeChanges() // CHECK after Sync your code button click cy.get('.stepNode').eq(9).should('have.attr', 'data-testid', 'viz-step-activemq'); @@ -160,7 +158,8 @@ describe('Test for Nested Branching actions from the canvas', () => { // CHECK test setup cy.get('.stepNode').eq(9).should('have.attr', 'data-testid', 'viz-step-slot'); cy.get('.stepNode').eq(10).should('have.attr', 'data-testid', 'viz-step-slot'); - + cy.wait('@getIntegration'); + cy.wait('@getViewDefinitions'); cy.prependStepMiniCatalog('log', 'activemq'); // CHECK that the activemq step was prepended before filter and after all the branches ends @@ -170,7 +169,7 @@ describe('Test for Nested Branching actions from the canvas', () => { cy.get('.stepNode').eq(12).should('have.attr', 'data-testid', 'viz-step-log'); cy.get('[data-testid="viz-step-activemq"]').should('be.visible'); - cy.syncUpCodeChanges() + cy.waitAndsyncUpCodeChanges() // CHECK after Sync your code button click cy.get('.stepNode').eq(9).should('have.attr', 'data-testid', 'viz-step-slot'); diff --git a/cypress/e2e/10-branching_actions_from_canvas/nested_branches_step_actions_from_canvas.cy.js b/cypress/e2e/10-branching_actions_from_canvas/nested_branches_step_actions_from_canvas.cy.js index c0acb4a19..435ba26ac 100644 --- a/cypress/e2e/10-branching_actions_from_canvas/nested_branches_step_actions_from_canvas.cy.js +++ b/cypress/e2e/10-branching_actions_from_canvas/nested_branches_step_actions_from_canvas.cy.js @@ -4,7 +4,7 @@ describe('User completes normal actions on steps in a branch', () => { cy.intercept('/v1/steps/id/*').as('getStepDetails'); cy.intercept('/v1/integrations/dsls').as('getDSLs'); cy.intercept('/v1/view-definitions').as('getViewDefinitions'); - cy.intercept('/v2/integrations*').as('getIntegration'); + cy.intercept('POST', '/v2/integrations*').as('getIntegration'); cy.openHomePage(); cy.uploadFixture('EipAction.yaml'); @@ -42,7 +42,7 @@ describe('User completes normal actions on steps in a branch', () => { cy.get('[data-testid="viz-step-amqp"]').should('not.exist'); cy.get('[data-testid="viz-step-slot"]').should('have.length', 2).and('be.visible'); - cy.syncUpCodeChanges(); + cy.waitAndsyncUpCodeChanges() // CHECK that amqp step is deleted and empty step is added cy.get('[data-testid="viz-step-amqp"]').should('not.exist'); diff --git a/cypress/support/kaoto-ui-commands/editor.js b/cypress/support/kaoto-ui-commands/editor.js index 56f624c55..3f11b54bd 100644 --- a/cypress/support/kaoto-ui-commands/editor.js +++ b/cypress/support/kaoto-ui-commands/editor.js @@ -56,6 +56,12 @@ Cypress.Commands.add('syncUpCodeChanges', () => { cy.wait('@getViewDefinitions'); }); +Cypress.Commands.add('waitAndsyncUpCodeChanges', () => { + cy.wait('@getIntegration'); + cy.wait('@getViewDefinitions'); + cy.syncUpCodeChanges(); +}); + Cypress.Commands.add('checkCodeSpanLine', (spanText, linesCount) => { linesCount = linesCount ?? 1; cy.get('.code-editor') diff --git a/cypress/support/kaoto-ui-commands/steps.js b/cypress/support/kaoto-ui-commands/steps.js index f22b60ef3..94cdbe033 100644 --- a/cypress/support/kaoto-ui-commands/steps.js +++ b/cypress/support/kaoto-ui-commands/steps.js @@ -65,7 +65,8 @@ Cypress.Commands.add('deleteStep', (step, stepIndex) => { /** Delete the given step */ cy.get(`[data-testid="viz-step-${step}"]`).eq(stepIndex).trigger('mouseover').children('[data-testid="configurationTab__deleteBtn"]').click({ force: true }); - cy.waitVisualizationUpdate(); + cy.wait('@getIntegration'); + cy.wait('@getViewDefinitions'); /** Check whether the given step was removed */ cy.get(`[data-testid="viz-step-${step}"]`).should('have.length.lessThan', previousStepsCount);