Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
lordrip committed Dec 2, 2024
1 parent f4e7f71 commit 3e59356
Show file tree
Hide file tree
Showing 22 changed files with 800 additions and 961 deletions.
6 changes: 3 additions & 3 deletions packages/ui-tests/cypress/e2e/codeEditor/malformedFlows.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe('Test for Multi route actions from the code editor', () => {
cy.openSourceCode();
cy.uploadFixture('flows/malformed/kamelet/wrongIndentProperties.yaml');
cy.openDesignPage();
cy.checkNodeExist('source: Unknown', 1);
cy.checkNodeExist('source', 1);

// verify the route wasn't removed and left for the user to repair
cy.openSourceCode();
Expand All @@ -66,8 +66,8 @@ describe('Test for Multi route actions from the code editor', () => {
cy.openSourceCode();
cy.uploadFixture('flows/malformed/kamelet/wrongIndentSource.yaml');
cy.openDesignPage();
cy.checkNodeExist('source: Unknown', 1);
cy.checkNodeExist('sink: Unknown', 1);
cy.checkNodeExist('source', 1);
cy.checkNodeExist('sink', 1);

// verify the route wasn't removed and left for the user to repair
cy.openSourceCode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe('Test toolbar on hover actions', () => {
cy.uploadFixture('flows/camelRoute/basic.yaml');
cy.openDesignPage();

cy.openRootConfigurationTab('camel-route');
cy.openGroupConfigurationTab('camel-route');

cy.get('[data-testid="step-toolbar-button-delete-group"]').click();
cy.get('[data-testid="action-confirmation-modal-btn-confirm"]').click();
Expand All @@ -64,7 +64,7 @@ describe('Test toolbar on hover actions', () => {
cy.uploadFixture('flows/kamelet/complex.yaml');
cy.openDesignPage();

cy.openRootConfigurationTab('choice');
cy.openGroupConfigurationTab('choice');

cy.get('[data-testid="step-toolbar-button-add-special"]').click();

Expand All @@ -77,7 +77,7 @@ describe('Test toolbar on hover actions', () => {
cy.uploadFixture('flows/kamelet/complex.yaml');
cy.openDesignPage();

cy.openRootConfigurationTab('choice');
cy.openGroupConfigurationTab('choice');

cy.get(`[data-testid="step-toolbar-button-collapse"]`).click({ force: true });
cy.checkNodeExist('when', 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,16 @@ describe('Tests for Design page', () => {
cy.uploadFixture('flows/camelRoute/basic.yaml');
cy.openDesignPage();

cy.openStepConfigurationTab('log');
cy.quickAppend();
cy.chooseFromCatalog('processor', 'choice');

cy.openGroupConfigurationTab('choice');
cy.quickAppend();
cy.chooseFromCatalog('component', 'as2');

cy.quickAppend(1);
cy.openStepConfigurationTab('as2');
cy.quickAppend();
cy.chooseFromCatalog('component', 'amqp');

cy.openSourceCode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ describe('Tests for Design page', () => {
cy.removeNodeByName('json-deserialize-action');
cy.removeNodeByName('kafka-source');
cy.removeNodeByName('kafka-sink');
cy.checkNodeExist('source: Unknown', 1);
cy.checkNodeExist('sink: Unknown', 1);
cy.checkNodeExist('source', 1);
cy.checkNodeExist('sink', 1);

cy.openSourceCode();
cy.checkCodeSpanLine('json-deserialize-action', 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ describe('Test for missing config props canvas warnings', () => {
beforeEach(() => {
cy.openHomePage();
});

it('Check the canvas node warnings in Camel Route', () => {
cy.uploadFixture('flows/camelRoute/basic.yaml');
cy.openDesignPage();
Expand All @@ -12,7 +13,7 @@ describe('Test for missing config props canvas warnings', () => {
cy.checkNodeExist('github', 1);

cy.get('[data-id^="github"] g')
.find('span.pf-v5-c-icon')
.find('span[data-warning="true"].pf-v5-c-icon')
.should('have.attr', 'title', '3 required parameters are not yet configured: [ type,repoName,repoOwner ]');

cy.openStepConfigurationTab('github');
Expand All @@ -21,7 +22,7 @@ describe('Test for missing config props canvas warnings', () => {
cy.closeStepConfigurationTab();

cy.get('[data-id^="github"] g')
.find('span.pf-v5-c-icon')
.find('span[data-warning="true"].pf-v5-c-icon')
.should('have.attr', 'title', '2 required parameters are not yet configured: [ type,repoOwner ]');
});

Expand All @@ -30,14 +31,14 @@ describe('Test for missing config props canvas warnings', () => {
cy.openDesignPage();

cy.get('[data-id^="delay-action"] g')
.find('span.pf-v5-c-icon')
.find('span[data-warning="true"].pf-v5-c-icon')
.should('have.attr', 'title', '1 required parameter is not yet configured: [ milliseconds ]');

cy.openStepConfigurationTab('delay-action');

cy.interactWithConfigInputObject('milliseconds', '1000');
cy.closeStepConfigurationTab();

cy.get('[data-id^="delay-action"] g').find('span.pf-v5-c-icon').should('not.exist');
cy.get('[data-id^="delay-action"] g').find('span[data-warning="true"].pf-v5-c-icon').should('not.exist');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('Test for camel route root containers configuration', () => {
cy.uploadFixture('flows/camelRoute/basic.yaml');
cy.openDesignPage();

cy.openRootConfigurationTab('camel-route');
cy.openGroupConfigurationTab('camel-route');

cy.selectFormTab('All');
cy.interactWithConfigInputObject('description', 'test.description');
Expand Down Expand Up @@ -90,7 +90,7 @@ describe('Test for camel route root containers configuration', () => {
cy.uploadFixture('flows/kamelet/basic.yaml');
cy.openDesignPage();

cy.openRootConfigurationTab('Produces periodic events about random users!');
cy.openGroupConfigurationTab('Produces periodic events about random users!');

cy.selectFormTab('All');
cy.interactWithConfigInputObject('name', 'test.name');
Expand Down Expand Up @@ -130,7 +130,7 @@ describe('Test for camel route root containers configuration', () => {
cy.uploadFixture('flows/pipe/basic.yaml');
cy.openDesignPage();

cy.openRootConfigurationTab('pipe');
cy.openGroupConfigurationTab('pipe');

cy.selectFormTab('All');
cy.get(`input[name="name"]`).clear();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('Test for interceptSendToEndpoint configuration container', () => {
it('Root interceptSendToEndpoint configuration', () => {
cy.selectCamelRouteType('Configuration', 'interceptSendToEndpoint');

cy.get(`[data-testid^="custom-node__interceptSendToEndpoint"]`).click({ force: true });
cy.openGroupConfigurationTab('interceptSendToEndpoint');

cy.selectFormTab('All');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ describe('Test for onCompletion configuration container', () => {
it('Root onCompletion configuration', () => {
cy.selectCamelRouteType('Configuration', 'onCompletion');

cy.get(`[data-testid^="custom-node__onCompletion"]`).click({ force: true });
cy.openGroupConfigurationTab('onCompletion');

cy.selectFormTab('All');

cy.interactWithConfigInputObject('description', 'testDescription');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('Test for root on exception container', () => {
cy.uploadFixture('flows/camelRoute/onException.yaml');
cy.openDesignPage();

cy.get(`[data-testid^="custom-node__onException"]`).click({ force: true });
cy.openGroupConfigurationTab('onException');

cy.selectFormTab('All');
cy.selectInTypeaheadField('redeliveryPolicy.retriesExhaustedLogLevel', 'INFO');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe('Tests for sidebar loadBalancer step configuration', () => {

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

cy.get('[data-testid="loadbalancer-config-card"] button').click();
Expand Down
2 changes: 1 addition & 1 deletion packages/ui-tests/cypress/support/cypress.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ declare global {
hideAllRoutes(): Chainable<JQuery<Element>>;
showAllRoutes(): Chainable<JQuery<Element>>;
// design
openRootConfigurationTab(step: string): Chainable<JQuery<Element>>;
openGroupConfigurationTab(step: string, stepIndex?: number): Chainable<JQuery<Element>>;
openStepConfigurationTab(step: string, stepIndex?: number): Chainable<JQuery<Element>>;
toggleExpandGroup(groupName: string): Chainable<JQuery<Element>>;
fitToScreen(): Chainable<JQuery<Element>>;
Expand Down
9 changes: 5 additions & 4 deletions packages/ui-tests/cypress/support/next-commands/design.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ Cypress.Commands.add('fitToScreen', () => {

Cypress.Commands.add('openStepConfigurationTab', (step: string, stepIndex?: number) => {
stepIndex = stepIndex ?? 0;
cy.get(`g[data-nodelabel="${step}"]`).eq(stepIndex).click({ force: true });
cy.get(`g[data-nodelabel^="${step}"]`).eq(stepIndex).click({ force: true });
});

Cypress.Commands.add('openRootConfigurationTab', (step: string) => {
cy.get(`g[data-grouplabel="${step}"]`).click({ force: true });
Cypress.Commands.add('openGroupConfigurationTab', (group: string, groupIndex?: number) => {
groupIndex = groupIndex ?? 0;
cy.get(`g[data-grouplabel^="${group}"]`).eq(groupIndex).click({ force: true });
});

Cypress.Commands.add('toggleExpandGroup', (groupName: string) => {
Expand Down Expand Up @@ -36,7 +37,7 @@ Cypress.Commands.add('removeNodeByName', (nodeName: string, nodeIndex?: number)

Cypress.Commands.add('quickAppend', (nodeIndex?: number) => {
nodeIndex = nodeIndex ?? 0;
cy.get('circle.pf-topology__node__decorator__bg').eq(nodeIndex).click({ force: true });
cy.get('[data-testid="quick-append-step"]').eq(nodeIndex).click({ force: true });
});

Cypress.Commands.add('selectReplaceNode', (nodeName: string, nodeIndex?: number) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { ROOT_PATH } from '../../../../utils';
import { CanvasNode } from '../canvas.models';
import { FlowService } from '../flow.service';
import { CanvasForm } from './CanvasForm';
import { parse } from 'yaml';

describe('CanvasForm', () => {
let camelRouteVisualEntity: CamelRouteVisualEntity;
Expand Down Expand Up @@ -434,22 +435,20 @@ describe('CanvasForm', () => {
});

it('dataformat field', async () => {
const camelRoute = {
from: {
uri: 'timer',
parameters: {
timerName: 'tutorial',
},
steps: [
{
marshal: {
id: 'ms',
},
},
],
},
} as RouteDefinition;
const entity = new CamelRouteVisualEntity(camelRoute);
const camelRoute = `
- route:
id: route-2184
from:
id: from-2623
uri: timer
parameters:
period: "1000"
timerName: template
steps:
- marshal:
id: marshal-1539
`;
const entity = new CamelRouteVisualEntity(parse(camelRoute));
const rootNode: IVisualizationNode = entity.toVizNode();
const marshalNode = rootNode.getChildren()![1];
const selectedNode = {
Expand Down
Loading

0 comments on commit 3e59356

Please sign in to comment.