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

e2e - add missing tests for special form fields #912

Merged
merged 1 commit into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ describe('User completes normal actions on steps in a branch', () => {
cy.openDesignPage();

cy.selectReplaceNode('digitalocean');
cy.get('.pf-v5-c-text-input-group__text-input').click();
cy.get('.pf-v5-c-text-input-group__text-input').type('amqp');
cy.get('#amqp').should('be.visible').click();
cy.chooseFromCatalog('component', 'amqp');

// CHECK that digitalocean step is deleted
cy.checkNodeExist('digitalocean', 0);
Expand Down
20 changes: 5 additions & 15 deletions packages/ui-tests/cypress/e2e/designer/branchingStepAddition.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,8 @@ describe('Test for Branching actions from the canvas', () => {
cy.openDesignPage();

cy.selectAppendNode('marshal');
cy.get('[data-testid="processor-catalog-tab"]').click();
cy.get('.pf-v5-c-text-input-group__text-input').click();
cy.get('.pf-v5-c-text-input-group__text-input').type('choice');
cy.get('#choice').should('be.visible').click();
// wait for the canvas rerender
cy.wait(1000);
cy.chooseFromCatalog('processor', 'choice');

cy.checkNodeExist('choice', 1);
cy.checkNodeExist('when', 1);
cy.checkNodeExist('otherwise', 1);
Expand All @@ -62,9 +58,7 @@ describe('Test for Branching actions from the canvas', () => {

cy.checkNodeExist('setHeader', 1);
cy.selectAppendNode('setHeader');
cy.get('.pf-v5-c-text-input-group__text-input').click();
cy.get('.pf-v5-c-text-input-group__text-input').type('activemq');
cy.get('#activemq').should('be.visible').click();
cy.chooseFromCatalog('component', 'activemq');

cy.checkNodeExist('activemq', 1);
cy.checkEdgeExists('setHeader', 'activemq');
Expand All @@ -76,9 +70,7 @@ describe('Test for Branching actions from the canvas', () => {

cy.checkNodeExist('digitalocean', 1);
cy.selectPrependNode('digitalocean');
cy.get('.pf-v5-c-text-input-group__text-input').click();
cy.get('.pf-v5-c-text-input-group__text-input').type('activemq');
cy.get('#activemq').should('be.visible').click();
cy.chooseFromCatalog('component', 'activemq');

cy.checkNodeExist('activemq', 1);
cy.checkEdgeExists('activemq', 'digitalocean');
Expand All @@ -90,9 +82,7 @@ describe('Test for Branching actions from the canvas', () => {

cy.checkNodeExist('filter', 1);
cy.selectPrependNode('filter');
cy.get('.pf-v5-c-text-input-group__text-input').click();
cy.get('.pf-v5-c-text-input-group__text-input').type('activemq');
cy.get('#activemq').should('be.visible').click();
cy.chooseFromCatalog('component', 'activemq');

cy.checkNodeExist('activemq', 1);
cy.checkEdgeExists('activemq', 'filter');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@ describe('Test for Multi route actions from the canvas', () => {
cy.openDesignPage();

cy.selectAppendNode('setHeader');
cy.get('.pf-v5-c-text-input-group__text-input').click();
cy.get('.pf-v5-c-text-input-group__text-input').type('github');
cy.get('#github').should('be.visible').click();
// wait for the canvas rerender
cy.wait(1000);
cy.chooseFromCatalog('component', 'github');

cy.checkNodeExist('github', 1);

cy.get('[data-id^="github"] g').find('.pf-topology__node__decorator__bg').click();
Expand Down
38 changes: 19 additions & 19 deletions packages/ui-tests/cypress/e2e/designer/multiFlowDesigner.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,25 +56,25 @@ describe('Test for Multi route actions from the canvas', () => {
});

// Blocked ATM by https://github.com/KaotoIO/kaoto-next/issues/301
// it('User deletes routes in the canvas till there are no routes', () => {
// cy.openDesignPage();
// cy.addNewRoute();
// cy.addNewRoute();
// cy.showAllRoutes();

// cy.get('[data-testid="flows-list-route-count"]').should('have.text', '3/3');

// cy.deleteRoute(0);
// cy.deleteRoute(0);
// cy.deleteRoute(0);
// cy.get('[data-testid^="rf__node-node_0"]').should('have.length', 0);
// cy.get('[data-testid="flows-list-empty-state"]').should('have.length', 1);
// cy.get('[data-testid="flows-list-route-count"]').should('have.text', '0/0');

// cy.get('[data-testid="flows-list-empty-state"]').within(() => {
// cy.get('h4.pf-c-title').should('have.text', "There's no routes to show");
// });
// });
it.skip('User deletes routes in the canvas till there are no routes', () => {
Copy link
Member

Choose a reason for hiding this comment

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

Good idea, better to have the skip so we can know how many tests we have under this condition 💪

cy.openDesignPage();
cy.addNewRoute();
cy.addNewRoute();
cy.showAllRoutes();

cy.get('[data-testid="flows-list-route-count"]').should('have.text', '3/3');

cy.deleteRoute(0);
cy.deleteRoute(0);
cy.deleteRoute(0);
cy.get('[data-testid^="rf__node-node_0"]').should('have.length', 0);
cy.get('[data-testid="flows-list-empty-state"]').should('have.length', 1);
cy.get('[data-testid="flows-list-route-count"]').should('have.text', '0/0');

cy.get('[data-testid="flows-list-empty-state"]').within(() => {
cy.get('h4.pf-c-title').should('have.text', "There's no routes to show");
});
});

const testData = ['Pipe', 'Kamelet'];
// Iterate over testData
Expand Down
12 changes: 2 additions & 10 deletions packages/ui-tests/cypress/e2e/designer/rootOnException.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,10 @@ describe('Test for root containers', () => {
cy.openDesignPage();

cy.selectInsertNode('onException-1234');
cy.get('.pf-v5-c-text-input-group__text-input').click();
cy.get('.pf-v5-c-text-input-group__text-input').type('aws2-sqs');
cy.get('#aws2-sqs').should('be.visible').click();
// wait for the canvas rerender
cy.wait(1000);
cy.chooseFromCatalog('component', 'aws2-sqs');

cy.selectAppendNode('aws2-sqs');
cy.get('.pf-v5-c-text-input-group__text-input').click();
cy.get('.pf-v5-c-text-input-group__text-input').type('log');
cy.get('#log').should('be.visible').click();
// wait for the canvas rerender
cy.wait(1000);
cy.chooseFromCatalog('component', 'log');

cy.checkNodeExist('aws2-sqs', 1);
cy.checkNodeExist('log', 1);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
describe('Tests for sidebar dataformat configuration', () => {
beforeEach(() => {
cy.openHomePage();
});

it('Design - sidebar dataformat configuration', () => {
cy.uploadFixture('flows/CamelRoute.yaml');
cy.openDesignPage();

// Configure marshal dataformat
cy.openStepConfigurationTab('marshal');
cy.selectDataformat('Base64');
cy.interactWithDataformatInputObject('lineLength', '128');
cy.interactWithDataformatInputObject('id', 'simpleDataformatId');
cy.interactWithDataformatInputObject('lineSeparator', 'simpleLineSeparator');
cy.interactWithDataformatInputObject('urlSafe');

// CHECK they are reflected in the code editor
cy.openSourceCode();
cy.checkCodeSpanLine('lineLength: "128"', 1);
cy.checkCodeSpanLine('id: simpleDataformatId', 1);
cy.checkCodeSpanLine('lineSeparator: simpleLineSeparator', 1);
cy.checkCodeSpanLine('urlSafe: true', 1);
});

it('Design - sidebar dataformat configuration in Kamelet', () => {
cy.uploadFixture('flows/BasicKamelet.yaml');
cy.openDesignPage();

// Configure marshal dataformat
cy.openStepConfigurationTab('marshal');
cy.selectDataformat('Avro');
cy.configureDropdownValue('library', 'Jackson');
cy.interactWithDataformatInputObject('unmarshalType', 'com.fasterxml.jackson.databind.JsonNode');
cy.interactWithDataformatInputObject('schemaResolver', '#bean:{{}{{}schemaResolver}}');
// CHECK they are reflected in the code editor
cy.openSourceCode();
cy.checkCodeSpanLine('library: Jackson', 1);
cy.checkCodeSpanLine('unmarshalType: com.fasterxml.jackson.databind.JsonNode', 1);
cy.checkCodeSpanLine('schemaResolver: "#bean:{{schemaResolver}}"', 1);

// Blocked by https://github.com/KaotoIO/kaoto-next/issues/489
// cy.checkCodeSpanLine('camel:jackson-avro', 1);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
describe('Tests for sidebar expression configuration', () => {
beforeEach(() => {
cy.openHomePage();
});

it('Design - sidebar expression configuration', () => {
cy.uploadFixture('flows/CamelRoute.yaml');
cy.openDesignPage();
// Configure setHeader expression
cy.openStepConfigurationTab('setHeader');
cy.openExpressionModal();
cy.selectExpression('Simple');
cy.interactWithExpressinInputObject('expression', `{{}{{}header.baz}}`);
cy.interactWithExpressinInputObject('id', 'simpleExpressionId');
cy.interactWithExpressinInputObject('resultType', 'java.lang.String');
cy.confirmExpressionModal();

// CHECK they are reflected in the code editor
cy.openSourceCode();
cy.checkCodeSpanLine('expression: "{{header.baz}}"', 1);
cy.checkCodeSpanLine('id: simpleExpressionId', 1);
cy.checkCodeSpanLine('resultType: java.lang.String', 1);
});

//reproducer for https://github.com/KaotoIO/kaoto-next/issues/518
it('Design - name attribute was sometimes lost after expression configuration', () => {
cy.uploadFixture('flows/CamelRoute.yaml');
cy.openDesignPage();

cy.openStepConfigurationTab('setHeader');
cy.openExpressionModal();
cy.selectExpression('JQ');
cy.interactWithConfigInputObject('expression', '.id');
cy.interactWithConfigInputObject('resultType', 'java.lang.String');
cy.interactWithConfigInputObject('trim');
cy.confirmExpressionModal();

cy.selectAppendNode('setHeader');
cy.chooseFromCatalog('processor', 'setHeader');

cy.checkNodeExist('setHeader', 2);

cy.openStepConfigurationTab('setHeader', 1);
cy.openExpressionModal();
cy.selectExpression('JQ');
cy.interactWithConfigInputObject('expression', '.name');
cy.interactWithConfigInputObject('resultType', 'java.lang.String');
cy.interactWithConfigInputObject('trim');
cy.confirmExpressionModal();

cy.openStepConfigurationTab('setHeader', 0);

// Check the configured fields didn't disappear from the first node
cy.openExpressionModal();
cy.checkConfigCheckboxObject('trim', true);
cy.checkConfigInputObject('resultType', 'java.lang.String');
cy.checkConfigInputObject('expression', '.id');
cy.cancelExpressionModal();

// Check the configured fields didn't disappear from the second node
cy.openStepConfigurationTab('setHeader', 0);
cy.openExpressionModal();
cy.checkConfigCheckboxObject('trim', true);
cy.checkConfigInputObject('resultType', 'java.lang.String');
cy.checkConfigInputObject('expression', '.name');
cy.cancelExpressionModal();

// CHECK they are reflected in the code editor
cy.openSourceCode();
cy.checkCodeSpanLine('expression: .id', 1);
cy.checkCodeSpanLine('expression: .name', 1);
});

// Blocked by: https://github.com/KaotoIO/kaoto-next/issues/904
it.skip('Design - expression configuration with switching type', () => {
cy.uploadFixture('flows/CamelRoute.yaml');
cy.openDesignPage();
// Configure setHeader expression
cy.openStepConfigurationTab('setHeader');
cy.openExpressionModal();
cy.selectExpression('Simple');
cy.interactWithExpressinInputObject('expression', `{{}{{}header.baz}}`);
cy.interactWithExpressinInputObject('id', 'simpleExpressionId');
cy.interactWithExpressinInputObject('resultType', 'java.lang.String');
cy.selectExpression('Constant');
cy.confirmExpressionModal();

// CHECK they are reflected in the code editor
cy.openSourceCode();
cy.checkCodeSpanLine('expression: "{{header.baz}}"', 1);
cy.checkCodeSpanLine('id: constantExpressionId', 1);
cy.checkCodeSpanLine('resultType: java.lang.String', 1);
});

it('Design - sidebar expression configuration in Kamelet', () => {
cy.uploadFixture('flows/BasicKamelet.yaml');
cy.openDesignPage();
// Configure setBody expression
cy.openStepConfigurationTab('setBody');
cy.openExpressionModal();
cy.selectExpression('Simple');
cy.interactWithExpressinInputObject('expression', `{{}{{}body.baz}}`);
cy.interactWithExpressinInputObject('id', 'simpleExpressionId');
cy.interactWithExpressinInputObject('resultType', 'java.lang.String');
cy.confirmExpressionModal();

// CHECK they are reflected in the code editor
cy.openSourceCode();
cy.checkCodeSpanLine('expression: "{{body.baz}}"', 1);
cy.checkCodeSpanLine('id: simpleExpressionId', 1);
cy.checkCodeSpanLine('resultType: java.lang.String', 1);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
describe('Tests for sidebar loadBalancer step configuration', () => {
beforeEach(() => {
cy.openHomePage();
});

it('Design - sidebar loadBalancer configuration in CR', () => {
cy.uploadFixture('flows/CamelRoute.yaml');
cy.openDesignPage();

cy.selectAppendNode('marshal');
cy.chooseFromCatalog('processor', 'loadBalance');
cy.openStepConfigurationTab('loadBalance');

cy.get('[data-testid="loadbalancer-config-card"] button').click();
cy.get('[data-testid="loadbalancer-dropdownitem-roundRobin"] button').click();

cy.get('[data-testid="metadata-editor-form-loadbalancer"]')
.find('input[data-testid="text-field"]')
.type('roundRobinId');

cy.get(`input[name="id"]`).eq(1).clear().type('testId');
cy.get(`input[name="description"]`).clear().type('loadBalancerDescription');
cy.get(`input[name="inheritErrorHandler"]`).check();
cy.closeStepConfigurationTab();

cy.selectInsertNode('loadBalancerDescription');
cy.chooseFromCatalog('component', 'log');

cy.selectInsertNode('loadBalancerDescription');
cy.chooseFromCatalog('component', 'log');

const loadBalanceConfig = [
'- loadBalance:',
'steps:',
'- to:',
'parameters: {}',
'uri: log',
'- to:',
'parameters: {}',
'uri: log',
'description: loadBalancerDescription',
'inheritErrorHandler: true',
'id: testId',
'roundRobin:',
'id: roundRobinId',
];

cy.openSourceCode();
// CHECK changes are reflected in the code editor
cy.checkMultiLineContent(loadBalanceConfig);
});
});
Loading
Loading