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 2022/03/13 17:27:31 UTC

[incubator-streampipes] 04/04: [STREAMPIPES-514] Adapted tests for new format selection

This is an automated email from the ASF dual-hosted git repository.

zehnder pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git

commit 89ecfe10f2b5b50fb74884f2bf45f257ff003ac4
Author: Philipp Zehnder <ze...@fzi.de>
AuthorDate: Sun Mar 13 18:21:38 2022 +0100

    [STREAMPIPES-514] Adapted tests for new format selection
---
 ui/cypress/support/builder/GenericAdapterBuilder.ts  |  5 +++--
 ui/cypress/support/model/UserInput.ts                |  4 +++-
 .../{pipeline/PipelineInput.ts => UserInputType.ts}  | 20 ++++++++++----------
 ui/cypress/support/utils/ConnectUtils.ts             | 12 +++++++++++-
 .../support/utils/ProcessingElementTestUtils.ts      |  2 +-
 .../{valueRules.smoke.spec.ts => valueRules.ts}      |  0
 .../tests/pipelineElement/SinglePipelineElement.ts   |  2 +-
 .../tests/thirdparty/{Mqtt.smoke.spec.ts => Mqtt.ts} |  0
 8 files changed, 29 insertions(+), 16 deletions(-)

diff --git a/ui/cypress/support/builder/GenericAdapterBuilder.ts b/ui/cypress/support/builder/GenericAdapterBuilder.ts
index 5fec476..f06962a 100644
--- a/ui/cypress/support/builder/GenericAdapterBuilder.ts
+++ b/ui/cypress/support/builder/GenericAdapterBuilder.ts
@@ -18,6 +18,7 @@
 
 import { UserInput } from '../model/UserInput';
 import { GenericAdapterInput } from '../model/GenericAdapterInput';
+import { UserInputType } from '../model/UserInputType';
 
 export class GenericAdapterBuilder {
   genericAdapterInput: GenericAdapterInput;
@@ -53,7 +54,7 @@ export class GenericAdapterBuilder {
     return this;
   }
 
-  public addProtocolInput(type: string, selector: string, value: string) {
+  public addProtocolInput(type: UserInputType, selector: string, value: string) {
     const userInput = new UserInput();
     userInput.type = type;
     userInput.selector = selector;
@@ -69,7 +70,7 @@ export class GenericAdapterBuilder {
     return this;
   }
 
-  public addFormatInput(type: string, selector: string, value: string) {
+  public addFormatInput(type: UserInputType, selector: string, value: string) {
     const userInput = new UserInput();
     userInput.type = type;
     userInput.selector = selector;
diff --git a/ui/cypress/support/model/UserInput.ts b/ui/cypress/support/model/UserInput.ts
index 50de86d..1c9c675 100644
--- a/ui/cypress/support/model/UserInput.ts
+++ b/ui/cypress/support/model/UserInput.ts
@@ -16,8 +16,10 @@
  *
  */
 
+import { UserInputType } from './UserInputType';
+
 export class UserInput {
-    type: 'checkbox' | 'input' | 'file' | 'drop-down' | 'radio' | 'code-input' | 'click' | 'button';
+    type: UserInputType;
     selector: string;
     value: string;
 }
diff --git a/ui/cypress/support/model/pipeline/PipelineInput.ts b/ui/cypress/support/model/UserInputType.ts
similarity index 74%
rename from ui/cypress/support/model/pipeline/PipelineInput.ts
rename to ui/cypress/support/model/UserInputType.ts
index bb8fd2c..694b84c 100644
--- a/ui/cypress/support/model/pipeline/PipelineInput.ts
+++ b/ui/cypress/support/model/UserInputType.ts
@@ -16,14 +16,14 @@
  *
  */
 
-import { PipelineElementInput } from './PipelineElementInput';
+export type UserInputType =
+    'checkbox' |
+    'input' |
+    'file' |
+    'drop-down' |
+    'radio' |
+    'code-input' |
+    'click' |
+    'button' |
+    'select';
 
-export class PipelineInput {
-    pipelineName: string;
-    dataSource: string;
-    dataSourceType: string | 'stream' | 'set';
-
-    processingElement: PipelineElementInput;
-
-    dataSink: PipelineElementInput;
-}
diff --git a/ui/cypress/support/utils/ConnectUtils.ts b/ui/cypress/support/utils/ConnectUtils.ts
index 7a9aa0c..becfa72 100644
--- a/ui/cypress/support/utils/ConnectUtils.ts
+++ b/ui/cypress/support/utils/ConnectUtils.ts
@@ -131,8 +131,18 @@ export class ConnectUtils {
   }
 
   public static configureFormat(adapterConfiguration: GenericAdapterInput) {
+
     // Select format
-    cy.dataCy(adapterConfiguration.format).click();
+    if (adapterConfiguration.format.indexOf('json') !== -1) {
+      cy.dataCy('connect-select-json-formats').click();
+      if (adapterConfiguration.format.indexOf('object') !== -1) {
+        cy.dataCy('single_object').click();
+      } else {
+        cy.dataCy('array').click();
+      }
+    } else {
+      cy.dataCy(adapterConfiguration.format).click();
+    }
 
     StaticPropertyUtils.input(adapterConfiguration.formatConfiguration);
 
diff --git a/ui/cypress/support/utils/ProcessingElementTestUtils.ts b/ui/cypress/support/utils/ProcessingElementTestUtils.ts
index c531427..4735bde 100644
--- a/ui/cypress/support/utils/ProcessingElementTestUtils.ts
+++ b/ui/cypress/support/utils/ProcessingElementTestUtils.ts
@@ -32,7 +32,7 @@ export class ProcessingElementTestUtils {
         const expectedResultFile = 'pipelineElement/' + pipelineElementTest.dir + '/expected.csv';
 
         let formatType;
-        pipelineElementTest.inputFile.endsWith('.csv') ? formatType = 'csv' : formatType = 'json_array_no_key';
+        pipelineElementTest.inputFile.endsWith('.csv') ? formatType = 'csv' : formatType = 'json_array';
 
         FileManagementUtils.addFile(inputFile);
 
diff --git a/ui/cypress/tests/adapter/valueRules.smoke.spec.ts b/ui/cypress/tests/adapter/valueRules.ts
similarity index 100%
rename from ui/cypress/tests/adapter/valueRules.smoke.spec.ts
rename to ui/cypress/tests/adapter/valueRules.ts
diff --git a/ui/cypress/tests/pipelineElement/SinglePipelineElement.ts b/ui/cypress/tests/pipelineElement/SinglePipelineElement.ts
index c223236..635d222 100644
--- a/ui/cypress/tests/pipelineElement/SinglePipelineElement.ts
+++ b/ui/cypress/tests/pipelineElement/SinglePipelineElement.ts
@@ -22,7 +22,7 @@ import { ProcessorTest } from '../../support/model/ProcessorTest';
 const allTests = Cypress.env('processingElements');
 
 allTests.forEach(test => {
-  const testNames = ['count1'];
+  const testNames = ['countArray1'];
 
   const processorTest = test as ProcessorTest;
 
diff --git a/ui/cypress/tests/thirdparty/Mqtt.smoke.spec.ts b/ui/cypress/tests/thirdparty/Mqtt.ts
similarity index 100%
rename from ui/cypress/tests/thirdparty/Mqtt.smoke.spec.ts
rename to ui/cypress/tests/thirdparty/Mqtt.ts