You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ze...@apache.org on 2021/08/12 16:12:39 UTC
[incubator-streampipes] 01/03: [STREAMPIPES-404] Prepare cypress
tests to use the cypress dashboard
This is an automated email from the ASF dual-hosted git repository.
zehnder pushed a commit to branch STREAMPIPES-319
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
commit da8c421e574b8650fbe86350b21e47c01e880230
Author: Philipp Zehnder <ze...@fzi.de>
AuthorDate: Thu Aug 12 17:56:02 2021 +0200
[STREAMPIPES-404] Prepare cypress tests to use the cypress dashboard
---
.../manager/pipeline/PipelineCacheManager.java | 32 +--
.../PipelineCanvasMetadataCacheManager.java | 32 +--
.../streampipes/rest/impl/PipelineCache.java | 20 +-
.../rest/impl/PipelineCanvasMetadataCache.java | 14 +-
ui/.gitignore | 5 +
ui/cypress.json | 2 +-
ui/cypress/support/builder/PipelineBuilder.ts | 5 +
ui/cypress/support/model/PipelineInput.ts | 1 +
ui/cypress/support/utils/AdapterUtils.ts | 217 ++++++++++-----------
ui/cypress/support/utils/DataLakeUtils.ts | 13 +-
ui/cypress/support/utils/FileManagementUtils.ts | 15 +-
ui/cypress/support/utils/PipelineUtils.ts | 113 ++++++-----
.../support/utils/ProcessingElementTestUtils.ts | 10 +-
ui/cypress/support/utils/StaticPropertyUtils.ts | 23 ++-
ui/cypress/tests/adapter/fileStream.ts | 34 ++--
ui/cypress/tests/adapter/machineDataSimulator.ts | 21 +-
.../adapter/randomDataSimulatorStream.spec.ts | 21 +-
.../tests/fileManagement/testFileManagement.ts | 13 +-
ui/cypress/tests/installation/installation.ts | 13 +-
ui/cypress/tests/pipeline/pipelineTest.ts | 42 ++--
.../tests/pipelineElement/AllPipelineElements.ts | 13 +-
.../tests/pipelineElement/SinglePipelineElement.ts | 11 +-
.../pipeline-element-icon-stand.component.html | 6 +-
ui/src/app/editor/editor.component.html | 5 +-
24 files changed, 341 insertions(+), 340 deletions(-)
diff --git a/ui/cypress/tests/adapter/randomDataSimulatorStream.spec.ts b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/pipeline/PipelineCacheManager.java
similarity index 59%
copy from ui/cypress/tests/adapter/randomDataSimulatorStream.spec.ts
copy to streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/pipeline/PipelineCacheManager.java
index 8489023..a63fd6b 100644
--- a/ui/cypress/tests/adapter/randomDataSimulatorStream.spec.ts
+++ b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/pipeline/PipelineCacheManager.java
@@ -16,22 +16,24 @@
*
*/
-import { AdapterUtils } from '../../support/utils/AdapterUtils';
-import { SpecificAdapterBuilder } from '../../support/builder/SpecificAdapterBuilder';
+package org.apache.streampipes.manager.pipeline;
-before('Setup Test', () => {
- it('Initialize Test', () => {
- cy.initStreamPipesTest();
- });
-});
+import java.util.concurrent.ConcurrentHashMap;
-describe('Test Random Data Simulator Stream Adapter', () => {
+public class PipelineCacheManager {
- const adapterInput = SpecificAdapterBuilder
- .create('Random_Data_Simulator_\\(Stream\\)')
- .setName('Random Data Simulator Adapter Test')
- .addInput('input', 'wait-time-ms', '1000')
- .build();
+ private static ConcurrentHashMap<String, String> cachedPipelines = new ConcurrentHashMap<>();
- AdapterUtils.testSpecificStreamAdapter(adapterInput);
-});
+ public static void updateCachedPipeline(String userName,
+ String rawPipelineModel) {
+ cachedPipelines.put(userName, rawPipelineModel);
+ }
+
+ public static String getCachedPipeline(String userName) {
+ return cachedPipelines.get(userName);
+ }
+
+ public static void removeCachedPipeline(String userName) {
+ cachedPipelines.remove(userName);
+ }
+}
diff --git a/ui/cypress/tests/pipelineElement/AllPipelineElements.ts b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/pipeline/PipelineCanvasMetadataCacheManager.java
similarity index 53%
copy from ui/cypress/tests/pipelineElement/AllPipelineElements.ts
copy to streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/pipeline/PipelineCanvasMetadataCacheManager.java
index 20472a5..95fa46f 100644
--- a/ui/cypress/tests/pipelineElement/AllPipelineElements.ts
+++ b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/pipeline/PipelineCanvasMetadataCacheManager.java
@@ -16,22 +16,24 @@
*
*/
-import { ProcessingElementTestUtils } from '../../support/utils/ProcessingElementTestUtils';
-import { ProcessorTest } from '../../support/model/ProcessorTest';
-import { AdapterUtils } from '../../support/utils/AdapterUtils';
+package org.apache.streampipes.manager.pipeline;
-const allTests = Cypress.env('processingElements');
+import java.util.concurrent.ConcurrentHashMap;
-allTests.forEach(test => {
- before('Setup Test', () => {
- it('Initialize Test', () => {
- cy.initStreamPipesTest();
- });
- });
+public class PipelineCanvasMetadataCacheManager {
- describe('Test Processor ' + test['name'], () => {
- const processorTest = test as ProcessorTest;
+ private static ConcurrentHashMap<String, String> cachedCanvasMetadata = new ConcurrentHashMap<>();
- ProcessingElementTestUtils.testElement(processorTest);
- });
-});
+ public static void updateCachedCanvasMetadata(String userName,
+ String canvasMetadata) {
+ cachedCanvasMetadata.put(userName, canvasMetadata);
+ }
+
+ public static String getCachedCanvasMetadata(String userName) {
+ return cachedCanvasMetadata.get(userName);
+ }
+
+ public static void removeCanvasMetadataFromCache(String userName) {
+ cachedCanvasMetadata.remove(userName);
+ }
+}
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineCache.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineCache.java
index c699a02..ddafe60 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineCache.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineCache.java
@@ -17,29 +17,29 @@
*/
package org.apache.streampipes.rest.impl;
+import org.apache.streampipes.manager.pipeline.PipelineCacheManager;
+
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-import java.util.concurrent.ConcurrentHashMap;
@Path("/v2/users/{username}/pipeline-cache")
public class PipelineCache extends AbstractRestResource {
- private static ConcurrentHashMap<String, String> cachedPipelines = new ConcurrentHashMap<>();
-
@POST
@Produces(MediaType.APPLICATION_JSON)
- public Response updateCachedPipeline(@PathParam("username") String user,
+ public Response updateCachedPipeline(@PathParam("username") String userName,
String rawPipelineModel) {
- cachedPipelines.put(user, rawPipelineModel);
+ PipelineCacheManager.updateCachedPipeline(userName, rawPipelineModel);
return ok();
}
@GET
@Produces(MediaType.APPLICATION_JSON)
- public Response getCachedPipeline(@PathParam("username") String user) {
- if (cachedPipelines.containsKey(user)) {
- return ok(cachedPipelines.get(user));
+ public Response getCachedPipeline(@PathParam("username") String userName) {
+ String result = PipelineCacheManager.getCachedPipeline(userName);
+ if (result != null) {
+ return ok(result);
} else {
return ok();
}
@@ -47,8 +47,8 @@ public class PipelineCache extends AbstractRestResource {
@DELETE
@Produces(MediaType.APPLICATION_JSON)
- public Response removePipelineFromCache(@PathParam("username") String user) {
- cachedPipelines.remove(user);
+ public Response removePipelineFromCache(@PathParam("username") String userName) {
+ PipelineCacheManager.removeCachedPipeline(userName);
return ok();
}
}
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineCanvasMetadataCache.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineCanvasMetadataCache.java
index 83e8b52..022d5e2 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineCanvasMetadataCache.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineCanvasMetadataCache.java
@@ -17,29 +17,29 @@
*/
package org.apache.streampipes.rest.impl;
+import org.apache.streampipes.manager.pipeline.PipelineCanvasMetadataCacheManager;
+
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-import java.util.concurrent.ConcurrentHashMap;
@Path("/v2/users/{username}/pipeline-canvas-cache")
public class PipelineCanvasMetadataCache extends AbstractRestResource {
- private static ConcurrentHashMap<String, String> cachedCanvasMetadata = new ConcurrentHashMap<>();
-
@POST
@Produces(MediaType.APPLICATION_JSON)
public Response updateCachedCanvasMetadata(@PathParam("username") String user,
String canvasMetadata) {
- cachedCanvasMetadata.put(user, canvasMetadata);
+ PipelineCanvasMetadataCacheManager.updateCachedCanvasMetadata(user, canvasMetadata);
return ok();
}
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response getCachedCanvasMetadata(@PathParam("username") String user) {
- if (cachedCanvasMetadata.containsKey(user)) {
- return ok(cachedCanvasMetadata.get(user));
+ String result = PipelineCanvasMetadataCacheManager.getCachedCanvasMetadata(user);
+ if (result != null) {
+ return ok(result);
} else {
return ok();
}
@@ -48,7 +48,7 @@ public class PipelineCanvasMetadataCache extends AbstractRestResource {
@DELETE
@Produces(MediaType.APPLICATION_JSON)
public Response removeCanvasMetadataFromCache(@PathParam("username") String user) {
- cachedCanvasMetadata.remove(user);
+ PipelineCanvasMetadataCacheManager.removeCanvasMetadataFromCache(user);
return ok();
}
}
diff --git a/ui/.gitignore b/ui/.gitignore
index 351d928..fe19d16 100644
--- a/ui/.gitignore
+++ b/ui/.gitignore
@@ -77,3 +77,8 @@ bundle.js.map
.vscode/
package-lock.json
+
+# Cypress
+cypress/screenshots/
+cypress/videos/
+
diff --git a/ui/cypress.json b/ui/cypress.json
index c164f7d..24d9cd2 100644
--- a/ui/cypress.json
+++ b/ui/cypress.json
@@ -1,5 +1,5 @@
{
- "projectId": "z5n3e9",
+ "projectId": "q1jdu2",
"integrationFolder": "cypress/tests",
"env": {
"TAKE_SCREENSHOT": "false"
diff --git a/ui/cypress/support/builder/PipelineBuilder.ts b/ui/cypress/support/builder/PipelineBuilder.ts
index a65bf5b..0564aa8 100644
--- a/ui/cypress/support/builder/PipelineBuilder.ts
+++ b/ui/cypress/support/builder/PipelineBuilder.ts
@@ -37,6 +37,11 @@ export class PipelineBuilder {
return this;
}
+ public addSourceType(sourceType: string) {
+ this.pipeline.dataSourceType = sourceType;
+
+ return this;
+ }
public addProcessingElement(processingElement: PipelineElementInput) {
this.pipeline.processingElement = processingElement;
diff --git a/ui/cypress/support/model/PipelineInput.ts b/ui/cypress/support/model/PipelineInput.ts
index b5463c5..bb8fd2c 100644
--- a/ui/cypress/support/model/PipelineInput.ts
+++ b/ui/cypress/support/model/PipelineInput.ts
@@ -21,6 +21,7 @@ import { PipelineElementInput } from './PipelineElementInput';
export class PipelineInput {
pipelineName: string;
dataSource: string;
+ dataSourceType: string | 'stream' | 'set';
processingElement: PipelineElementInput;
diff --git a/ui/cypress/support/utils/AdapterUtils.ts b/ui/cypress/support/utils/AdapterUtils.ts
index b29dd55..9807216 100644
--- a/ui/cypress/support/utils/AdapterUtils.ts
+++ b/ui/cypress/support/utils/AdapterUtils.ts
@@ -24,167 +24,154 @@ import { SpecificAdapterBuilder } from '../builder/SpecificAdapterBuilder';
export class AdapterUtils {
- public static testSpecificStreamAdapter(adapterConfiguration: SpecificAdapterInput) {
+ public static testSpecificStreamAdapter(adapterConfiguration: SpecificAdapterInput) {
- AdapterUtils.goToConnect();
+ AdapterUtils.goToConnect();
- AdapterUtils.selectAdapter(adapterConfiguration.adapterType);
+ AdapterUtils.selectAdapter(adapterConfiguration.adapterType);
- AdapterUtils.configureAdapter(adapterConfiguration.adapterConfiguration);
+ AdapterUtils.configureAdapter(adapterConfiguration.adapterConfiguration);
- AdapterUtils.finishEventSchemaConfiguration();
+ AdapterUtils.finishEventSchemaConfiguration();
- AdapterUtils.startStreamAdapter(adapterConfiguration.adapterName);
+ AdapterUtils.startStreamAdapter(adapterConfiguration.adapterName);
- }
+ }
- public static testGenericStreamAdapter(adapterConfiguration: GenericAdapterInput) {
+ public static testGenericStreamAdapter(adapterConfiguration: GenericAdapterInput) {
- AdapterUtils.addGenericStreamAdapter(adapterConfiguration);
+ AdapterUtils.addGenericStreamAdapter(adapterConfiguration);
- }
+ }
- public static addGenericStreamAdapter(adapterConfiguration: GenericAdapterInput) {
- AdapterUtils.addGenericAdapter(adapterConfiguration);
+ public static addGenericStreamAdapter(adapterConfiguration: GenericAdapterInput) {
+ AdapterUtils.addGenericAdapter(adapterConfiguration);
- AdapterUtils.startStreamAdapter(adapterConfiguration.adapterName);
- }
+ AdapterUtils.startStreamAdapter(adapterConfiguration.adapterName);
+ }
- public static addGenericSetAdapter(adapterConfiguration: GenericAdapterInput) {
- AdapterUtils.addGenericAdapter(adapterConfiguration);
+ public static addGenericSetAdapter(adapterConfiguration: GenericAdapterInput) {
+ AdapterUtils.addGenericAdapter(adapterConfiguration);
- AdapterUtils.startSetAdapter(adapterConfiguration.adapterName);
- }
+ AdapterUtils.startSetAdapter(adapterConfiguration.adapterName);
+ }
- private static addGenericAdapter(adapterConfiguration: GenericAdapterInput) {
- AdapterUtils.goToConnect();
+ private static addGenericAdapter(adapterConfiguration: GenericAdapterInput) {
+ AdapterUtils.goToConnect();
- AdapterUtils.selectAdapter(adapterConfiguration.adapterType);
+ AdapterUtils.selectAdapter(adapterConfiguration.adapterType);
- AdapterUtils.configureAdapter(adapterConfiguration.protocolConfiguration);
+ AdapterUtils.configureAdapter(adapterConfiguration.protocolConfiguration);
- AdapterUtils.configureFormat(adapterConfiguration);
+ AdapterUtils.configureFormat(adapterConfiguration);
- AdapterUtils.markPropertyAsTimestamp(adapterConfiguration.timestampProperty);
+ AdapterUtils.markPropertyAsTimestamp(adapterConfiguration.timestampProperty);
- AdapterUtils.finishEventSchemaConfiguration();
- }
+ AdapterUtils.finishEventSchemaConfiguration();
+ }
- public static addMachineDataSimulator(name: string) {
+ public static addMachineDataSimulator(name: string) {
- const configuration = SpecificAdapterBuilder
- .create('Machine_Data_Simulator')
- .setName(name)
- .addInput('input', 'wait-time-ms', '1000')
- .build();
+ const configuration = SpecificAdapterBuilder
+ .create('Machine_Data_Simulator')
+ .setName(name)
+ .addInput('input', 'wait-time-ms', '1000')
+ .build();
- AdapterUtils.goToConnect();
+ AdapterUtils.goToConnect();
- AdapterUtils.selectAdapter(configuration.adapterType);
+ AdapterUtils.selectAdapter(configuration.adapterType);
- AdapterUtils.configureAdapter(configuration.adapterConfiguration);
+ AdapterUtils.configureAdapter(configuration.adapterConfiguration);
- AdapterUtils.finishEventSchemaConfiguration();
+ AdapterUtils.finishEventSchemaConfiguration();
- AdapterUtils.startStreamAdapter(configuration.adapterName);
+ AdapterUtils.startStreamAdapter(configuration.adapterName);
- }
+ }
- private static goToConnect() {
- it('Go to StreamPipes connect', () => {
- cy.visit('#/connect');
- });
- }
+ public static goToConnect() {
+ cy.visit('#/connect');
+ }
- private static selectAdapter(name) {
- it('Select adapter', () => {
- cy.get('#' + name).click();
- });
- }
+ private static selectAdapter(name) {
+ // Select adapter
+ cy.get('#' + name).click();
+ }
- private static configureAdapter(configs: UserInput[]) {
+ private static configureAdapter(configs: UserInput[]) {
- StaticPropertyUtils.input(configs);
+ StaticPropertyUtils.input(configs);
- it('Next Button should not be disabled', () => {
- cy.get('button').contains('Next').parent().should('not.be.disabled');
- });
+ // Next Button should not be disabled
+ cy.get('button').contains('Next').parent().should('not.be.disabled');
- it('Click next', () => {
- cy.get('button').contains('Next').parent().click();
- });
- }
+ // Click next
+ cy.get('button').contains('Next').parent().click();
+ }
- private static configureFormat(adapterConfiguration: GenericAdapterInput) {
- it('Select format', () => {
- cy.dataCy(adapterConfiguration.format).click();
- });
+ private static configureFormat(adapterConfiguration: GenericAdapterInput) {
+ // Select format
+ cy.dataCy(adapterConfiguration.format).click();
- StaticPropertyUtils.input(adapterConfiguration.formatConfiguration);
+ StaticPropertyUtils.input(adapterConfiguration.formatConfiguration);
- it('Click next', () => {
- // cy.dataCy('sp-format-selection-next-button').parent().should('not.be.disabled');
- cy.dataCy('sp-format-selection-next-button').contains('Next').parent().click();
- });
- }
+ // Click next
+ cy.dataCy('sp-format-selection-next-button').contains('Next').parent().click();
+ }
- private static markPropertyAsTimestamp(propertyName: string) {
- it('Mark property as timestamp', () => {
- cy.get('#event-schema-next-button').should('be.disabled');
- // Edit timestamp
- cy.dataCy('edit-' + propertyName).click();
+ private static markPropertyAsTimestamp(propertyName: string) {
+ // Mark property as timestamp
+ cy.get('#event-schema-next-button').should('be.disabled');
+ // Edit timestamp
+ cy.dataCy('edit-' + propertyName).click();
- // Mark as timestamp
- cy.dataCy('sp-mark-as-timestamp').children().click();
+ // Mark as timestamp
+ cy.dataCy('sp-mark-as-timestamp').children().click();
- // Close
- cy.dataCy('sp-save-edit-property').click();
+ // Close
+ cy.dataCy('sp-save-edit-property').click();
- cy.get('#event-schema-next-button').parent().should('not.be.disabled');
- });
- }
+ cy.get('#event-schema-next-button').parent().should('not.be.disabled');
+ }
- private static finishEventSchemaConfiguration() {
- it('Click next', () => {
- cy.dataCy('sp-connect-schema-editor', { timeout: 10000 }).should('be.visible');
- cy.get('#event-schema-next-button').click();
- });
- }
+ private static finishEventSchemaConfiguration() {
+ // Click next
+ cy.dataCy('sp-connect-schema-editor', { timeout: 10000 }).should('be.visible');
+ cy.get('#event-schema-next-button').click();
+ }
- private static startStreamAdapter(name) {
- AdapterUtils.startAdapter(name, 'sp-connect-adapter-live-preview');
- }
+ private static startStreamAdapter(name) {
+ AdapterUtils.startAdapter(name, 'sp-connect-adapter-live-preview');
+ }
- private static startSetAdapter(name) {
- AdapterUtils.startAdapter(name, 'sp-connect-adapter-set-success');
- }
+ private static startSetAdapter(name) {
+ AdapterUtils.startAdapter(name, 'sp-connect-adapter-set-success');
+ }
- private static startAdapter(name , successElement) {
- it('Set adapter name', () => {
- cy.dataCy('sp-adapter-name').type(name);
- });
+ private static startAdapter(name , successElement) {
+ // Set adapter name
+ cy.dataCy('sp-adapter-name').type(name);
- it('Start adapter', () => {
- cy.get('#button-startAdapter').click();
- cy.dataCy(successElement , { timeout: 10000 }).should('be.visible');
- });
+ // Start adapter
+ cy.get('#button-startAdapter').click();
+ cy.dataCy(successElement , { timeout: 10000 }).should('be.visible');
- it('Close adapter preview', () => {
- cy.get('button').contains('Close').parent().click();
- });
- }
-
- public static deleteAdapter() {
- it('Delete adapter', () => {
- cy.visit('#/connect');
+ // Close adapter preview
+ cy.get('button').contains('Close').parent().click();
+ }
- cy.get('div').contains('My Adapters').parent().click();
- cy.dataCy('delete').should('have.length', 1);
- cy.dataCy('delete').click();
- cy.dataCy('delete-adapter').click();
- cy.dataCy('adapter-deletion-in-progress' , { timeout: 10000 }).should('be.visible');
- cy.dataCy('delete', { timeout: 20000 }).should('have.length', 0);
- });
- }
+ public static deleteAdapter() {
+ // Delete adapter
+ cy.visit('#/connect');
+
+ cy.get('div').contains('My Adapters').parent().click();
+ cy.dataCy('delete').should('have.length', 1);
+ cy.dataCy('delete').click();
+ cy.dataCy('delete-adapter').click();
+ cy.dataCy('adapter-deletion-in-progress' , { timeout: 10000 }).should('be.visible');
+ cy.dataCy('delete', { timeout: 20000 }).should('have.length', 0);
+ // });
+ }
}
diff --git a/ui/cypress/support/utils/DataLakeUtils.ts b/ui/cypress/support/utils/DataLakeUtils.ts
index a969cc7..be763cf 100644
--- a/ui/cypress/support/utils/DataLakeUtils.ts
+++ b/ui/cypress/support/utils/DataLakeUtils.ts
@@ -24,13 +24,12 @@ export class DataLakeUtils {
public static checkResults(dataLakeIndex: string, fileRoute: string) {
- it('Validate result in datalake', () => {
- cy.request('GET', '/streampipes-backend/api/v3/users/' + UserUtils.testUserName + '/datalake/data/' + dataLakeIndex + '/download?format=csv',
- {'content-type': 'application/octet-stream'}).should((response) => {
- const expectedResultString = response.body;
- cy.readFile(fileRoute).then((actualResultString) => {
- DataLakeUtils.resultEqual(actualResultString, expectedResultString);
- });
+ // Validate result in datalake
+ cy.request('GET', '/streampipes-backend/api/v3/users/' + UserUtils.testUserName + '/datalake/data/' + dataLakeIndex + '/download?format=csv',
+ {'content-type': 'application/octet-stream'}).should((response) => {
+ const expectedResultString = response.body;
+ cy.readFile(fileRoute).then((actualResultString) => {
+ DataLakeUtils.resultEqual(actualResultString, expectedResultString);
});
});
}
diff --git a/ui/cypress/support/utils/FileManagementUtils.ts b/ui/cypress/support/utils/FileManagementUtils.ts
index 2abcf0e..13b0d01 100644
--- a/ui/cypress/support/utils/FileManagementUtils.ts
+++ b/ui/cypress/support/utils/FileManagementUtils.ts
@@ -20,30 +20,25 @@
export class FileManagementUtils {
public static addFile(filePath: string) {
- it('Go to StreamPipes file management', () => {
+ // Go to StreamPipes file management
cy.visit('#/files');
- });
- it('Open file upload dialog', () => {
+ // Open file upload dialog
cy.dataCy('sp-open-file-upload-dialog').click();
- });
- it('Upload file', () => {
+ // Upload file
// const filepath = 'fileTest/test.csv'
cy.dataCy('sp-file-management-file-input').attachFile(filePath);
cy.dataCy('sp-file-management-store-file').click();
- });
}
public static deleteFile() {
- it('Go to StreamPipes file management', () => {
+ // Go to StreamPipes file management
cy.visit('#/files');
- });
- it('Check if file was uploaded and delete it', () => {
+ // Check if file was uploaded and delete it
cy.dataCy('delete').should('have.length', 1);
cy.dataCy('delete').click();
cy.dataCy('confirm-delete').click();
cy.dataCy('delete').should('have.length', 0);
- });
}
}
diff --git a/ui/cypress/support/utils/PipelineUtils.ts b/ui/cypress/support/utils/PipelineUtils.ts
index d8aa243..83ea5d9 100644
--- a/ui/cypress/support/utils/PipelineUtils.ts
+++ b/ui/cypress/support/utils/PipelineUtils.ts
@@ -21,83 +21,82 @@ import { StaticPropertyUtils } from './StaticPropertyUtils';
export class PipelineUtils {
- public static testPipeline(pipelineInput: PipelineInput) {
+ public static testPipeline(pipelineInput: PipelineInput) {
- PipelineUtils.addPipeline(pipelineInput);
+ PipelineUtils.addPipeline(pipelineInput);
- }
+ }
- public static addPipeline(pipelineInput: PipelineInput) {
+ public static addPipeline(pipelineInput: PipelineInput) {
- PipelineUtils.goToPipelineEditor();
+ PipelineUtils.goToPipelineEditor();
- PipelineUtils.selectDataStream(pipelineInput);
+ if (pipelineInput.dataSourceType === 'set') {
+ cy.contains('Data Sets', { timeout: 10000 }).parent().click();
+ }
- PipelineUtils.configurePipeline(pipelineInput);
+ // If data set go to data set tab
- PipelineUtils.startPipeline(pipelineInput);
+ PipelineUtils.selectDataStream(pipelineInput);
- }
+ PipelineUtils.configurePipeline(pipelineInput);
+ PipelineUtils.startPipeline(pipelineInput);
- private static goToPipelineEditor() {
- it('Go to StreamPipes editor', () => {
- cy.visit('#/editor');
- });
- }
+ }
- private static selectDataStream(pipelineInput: PipelineInput) {
- it('Select a stream', () => {
- cy.dataCy('sp-editor-add-pipeline-element').click();
- cy.dataCy(pipelineInput.dataSource).click();
- });
- }
+ private static goToPipelineEditor() {
+ // Go to StreamPipes editor
+ cy.visit('#/editor');
+ }
- private static configurePipeline(pipelineInput: PipelineInput) {
+ private static selectDataStream(pipelineInput: PipelineInput) {
+ // Select a stream
+ cy.dataCy('sp-pipeline-element-' + pipelineInput.dataSource, { timeout: 10000 }).should('be.visible');
+ cy.dataCy('sp-editor-add-pipeline-element').click();
+ cy.dataCy(pipelineInput.dataSource, { timeout: 10000 }).click();
+ }
- it('Select processor', () => {
- cy.dataCy('sp-possible-elements-' + pipelineInput.dataSource, { timeout: 10000 }).click();
- cy.dataCy('sp-compatible-elements-' + pipelineInput.processingElement.name).click();
- });
- StaticPropertyUtils.input(pipelineInput.processingElement.config);
+ private static configurePipeline(pipelineInput: PipelineInput) {
- it('Save configuration', () => {
- cy.dataCy('sp-element-configuration-save').click();
- });
+ // Select processor
+ cy.dataCy('sp-possible-elements-' + pipelineInput.dataSource, { timeout: 10000 }).click();
+ cy.dataCy('sp-compatible-elements-' + pipelineInput.processingElement.name).click();
- it('Select sink', () => {
- cy.dataCy('sp-possible-elements-' + pipelineInput.processingElement.name).click();
- cy.dataCy('sp-compatible-elements-' + pipelineInput.dataSink.name).click();
- });
+ StaticPropertyUtils.input(pipelineInput.processingElement.config);
- StaticPropertyUtils.input(pipelineInput.dataSink.config);
+ // Save configuration
+ cy.dataCy('sp-element-configuration-save').click();
- it('Save sink configuration', () => {
- cy.dataCy('sp-element-configuration-save').click();
- });
+ // Select sink
+ cy.dataCy('sp-possible-elements-' + pipelineInput.processingElement.name, { timeout : 10000 }).click();
+ cy.dataCy('sp-compatible-elements-' + pipelineInput.dataSink.name).click();
- }
+ StaticPropertyUtils.input(pipelineInput.dataSink.config);
- private static startPipeline(pipelineInput: PipelineInput) {
- it('Save and start pipeline', () => {
- cy.dataCy('sp-editor-save-pipeline').click();
- cy.dataCy('sp-editor-pipeline-name').type(pipelineInput.pipelineName);
- cy.dataCy('sp-editor-checkbox-start-immediately').children().click();
- cy.dataCy('sp-editor-save').click();
- cy.dataCy('sp-pipeline-started-dialog', { timeout: 10000 }).should('be.visible');
- cy.dataCy('sp-pipeline-dialog-close', { timeout: 10000 }).click();
- });
- }
+ // Save sink configuration
+ cy.dataCy('sp-element-configuration-save').click();
- public static deletePipeline() {
- it('Delete pipeline', () => {
- cy.visit('#/pipelines');
- cy.dataCy('delete').should('have.length', 1);
- cy.dataCy('delete').click();
- cy.dataCy('sp-pipeline-stop-and-delete').click();
- cy.dataCy('delete', { timeout: 10000 }).should('have.length', 0);
- });
- }
+ }
+
+ private static startPipeline(pipelineInput: PipelineInput) {
+ // Save and start pipeline
+ cy.dataCy('sp-editor-save-pipeline').click();
+ cy.dataCy('sp-editor-pipeline-name').type(pipelineInput.pipelineName);
+ cy.dataCy('sp-editor-checkbox-start-immediately').children().click();
+ cy.dataCy('sp-editor-save').click();
+ cy.dataCy('sp-pipeline-started-dialog', { timeout: 10000 }).should('be.visible');
+ cy.dataCy('sp-pipeline-dialog-close', { timeout: 10000 }).click();
+ }
+
+ public static deletePipeline() {
+ // Delete pipeline
+ cy.visit('#/pipelines');
+ cy.dataCy('delete').should('have.length', 1);
+ cy.dataCy('delete').click();
+ cy.dataCy('sp-pipeline-stop-and-delete').click();
+ cy.dataCy('delete', { timeout: 10000 }).should('have.length', 0);
+ }
}
diff --git a/ui/cypress/support/utils/ProcessingElementTestUtils.ts b/ui/cypress/support/utils/ProcessingElementTestUtils.ts
index c549e43..5d5d6c6 100644
--- a/ui/cypress/support/utils/ProcessingElementTestUtils.ts
+++ b/ui/cypress/support/utils/ProcessingElementTestUtils.ts
@@ -29,9 +29,6 @@ import { ProcessorTest } from '../model/ProcessorTest';
export class ProcessingElementTestUtils {
public static testElement(pipelineElementTest: ProcessorTest) {
- // public static testElement(testName: string, inputFile: string, expectedResultFile: string, processor: PipelineElementInput) {
- // Test
-
const inputFile = 'pipelineElement/' + pipelineElementTest.dir + '/' + pipelineElementTest.inputFile;
const expectedResultFile = 'pipelineElement/' + pipelineElementTest.dir + '/expected.csv';
@@ -64,6 +61,7 @@ export class ProcessingElementTestUtils {
// Build Pipeline
const pipelineInput = PipelineBuilder.create(pipelineElementTest.name)
.addSource(adapterName)
+ .addSourceType('set')
.addProcessingElement(pipelineElementTest.processor)
.addSink(
PipelineElementBuilder.create('data_lake')
@@ -73,10 +71,8 @@ export class ProcessingElementTestUtils {
PipelineUtils.addPipeline(pipelineInput);
- // // Wait
- it('Wait till data is stored', () => {
- cy.wait(10000);
- });
+ // Wait till data is stored
+ cy.wait(10000);
DataLakeUtils.checkResults(dataLakeIndex, 'cypress/fixtures/' + expectedResultFile);
diff --git a/ui/cypress/support/utils/StaticPropertyUtils.ts b/ui/cypress/support/utils/StaticPropertyUtils.ts
index fdf7ef4..03906f9 100644
--- a/ui/cypress/support/utils/StaticPropertyUtils.ts
+++ b/ui/cypress/support/utils/StaticPropertyUtils.ts
@@ -22,18 +22,17 @@ export class StaticPropertyUtils {
public static input(configs: UserInput[]) {
- it('Configure Properties', () => {
- configs.forEach(config => {
- if (config.type === 'checkbox') {
- cy.dataCy(config.selector).children().click();
- } else if (config.type === 'drop-down') {
- cy.dataCy(config.selector).click().get('mat-option').contains(config.value).click();
- } else if (config.type === 'radio') {
- cy.dataCy(config.selector + config.value ).click();
- } else {
- cy.dataCy(config.selector).type(config.value);
- }
- });
+ // Configure Properties
+ configs.forEach(config => {
+ if (config.type === 'checkbox') {
+ cy.dataCy(config.selector).children().click();
+ } else if (config.type === 'drop-down') {
+ cy.dataCy(config.selector).click().get('mat-option').contains(config.value).click();
+ } else if (config.type === 'radio') {
+ cy.dataCy(config.selector + config.value ).click();
+ } else {
+ cy.dataCy(config.selector).type(config.value);
+ }
});
}
}
diff --git a/ui/cypress/tests/adapter/fileStream.ts b/ui/cypress/tests/adapter/fileStream.ts
index ea56758..68f7c99 100644
--- a/ui/cypress/tests/adapter/fileStream.ts
+++ b/ui/cypress/tests/adapter/fileStream.ts
@@ -20,26 +20,26 @@ import { AdapterUtils } from '../../support/utils/AdapterUtils';
import { FileManagementUtils } from '../../support/utils/FileManagementUtils';
import { GenericAdapterBuilder } from '../../support/builder/GenericAdapterBuilder';
-before('Setup Test', () => {
- it('Initialize Test', () => {
+describe('Test File Stream Adapter', () => {
+ before('Setup Test', () => {
cy.initStreamPipesTest();
+ FileManagementUtils.addFile('fileTest/random.csv');
});
- FileManagementUtils.addFile('fileTest/random.csv');
-});
-
-describe('Test File Stream Adapter', () => {
- const adapterInput = GenericAdapterBuilder
- .create('File_Stream')
- .setName('File Stream Adapter Test')
- .setTimestampProperty('timestamp')
- .addProtocolInput('input', 'speed', '1')
- .addProtocolInput('checkbox', 'replaceTimestamp', 'check')
- .setFormat('csv')
- .addFormatInput('input', 'delimiter', ';')
- .addFormatInput('checkbox', 'header', 'check')
- .build();
+ it('Perform Test', () => {
+ const adapterInput = GenericAdapterBuilder
+ .create('File_Stream')
+ .setName('File Stream Adapter Test')
+ .setTimestampProperty('timestamp')
+ .addProtocolInput('input', 'speed', '1')
+ .addProtocolInput('checkbox', 'replaceTimestamp', 'check')
+ .setFormat('csv')
+ .addFormatInput('input', 'delimiter', ';')
+ .addFormatInput('checkbox', 'header', 'check')
+ .build();
- AdapterUtils.testGenericStreamAdapter(adapterInput);
+ AdapterUtils.testGenericStreamAdapter(adapterInput);
+ });
});
+
diff --git a/ui/cypress/tests/adapter/machineDataSimulator.ts b/ui/cypress/tests/adapter/machineDataSimulator.ts
index 2add7dd..bd617cd 100644
--- a/ui/cypress/tests/adapter/machineDataSimulator.ts
+++ b/ui/cypress/tests/adapter/machineDataSimulator.ts
@@ -20,18 +20,19 @@ import { AdapterUtils } from '../../support/utils/AdapterUtils';
import { SpecificAdapterBuilder } from '../../support/builder/SpecificAdapterBuilder';
import { FileManagementUtils } from '../../support/utils/FileManagementUtils';
-before('Setup Test', () => {
- it('Initialize Test', () => {
+describe('Test Random Data Simulator Stream Adapter', () => {
+ before('Setup Test', () => {
cy.initStreamPipesTest();
});
-});
-describe('Test Random Data Simulator Stream Adapter', () => {
- const adapterInput = SpecificAdapterBuilder
- .create('Machine_Data_Simulator')
- .setName('Machine Data Simulator Test')
- .addInput('input', 'wait-time-ms', '1000')
- .build();
+ it('Perform Test', () => {
+ const adapterInput = SpecificAdapterBuilder
+ .create('Machine_Data_Simulator')
+ .setName('Machine Data Simulator Test')
+ .addInput('input', 'wait-time-ms', '1000')
+ .build();
+
+ AdapterUtils.testSpecificStreamAdapter(adapterInput);
+ });
- AdapterUtils.testSpecificStreamAdapter(adapterInput);
});
diff --git a/ui/cypress/tests/adapter/randomDataSimulatorStream.spec.ts b/ui/cypress/tests/adapter/randomDataSimulatorStream.spec.ts
index 8489023..ec4f95e 100644
--- a/ui/cypress/tests/adapter/randomDataSimulatorStream.spec.ts
+++ b/ui/cypress/tests/adapter/randomDataSimulatorStream.spec.ts
@@ -19,19 +19,18 @@
import { AdapterUtils } from '../../support/utils/AdapterUtils';
import { SpecificAdapterBuilder } from '../../support/builder/SpecificAdapterBuilder';
-before('Setup Test', () => {
- it('Initialize Test', () => {
+describe('Test Random Data Simulator Stream Adapter', () => {
+ before('Setup Test', () => {
cy.initStreamPipesTest();
});
-});
-describe('Test Random Data Simulator Stream Adapter', () => {
+ it('Perform Test', () => {
+ const adapterInput = SpecificAdapterBuilder
+ .create('Random_Data_Simulator_\\(Stream\\)')
+ .setName('Random Data Simulator Adapter Test')
+ .addInput('input', 'wait-time-ms', '1000')
+ .build();
- const adapterInput = SpecificAdapterBuilder
- .create('Random_Data_Simulator_\\(Stream\\)')
- .setName('Random Data Simulator Adapter Test')
- .addInput('input', 'wait-time-ms', '1000')
- .build();
-
- AdapterUtils.testSpecificStreamAdapter(adapterInput);
+ AdapterUtils.testSpecificStreamAdapter(adapterInput);
+ });
});
diff --git a/ui/cypress/tests/fileManagement/testFileManagement.ts b/ui/cypress/tests/fileManagement/testFileManagement.ts
index b726ae8..c23cfe3 100644
--- a/ui/cypress/tests/fileManagement/testFileManagement.ts
+++ b/ui/cypress/tests/fileManagement/testFileManagement.ts
@@ -18,13 +18,14 @@
import { FileManagementUtils } from '../../support/utils/FileManagementUtils';
-before('Setup Test', () => {
- it('Initialize Test', () => {
+
+describe('Test File Management', () => {
+ before('Setup Test', () => {
cy.initStreamPipesTest();
});
-});
-describe('Test File Management', () => {
- FileManagementUtils.addFile('fileTest/test.csv');
- FileManagementUtils.deleteFile();
+ it('Perform Test', () => {
+ FileManagementUtils.addFile('fileTest/test.csv');
+ FileManagementUtils.deleteFile();
+ });
});
diff --git a/ui/cypress/tests/installation/installation.ts b/ui/cypress/tests/installation/installation.ts
index b162489..62e0374 100644
--- a/ui/cypress/tests/installation/installation.ts
+++ b/ui/cypress/tests/installation/installation.ts
@@ -18,16 +18,17 @@
import { UserUtils } from '../../support/utils/UserUtils';
-before('Setup Test', () => {
- it('Open Streampipes', () => {
- cy.visit('#/login');
- });
-});
describe('Install StreamPipes', () => {
+ before('Setup Test', () => {
+ it('Open Streampipes', () => {
+ cy.visit('#/login');
+ });
+ });
+
let isSetupPage: boolean;
- it('Install StreamPipes', () => {
+ it('Perform Test', () => {
cy.url({ timeout: 60000 }).then(($route) => {
isSetupPage = ($route.endsWith('setup')) ? true : false;
if (isSetupPage) {
diff --git a/ui/cypress/tests/pipeline/pipelineTest.ts b/ui/cypress/tests/pipeline/pipelineTest.ts
index 19cb63c..6ce625e 100644
--- a/ui/cypress/tests/pipeline/pipelineTest.ts
+++ b/ui/cypress/tests/pipeline/pipelineTest.ts
@@ -23,28 +23,28 @@ import { PipelineBuilder } from '../../support/builder/PipelineBuilder';
const adapterName = 'simulator';
-before('Setup Test', () => {
- it('Initialize Test', () => {
- cy.initStreamPipesTest();
- });
-
- AdapterUtils.addMachineDataSimulator(adapterName);
-});
describe('Test Random Data Simulator Stream Adapter', () => {
- const pipelineInput = PipelineBuilder.create('Pipeline Test')
- .addSource(adapterName)
- .addProcessingElement(
- PipelineElementBuilder.create('field_renamer')
- .addInput('drop-down', 'convert-property', 'timestamp')
- .addInput('input', 'field-name', 't')
- .build())
- .addSink(
- PipelineElementBuilder.create('dashboard_sink')
- .addInput('input', 'visualization-name', 'Demo')
- .build())
- .build();
+ before('Setup Test', () => {
+ cy.initStreamPipesTest();
+ AdapterUtils.addMachineDataSimulator(adapterName);
+ });
- PipelineUtils.testPipeline(pipelineInput);
-});
+ it('Perform Test', () => {
+ const pipelineInput = PipelineBuilder.create('Pipeline Test')
+ .addSource(adapterName)
+ .addProcessingElement(
+ PipelineElementBuilder.create('field_renamer')
+ .addInput('drop-down', 'convert-property', 'timestamp')
+ .addInput('input', 'field-name', 't')
+ .build())
+ .addSink(
+ PipelineElementBuilder.create('dashboard_sink')
+ .addInput('input', 'visualization-name', 'Demo')
+ .build())
+ .build();
+
+ PipelineUtils.testPipeline(pipelineInput);
+ });
+ });
diff --git a/ui/cypress/tests/pipelineElement/AllPipelineElements.ts b/ui/cypress/tests/pipelineElement/AllPipelineElements.ts
index 20472a5..b3fdac4 100644
--- a/ui/cypress/tests/pipelineElement/AllPipelineElements.ts
+++ b/ui/cypress/tests/pipelineElement/AllPipelineElements.ts
@@ -23,15 +23,16 @@ import { AdapterUtils } from '../../support/utils/AdapterUtils';
const allTests = Cypress.env('processingElements');
allTests.forEach(test => {
- before('Setup Test', () => {
- it('Initialize Test', () => {
+
+ describe('Test Processor ' + test['name'], () => {
+ before('Setup Test', () => {
cy.initStreamPipesTest();
});
- });
- describe('Test Processor ' + test['name'], () => {
- const processorTest = test as ProcessorTest;
+ it('Perform Test', () => {
+ const processorTest = test as ProcessorTest;
+ ProcessingElementTestUtils.testElement(processorTest);
+ });
- ProcessingElementTestUtils.testElement(processorTest);
});
});
diff --git a/ui/cypress/tests/pipelineElement/SinglePipelineElement.ts b/ui/cypress/tests/pipelineElement/SinglePipelineElement.ts
index 7769e7b..28ab376 100644
--- a/ui/cypress/tests/pipelineElement/SinglePipelineElement.ts
+++ b/ui/cypress/tests/pipelineElement/SinglePipelineElement.ts
@@ -27,14 +27,15 @@ allTests.forEach(test => {
const processorTest = test as ProcessorTest;
if (processorTest.name === testName) {
- before('Setup Test', () => {
- it('Initialize Test', () => {
+
+ describe('Test Processor ' + test.dir, () => {
+ before('Setup Test', () => {
cy.initStreamPipesTest();
});
- });
- describe('Test Processor ' + test.dir, () => {
- ProcessingElementTestUtils.testElement(processorTest);
+ it('Initialize Test', () => {
+ ProcessingElementTestUtils.testElement(processorTest);
+ });
});
}
});
diff --git a/ui/src/app/editor/components/pipeline-element-icon-stand/pipeline-element-icon-stand.component.html b/ui/src/app/editor/components/pipeline-element-icon-stand/pipeline-element-icon-stand.component.html
index 595f385..e53dfee 100644
--- a/ui/src/app/editor/components/pipeline-element-icon-stand/pipeline-element-icon-stand.component.html
+++ b/ui/src/app/editor/components/pipeline-element-icon-stand/pipeline-element-icon-stand.component.html
@@ -56,7 +56,11 @@
[attr.data-pe]="element.elementId"
[ngClass]="activeCssClass">
<span id="container" style="position:relative;display:block;width:80px;height:80px;">
- <pipeline-element id="pe-icon-stand-{{ element.appId }}" style="margin-left:-3%" [iconStandSize]="true" [pipelineElement]="element"
+ <pipeline-element
+ id="pe-icon-stand-{{ element.appId }}"
+ style="margin-left:-3%" [iconStandSize]="true"
+ [attr.data-cy]="'sp-pipeline-element-' + element.name.toLowerCase().replaceAll(' ', '_')"
+ [pipelineElement]="element"
[preview]="false"></pipeline-element>
<span style="display:block;width:100%;height:100%;position:absolute; top:0; left:0;"
*ngIf="currentElementName===element.name">
diff --git a/ui/src/app/editor/editor.component.html b/ui/src/app/editor/editor.component.html
index 93c1c09..14fa027 100644
--- a/ui/src/app/editor/editor.component.html
+++ b/ui/src/app/editor/editor.component.html
@@ -22,7 +22,10 @@
<div fxFlex fxLayoutAlign="start center" [attr.id]="'peType'">
<mat-tab-group [selectedIndex]="selectedIndex"
(selectedIndexChange)="selectPipelineElements($event)" color="accent">
- <mat-tab *ngFor="let tab of tabs" label="{{tab.title}}"></mat-tab>
+ <mat-tab
+ *ngFor="let tab of tabs"
+ [attr.id]="tab.shorthand"
+ label="{{tab.title}}"></mat-tab>
</mat-tab-group>
</div>
<div fxFlex="30" fxLayout="row" fxLayoutAlign="end center" style="padding-left:10px;font-size:14px;line-height:24px;">