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

SvenO3 pushed a commit to branch 4566-add-details-view-for-data-sets
in repository https://gitbox.apache.org/repos/asf/streampipes.git


The following commit(s) were added to 
refs/heads/4566-add-details-view-for-data-sets by this push:
     new bc27985f9e Create cypress test
bc27985f9e is described below

commit bc27985f9e1bf5c3749de620f762a6252450524f
Author: Sven Oehler <[email protected]>
AuthorDate: Fri Jun 19 12:30:53 2026 +0200

    Create cypress test
---
 ui/cypress/support/utils/GeneralUtils.ts           |  2 +-
 ui/cypress/support/utils/dataset/DatasetBtns.ts    | 34 ++++++++++++
 ui/cypress/support/utils/dataset/DatasetUtils.ts   | 61 ++++++++++++++++++++++
 ui/cypress/tests/dataset/datasetDetails.spec.ts    | 58 ++++++++++++++++++++
 .../datalake-configuration.component.html          | 16 ++++--
 .../dataset-details-schema.component.html          | 18 ++++++-
 6 files changed, 182 insertions(+), 7 deletions(-)

diff --git a/ui/cypress/support/utils/GeneralUtils.ts 
b/ui/cypress/support/utils/GeneralUtils.ts
index b972c0acf0..0a854b4192 100644
--- a/ui/cypress/support/utils/GeneralUtils.ts
+++ b/ui/cypress/support/utils/GeneralUtils.ts
@@ -18,7 +18,7 @@
 
 export class GeneralUtils {
     public static tab(identifier: string) {
-        return cy.dataCy(`tab-${identifier}`).click();
+        return cy.get(`[data-cy="tab-${identifier}"]`).click();
     }
 
     public static openMenuForRow(rowText: string) {
diff --git a/ui/cypress/support/utils/dataset/DatasetBtns.ts 
b/ui/cypress/support/utils/dataset/DatasetBtns.ts
index a3ea274575..4cd6a5b4d6 100644
--- a/ui/cypress/support/utils/dataset/DatasetBtns.ts
+++ b/ui/cypress/support/utils/dataset/DatasetBtns.ts
@@ -111,6 +111,40 @@ export class DatasetBtns {
         });
     }
 
+    public static datasetDetailsSchemaTable() {
+        return cy.dataCy('dataset-details-schema-table', { timeout: 10000 });
+    }
+
+    public static datasetDetailsSchemaField(runtimeName: string) {
+        return cy.dataCy(`dataset-details-schema-field-${runtimeName}`, {
+            timeout: 10000,
+        });
+    }
+
+    public static datasetDetailsSchemaType(runtimeName: string) {
+        return cy.dataCy(`dataset-details-schema-type-${runtimeName}`, {
+            timeout: 10000,
+        });
+    }
+
+    public static datasetDetailsEventLimit() {
+        return cy.dataCy('dataset-details-event-limit', { timeout: 10000 });
+    }
+
+    public static datasetDetailsEventsTable() {
+        return cy.dataCy('dataset-details-events-table', { timeout: 30000 });
+    }
+
+    public static datasetDetailsEventCell(columnName: string) {
+        return cy.dataCy(`dataset-details-event-cell-${columnName}`, {
+            timeout: 30000,
+        });
+    }
+
+    public static datasetDetailsCreateChart() {
+        return cy.dataCy('dataset-details-create-chart', { timeout: 10000 });
+    }
+
     public static datasetTotalCountCell(name: string) {
         return this.datasetRow(name).find(
             '[data-cy="datalake-number-of-events"]',
diff --git a/ui/cypress/support/utils/dataset/DatasetUtils.ts 
b/ui/cypress/support/utils/dataset/DatasetUtils.ts
index 8ff9ce4b71..e5ef33302c 100644
--- a/ui/cypress/support/utils/dataset/DatasetUtils.ts
+++ b/ui/cypress/support/utils/dataset/DatasetUtils.ts
@@ -17,6 +17,7 @@
  */
 
 import { PermissionUtils } from '../user/PermissionUtils';
+import { GeneralUtils } from '../GeneralUtils';
 import { DatasetBtns } from './DatasetBtns';
 
 export class DatasetUtils {
@@ -150,6 +151,66 @@ export class DatasetUtils {
             .click();
     }
 
+    public static openDatasetDetails(datasetName: string) {
+        DatasetUtils.goToDatasets();
+        DatasetUtils.waitForTotalEvents(datasetName);
+        DatasetBtns.datasetRow(datasetName).click();
+        cy.url().should('include', '#/datasets/');
+    }
+
+    public static waitForTotalEvents(datasetName: string, attempts = 30) {
+        DatasetBtns.datasetTotalCountButton(datasetName).click({
+            force: true,
+        });
+        DatasetBtns.datasetTotalCountCell(datasetName)
+            .find('[data-cy="datalake-number-of-events-spinner"]')
+            .should('not.exist');
+        DatasetBtns.datasetTotalCountCell(datasetName).then($cell => {
+            const eventCount = DatasetUtils.parseEventCount($cell.text());
+
+            if (eventCount > 0) {
+                expect(eventCount).to.be.greaterThan(0);
+            } else if (attempts > 0) {
+                cy.wait(1000);
+                DatasetUtils.waitForTotalEvents(datasetName, attempts - 1);
+            } else {
+                expect(eventCount).to.be.greaterThan(0);
+            }
+        });
+    }
+
+    private static parseEventCount(text: string) {
+        return Number(text.trim().replace(/[^\d.-]/g, ''));
+    }
+
+    public static openLatestEventsTab() {
+        GeneralUtils.tab('Latest events');
+    }
+
+    public static setLatestEventsLimit(limit: number) {
+        DatasetBtns.datasetDetailsEventLimit().clear().type(`${limit}`);
+        DatasetBtns.datasetDetailsEventLimit().blur();
+    }
+
+    public static expectSchemaField(runtimeName: string, expectedType: string) 
{
+        
DatasetBtns.datasetDetailsSchemaField(runtimeName).should('be.visible');
+        DatasetBtns.datasetDetailsSchemaType(runtimeName).should(
+            'contain.text',
+            expectedType,
+        );
+    }
+
+    public static expectLatestEventsForColumn(columnName: string) {
+        DatasetBtns.datasetDetailsEventsTable().should('be.visible');
+        DatasetBtns.datasetDetailsEventCell(columnName)
+            .should('exist')
+            .and('have.length.at.least', 1);
+    }
+
+    public static createChartFromDatasetDetails() {
+        DatasetBtns.datasetDetailsCreateChart().click();
+    }
+
     public static expectDatasetPreviewDoesNotContainKey(key: string) {
         cy.dataCy('dataset-preview-table', { timeout: 10000 }).should(
             'be.visible',
diff --git a/ui/cypress/tests/dataset/datasetDetails.spec.ts 
b/ui/cypress/tests/dataset/datasetDetails.spec.ts
new file mode 100644
index 0000000000..b17838fcdc
--- /dev/null
+++ b/ui/cypress/tests/dataset/datasetDetails.spec.ts
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { ConnectUtils } from '../../support/utils/connect/ConnectUtils';
+import { DatasetBtns } from '../../support/utils/dataset/DatasetBtns';
+import { DatasetUtils } from '../../support/utils/dataset/DatasetUtils';
+
+describe('Test Data Set Details', () => {
+    beforeEach('Setup Test', () => {
+        cy.initStreamPipesTest();
+    });
+
+    it('Shows schema and latest events and opens chart creation', () => {
+        const adapterName = 'Machine Data Simulator Dataset Details';
+
+        ConnectUtils.addMachineDataSimulator(adapterName, true, '100');
+        DatasetUtils.openDatasetDetails(adapterName);
+
+        DatasetBtns.datasetDetailsSchemaTable().should('be.visible');
+        DatasetUtils.expectSchemaField('density', 'Number');
+        DatasetUtils.expectSchemaField('mass_flow', 'Number');
+        DatasetUtils.expectSchemaField('sensorId', 'Text');
+        DatasetUtils.expectSchemaField('sensor_fault_flags', 'Boolean');
+
+        DatasetUtils.openLatestEventsTab();
+        DatasetUtils.expectLatestEventsForColumn('density');
+        DatasetUtils.expectLatestEventsForColumn('mass_flow');
+        DatasetUtils.setLatestEventsLimit(5);
+        DatasetUtils.expectLatestEventsForColumn('density');
+        DatasetUtils.expectLatestEventsForColumn('mass_flow');
+
+        DatasetUtils.createChartFromDatasetDetails();
+
+        cy.url().should('include', '#/chart/create');
+        cy.url().should(
+            'include',
+            `measureName=${encodeURIComponent(adapterName)}`,
+        );
+        cy.dataCy('data-explorer-select-data-set').should(
+            'have.value',
+            adapterName,
+        );
+    });
+});
diff --git 
a/ui/src/app/dataset/components/datalake-configuration/datalake-configuration.component.html
 
b/ui/src/app/dataset/components/datalake-configuration/datalake-configuration.component.html
index a6fce58ee0..72c6816298 100644
--- 
a/ui/src/app/dataset/components/datalake-configuration/datalake-configuration.component.html
+++ 
b/ui/src/app/dataset/components/datalake-configuration/datalake-configuration.component.html
@@ -94,7 +94,11 @@
                     <th mat-header-cell mat-sort-header *matHeaderCellDef>
                         {{ '# Events (7d)' | translate }}
                     </th>
-                    <td mat-cell *matCellDef="let configurationEntry">
+                    <td
+                        mat-cell
+                        data-cy="datalake-number-of-events-latest"
+                        *matCellDef="let configurationEntry"
+                    >
                         @if (configurationEntry.eventsLatestLoading) {
                             <mat-spinner
                                 [diameter]="20"
@@ -139,6 +143,7 @@
                                     <sp-label
                                         tone="neutral"
                                         class="cursor-pointer"
+                                        data-cy="datalake-total-count-button"
                                         minWidth="100px"
                                         [labelText]="
                                             configurationEntry.eventsTotal
@@ -148,7 +153,8 @@
                                         (click)="
                                             receiveTotalMeasurementSize(
                                                 configurationEntry
-                                            )
+                                            );
+                                            $event.stopPropagation()
                                         "
                                     >
                                     </sp-label>
@@ -165,7 +171,8 @@
                                         (click)="
                                             receiveTotalMeasurementSize(
                                                 configurationEntry
-                                            )
+                                            );
+                                            $event.stopPropagation()
                                         "
                                     >
                                     </sp-label>
@@ -199,7 +206,8 @@
                                         (click)="
                                             openRetentionDialog(
                                                 configurationEntry.elementId
-                                            )
+                                            );
+                                            $event.stopPropagation()
                                         "
                                     >
                                         <i
diff --git 
a/ui/src/app/dataset/components/dataset-details/dataset-details-schema/dataset-details-schema.component.html
 
b/ui/src/app/dataset/components/dataset-details/dataset-details-schema/dataset-details-schema.component.html
index 81fef25bf7..fc1ddca160 100644
--- 
a/ui/src/app/dataset/components/dataset-details/dataset-details-schema/dataset-details-schema.component.html
+++ 
b/ui/src/app/dataset/components/dataset-details/dataset-details-schema/dataset-details-schema.component.html
@@ -51,7 +51,13 @@
                             </th>
                             <td mat-cell *matCellDef="let row">
                                 <div class="runtime-name-row">
-                                    <div class="runtime-name">
+                                    <div
+                                        class="runtime-name"
+                                        [attr.data-cy]="
+                                            'dataset-details-schema-field-' +
+                                            row.runtimeName
+                                        "
+                                    >
                                         {{ row.runtimeName }}
                                     </div>
                                     <sp-property-scope-badge
@@ -75,7 +81,15 @@
                                 <strong>{{ 'Data type' | translate }}</strong>
                             </th>
                             <td mat-cell *matCellDef="let row">
-                                <div class="value">{{ row.dataType }}</div>
+                                <div
+                                    class="value"
+                                    [attr.data-cy]="
+                                        'dataset-details-schema-type-' +
+                                        row.runtimeName
+                                    "
+                                >
+                                    {{ row.dataType }}
+                                </div>
                             </td>
                         </ng-container>
 

Reply via email to