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/streampipes.git


The following commit(s) were added to refs/heads/dev by this push:
     new 8bb9168c0 Add new test for editing dashboard (#2142)
8bb9168c0 is described below

commit 8bb9168c0e6e7e1770e1b9d1291978d75bd00890
Author: Marcelfrueh <[email protected]>
AuthorDate: Sat Nov 11 08:35:05 2023 +0100

    Add new test for editing dashboard (#2142)
    
    * add new test for editing dashboard
    
    * Add new edit-dashboard-test
---
 .../tests/dashboard/editDashboardTest.spec.ts      | 73 ++++++++++++++++++++++
 .../overview/dashboard-overview.component.html     |  1 +
 .../widget/dashboard-widget.component.html         |  7 ++-
 .../add-visualization-dialog.component.html        |  1 +
 4 files changed, 81 insertions(+), 1 deletion(-)

diff --git a/ui/cypress/tests/dashboard/editDashboardTest.spec.ts 
b/ui/cypress/tests/dashboard/editDashboardTest.spec.ts
new file mode 100644
index 000000000..194af94af
--- /dev/null
+++ b/ui/cypress/tests/dashboard/editDashboardTest.spec.ts
@@ -0,0 +1,73 @@
+/*
+ * 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 { DashboardUtils } from '../../support/utils/DashboardUtils';
+
+describe('Test edit dashboard', () => {
+    beforeEach('Setup Test', () => {
+        cy.initStreamPipesTest();
+        ConnectUtils.addMachineDataSimulator('simulator', true);
+    });
+
+    it('Perform Test', () => {
+        DashboardUtils.goToDashboard();
+
+        // Add new dashboard
+        const dashboardName = 'testDashboard';
+        DashboardUtils.addAndEditDashboard(dashboardName);
+        DashboardUtils.addWidget('Persist_simulator', 'raw');
+        cy.dataCy('save-data-explorer-go-back-to-overview').click();
+        cy.dataCy('confirm-delete').click();
+
+        // Change dashboard name
+        cy.dataCy('change-dashboard-settings-button').click();
+        cy.dataCy('dashboard-name-input')
+            .clear()
+            .type(dashboardName + 'New')
+            .wait(1000);
+        cy.dataCy('dashboard-save-btn').should('not.be.disabled');
+        cy.dataCy('dashboard-save-btn').click();
+
+        // Verify that new dashboard was renamed correctly
+        cy.contains('testDashboardNew').should('exist');
+
+        // Edit dashboard and change widget to line chart
+        cy.dataCy('edit-dashboard-testDashboardNew').click().wait(1000);
+        cy.dataCy('widget-settings-button').click();
+        cy.dataCy('edit-widget-back-btn').click();
+        cy.dataCy('dashboard-select-widget-line').click();
+        cy.dataCy('min-y-axis-key').type('40');
+        cy.dataCy('max-y-axis-key').type('50');
+        cy.dataCy('dashboard-new-widget-next-btn').should('not.be.disabled');
+        cy.dataCy('dashboard-new-widget-next-btn').click();
+
+        // Verify that new dashboard displays correct chart
+        cy.get('g').should('have.class', 'line-chart chart');
+
+        // Add second chart, single value chart
+        DashboardUtils.addWidget('Persist_simulator', 'number');
+
+        // Go back and check if two newly added charts are displayed correctly 
in standalone dashboard
+        cy.dataCy('save-data-explorer-go-back-to-overview').click();
+        cy.dataCy('confirm-delete').click();
+        cy.dataCy('show-dashboard-testDashboardNew').click();
+        cy.get('g').should('have.class', 'line-chart chart');
+        cy.get('div').should('have.class', 'circleNumber');
+    });
+});
diff --git 
a/ui/src/app/dashboard/components/overview/dashboard-overview.component.html 
b/ui/src/app/dashboard/components/overview/dashboard-overview.component.html
index 4538f38b8..d5a2f0591 100644
--- a/ui/src/app/dashboard/components/overview/dashboard-overview.component.html
+++ b/ui/src/app/dashboard/components/overview/dashboard-overview.component.html
@@ -147,6 +147,7 @@
                                             (click)="
                                                 
openEditDashboardDialog(element)
                                             "
+                                            
data-cy="change-dashboard-settings-button"
                                         >
                                             <i class="material-icons"
                                                 >settings</i
diff --git 
a/ui/src/app/dashboard/components/widget/dashboard-widget.component.html 
b/ui/src/app/dashboard/components/widget/dashboard-widget.component.html
index 0a8b9f642..a0ae353dd 100644
--- a/ui/src/app/dashboard/components/widget/dashboard-widget.component.html
+++ b/ui/src/app/dashboard/components/widget/dashboard-widget.component.html
@@ -23,7 +23,12 @@
             *ngIf="editMode && headerVisible"
         >
             <div fxFlex="100" fxLayout="row" fxLayoutAlign="end center">
-                <button mat-icon-button color="white" (click)="editWidget()">
+                <button
+                    mat-icon-button
+                    color="white"
+                    (click)="editWidget()"
+                    data-cy="widget-settings-button"
+                >
                     <i class="material-icons">settings</i>
                 </button>
                 <button mat-icon-button color="white" (click)="removeWidget()">
diff --git 
a/ui/src/app/dashboard/dialogs/add-widget/add-visualization-dialog.component.html
 
b/ui/src/app/dashboard/dialogs/add-widget/add-visualization-dialog.component.html
index 3a9f89666..4293ee14f 100644
--- 
a/ui/src/app/dashboard/dialogs/add-widget/add-visualization-dialog.component.html
+++ 
b/ui/src/app/dashboard/dialogs/add-widget/add-visualization-dialog.component.html
@@ -117,6 +117,7 @@
             class="mat-basic mr-10"
             (click)="back()"
             *ngIf="!('select-pipeline' === page)"
+            data-cy="edit-widget-back-btn"
         >
             Back
         </button>

Reply via email to