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 kamelet URI config tests #812

Merged
merged 1 commit into from
Feb 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
56 changes: 40 additions & 16 deletions packages/ui-tests/cypress/e2e/designer/uriRouteConfig.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,55 @@ describe('Test URI node config', () => {
cy.openHomePage();
});

it('load the URI config route in YAML editor, edit node in canvas and check', () => {
cy.uploadFixture('flows/UriConfRoute.yaml');
const testFile = ['flows/UriConfKamelet.yaml', 'flows/UriConfRoute.yaml'];
testFile.forEach((file) => {
it('load the URI config route from ' + file + ', edit node in canvas and check', () => {
cy.uploadFixture(file);

cy.openDesignPage();

cy.checkNodeExist('timer', 1);
cy.checkNodeExist('setBody', 1);
cy.checkNodeExist('log', 1);
cy.checkNodeExist('transform', 1);
cy.checkNodeExist('file', 1);

cy.openStepConfigurationTab('timer');
cy.checkConfigInputObject('parameters.period', '1000');
cy.checkConfigInputObject('parameters.delay', '2000');
cy.checkConfigInputObject('parameters.repeatCount', '10');

cy.interactWithConfigInputObject('parameters.period', '3000');
cy.interactWithConfigInputObject('parameters.repeatCount', '5');
cy.closeStepConfigurationTab();

// CHECK that the code editor contains the updated properties for timer step
cy.openSourceCode();
cy.checkCodeSpanLine('delay: 2000', 1);
cy.checkCodeSpanLine('period: "3000"', 1);
cy.checkCodeSpanLine('repeatCount: "5"', 1);
});
});

it('User adds URI step to the YAML', () => {
cy.uploadFixture('flows/UriConfKamelet.yaml');
const insertLine = 43;
const stepToInsert = ` - to: aws2-s3:testBucket?autoCreateBucket=true`;
cy.editorAddText(insertLine, stepToInsert);
cy.openDesignPage();

// CHECK the insert-field-action step was added
cy.checkNodeExist('timer', 1);
cy.checkNodeExist('setBody', 1);
cy.checkNodeExist('log', 1);
cy.checkNodeExist('transform', 1);
cy.checkNodeExist('aws2-s3', 1);
cy.checkNodeExist('file', 1);

cy.openStepConfigurationTab('timer');
cy.checkConfigInputObject('parameters.period', '1000');
cy.checkConfigInputObject('parameters.delay', '2000');
cy.checkConfigInputObject('parameters.repeatCount', '10');

cy.interactWithConfigInputObject('parameters.period', '3000');
cy.interactWithConfigInputObject('parameters.repeatCount', '5');
cy.closeStepConfigurationTab();

// CHECK that the code editor contains the updated properties for timer step
cy.openSourceCode();
cy.checkCodeSpanLine('delay: 2000', 1);
cy.checkCodeSpanLine('period: "3000"', 1);
cy.checkCodeSpanLine('repeatCount: "5"', 1);
// CHECK the aws2-s3 properties
cy.openStepConfigurationTab('aws2-s3');
cy.checkConfigCheckboxObject('parameters.autoCreateBucket', true);
cy.checkConfigInputObject('parameters.bucketNameOrArn', 'testBucket');
});

it('User adds URI step to the YAML', () => {
Expand Down
44 changes: 44 additions & 0 deletions packages/ui-tests/cypress/fixtures/flows/UriConfKamelet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
apiVersion: camel.apache.org/v1
kind: Kamelet
metadata:
name: kamelet-3647
annotations:
camel.apache.org/kamelet.support.level: "Stable"
camel.apache.org/catalog.version: "main-SNAPSHOT"
camel.apache.org/kamelet.icon: "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTkuMC4wLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+CjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rP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o8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8L3N2Zz4K"
camel.apache.org/provider: "Apache Software Foundation"
camel.apache.org/kamelet.group: "Users"
labels:
camel.apache.org/kamelet.type: "source"
spec:
definition:
title: kamelet-3647
description: "Produces periodic events about random users!"
type: object
properties:
period:
title: Period
description: The time interval between two events
type: integer
default: 5000
types:
out:
mediaType: application/json
dependencies:
- "camel:timer"
- "camel:http"
- "camel:kamelet"
template:
from:
id: from-1193
uri: "timer:start?period=1000&delay=2000&repeatCount=10"
parameters:
timerName: user
period: "{{period}}"
steps:
- setBody:
constant: Initial message
- to: log:info?showAll=true&multiline=true&logMask=true
- transform:
simple: ${body.toUpperCase()}
- to: file:output?fileName=output.txt&fileExist=Append
Loading