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 2023/04/04 15:12:28 UTC

[streampipes] 01/01: [#1289] Fix cypress test for data lake configuration

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

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

commit b0e06e114a91506252cb86eaa296a6dbf8fee4ed
Author: Philipp Zehnder <te...@users.noreply.github.com>
AuthorDate: Tue Apr 4 17:11:59 2023 +0200

    [#1289] Fix cypress test for data lake configuration
---
 ui/cypress/support/utils/PrepareTestDataUtils.ts   |  8 ++--
 .../tests/datalake/configuration.smoke.spec.ts     | 53 ++++++++++++----------
 2 files changed, 33 insertions(+), 28 deletions(-)

diff --git a/ui/cypress/support/utils/PrepareTestDataUtils.ts b/ui/cypress/support/utils/PrepareTestDataUtils.ts
index 6ff139280..c90726f26 100644
--- a/ui/cypress/support/utils/PrepareTestDataUtils.ts
+++ b/ui/cypress/support/utils/PrepareTestDataUtils.ts
@@ -19,7 +19,6 @@
 import { FileManagementUtils } from './FileManagementUtils';
 import { ConnectUtils } from './connect/ConnectUtils';
 import { GenericAdapterBuilder } from '../builder/GenericAdapterBuilder';
-import { UserInputBuilder } from '../builder/UserInputBuilder';
 
 export class PrepareTestDataUtils {
     public static dataName = 'prepared_data';
@@ -38,7 +37,9 @@ export class PrepareTestDataUtils {
             storeInDataLake,
         );
 
-        ConnectUtils.addGenericStreamAdapter(adapter);
+        ConnectUtils.addGenericAdapter(adapter);
+
+        ConnectUtils.startAdapter(adapter, true);
     }
 
     private static getDataLakeTestAdapter(
@@ -53,7 +54,8 @@ export class PrepareTestDataUtils {
                 'radio',
                 'speed',
                 'fastest_\\(ignore_original_time\\)',
-            );
+            )
+            .addProtocolInput('radio', 'replayonce', 'yes');
 
         if (format === 'csv') {
             adapterBuilder
diff --git a/ui/cypress/tests/datalake/configuration.smoke.spec.ts b/ui/cypress/tests/datalake/configuration.smoke.spec.ts
index 6fe4ce897..bbb1afae1 100644
--- a/ui/cypress/tests/datalake/configuration.smoke.spec.ts
+++ b/ui/cypress/tests/datalake/configuration.smoke.spec.ts
@@ -39,38 +39,41 @@ describe('Test Truncate data in datalake', () => {
             .should('be.visible')
             .click();
 
-        // Check if amount of events is zero
+        // Check if amount of events is zero. The should('have.text, '0') is required to check for text equality
         cy.dataCy('datalake-number-of-events', { timeout: 10000 })
             .should('be.visible')
-            .contains('0');
+            .should($element => {
+                const text = $element.text().trim();
+                expect(text).to.equal('0');
+            });
     });
-});
 
-describe('Delete data in datalake', () => {
-    before('Setup Test', () => {
-        cy.initStreamPipesTest();
-        DataLakeUtils.loadRandomDataSetIntoDataLake();
-        PipelineUtils.deletePipeline();
-    });
+    describe('Delete data in datalake', () => {
+        before('Setup Test', () => {
+            cy.initStreamPipesTest();
+            DataLakeUtils.loadRandomDataSetIntoDataLake();
+            PipelineUtils.deletePipeline();
+        });
 
-    it('Perform Test', () => {
-        DataLakeUtils.goToDatalakeConfiguration();
+        it('Perform Test', () => {
+            DataLakeUtils.goToDatalakeConfiguration();
 
-        // Check if amount of events is correct
-        cy.dataCy('datalake-number-of-events', { timeout: 10000 })
-            .should('be.visible')
-            .contains('10');
+            // Check if amount of events is correct
+            cy.dataCy('datalake-number-of-events', { timeout: 10000 })
+                .should('be.visible')
+                .contains('10');
 
-        // Delete data
-        cy.dataCy('datalake-delete-btn').should('be.visible').click();
-        cy.dataCy('confirm-delete-data-btn', { timeout: 10000 })
-            .should('be.visible')
-            .click();
+            // Delete data
+            cy.dataCy('datalake-delete-btn').should('be.visible').click();
+            cy.dataCy('confirm-delete-data-btn', { timeout: 10000 })
+                .should('be.visible')
+                .click();
 
-        // Check if amount of events is zero
-        cy.dataCy('datalake-number-of-events', { timeout: 10000 }).should(
-            'have.length',
-            0,
-        );
+            // Check if amount of events is zero
+            cy.dataCy('datalake-number-of-events', { timeout: 10000 }).should(
+                'have.length',
+                0,
+            );
+        });
     });
 });