From 35a0682d1acb01f7e97a2dca3dc2efebee628299 Mon Sep 17 00:00:00 2001 From: tplevko Date: Wed, 7 Feb 2024 17:02:58 +0100 Subject: [PATCH] e2e: add kamelet URI config tests --- .../cypress/e2e/designer/uriRouteConfig.cy.ts | 56 +++++++++++++------ .../fixtures/flows/UriConfKamelet.yaml | 44 +++++++++++++++ 2 files changed, 84 insertions(+), 16 deletions(-) create mode 100644 packages/ui-tests/cypress/fixtures/flows/UriConfKamelet.yaml diff --git a/packages/ui-tests/cypress/e2e/designer/uriRouteConfig.cy.ts b/packages/ui-tests/cypress/e2e/designer/uriRouteConfig.cy.ts index 73f162a2b..64bee28c1 100644 --- a/packages/ui-tests/cypress/e2e/designer/uriRouteConfig.cy.ts +++ b/packages/ui-tests/cypress/e2e/designer/uriRouteConfig.cy.ts @@ -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', () => { diff --git a/packages/ui-tests/cypress/fixtures/flows/UriConfKamelet.yaml b/packages/ui-tests/cypress/fixtures/flows/UriConfKamelet.yaml new file mode 100644 index 000000000..470657541 --- /dev/null +++ b/packages/ui-tests/cypress/fixtures/flows/UriConfKamelet.yaml @@ -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/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF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w3LDUwLjc2MlY1NGMwLDQuNzQ2LDE1LjA0NSw2LDIzLDZzMjMtMS4yNTQsMjMtNnYtMy4wNDMKCUM1Myw0Ny41MTksNTEuMDg5LDQ0LjQyNyw0OC4wMTQsNDIuODg5eiIvPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8L3N2Zz4K" + 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