This is an automated email from the ASF dual-hosted git repository.
riemer 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 7a45c6da18 feat: Rename pipelines and add cypress test (#3563)
7a45c6da18 is described below
commit 7a45c6da1839f2cc0fbe740de1cd273603ea89e7
Author: Marcel Früholz <[email protected]>
AuthorDate: Tue Apr 22 13:58:29 2025 +0200
feat: Rename pipelines and add cypress test (#3563)
Co-authored-by: Dominik Riemer <[email protected]>
---
.../streampipes/rest/impl/PipelineResource.java | 2 +
ui/cypress/support/utils/pipeline/PipelineUtils.ts | 19 ++++++++
.../tests/pipeline/renamePipelineTest.spec.ts | 51 +++++++++++++++++++
.../save-pipeline-settings.component.html | 57 ++++++++++------------
4 files changed, 97 insertions(+), 32 deletions(-)
diff --git
a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineResource.java
b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineResource.java
index b897a9d599..6d13dd6b25 100644
---
a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineResource.java
+++
b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineResource.java
@@ -246,6 +246,8 @@ public class PipelineResource extends
AbstractAuthGuardedRestResource {
storedPipeline.setStreams(pipeline.getStreams());
storedPipeline.setSepas(pipeline.getSepas());
storedPipeline.setActions(pipeline.getActions());
+ storedPipeline.setName(pipeline.getName());
+ storedPipeline.setDescription(pipeline.getDescription());
}
storedPipeline.setCreatedAt(System.currentTimeMillis());
storedPipeline.setHealthStatus(pipeline.getHealthStatus());
diff --git a/ui/cypress/support/utils/pipeline/PipelineUtils.ts
b/ui/cypress/support/utils/pipeline/PipelineUtils.ts
index 915b3a7ee5..783cb3d3dc 100644
--- a/ui/cypress/support/utils/pipeline/PipelineUtils.ts
+++ b/ui/cypress/support/utils/pipeline/PipelineUtils.ts
@@ -149,6 +149,11 @@ export class PipelineUtils {
cy.dataCy('sp-editor-pipeline-name').type(newPipelineName);
}
+ public static updatePipeline(newPipelineName: string) {
+ cy.dataCy('pipeline-update-mode-update').children().click();
+ cy.dataCy('sp-editor-pipeline-name').type(newPipelineName);
+ }
+
public static finalizePipelineStart() {
cy.dataCy('sp-editor-checkbox-navigate-to-overview').children().click();
cy.dataCy('sp-editor-apply').click();
@@ -183,4 +188,18 @@ export class PipelineUtils {
PipelineBtns.deletePipeline().should('have.length', 0);
}
+
+ public static verifyPipelineName(expectedName: string) {
+ cy.dataCy('all-pipelines-table', { timeout: 10000 })
+ .first()
+ .within(() => {
+ cy.get('td').eq(2).should('contain', expectedName);
+ });
+ }
+
+ public static verifyPipelineCount(expectedCount: number) {
+ cy.dataCy('all-pipelines-table', { timeout: 10000 })
+ .find('tr')
+ .should('have.length', expectedCount + 1);
+ }
}
diff --git a/ui/cypress/tests/pipeline/renamePipelineTest.spec.ts
b/ui/cypress/tests/pipeline/renamePipelineTest.spec.ts
new file mode 100644
index 0000000000..ea7c1e44af
--- /dev/null
+++ b/ui/cypress/tests/pipeline/renamePipelineTest.spec.ts
@@ -0,0 +1,51 @@
+/*
+ * 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 { PipelineUtils } from '../../support/utils/pipeline/PipelineUtils';
+
+describe('Test rename of running pipeline', () => {
+ beforeEach('Setup Test', () => {
+ cy.initStreamPipesTest();
+ });
+
+ it('Perform Test', () => {
+ PipelineUtils.addSampleAdapterAndPipeline();
+
+ PipelineUtils.verifyPipelineCount(1);
+ PipelineUtils.verifyPipelineName('Pipeline Test');
+
+ PipelineUtils.editPipeline();
+ cy.wait(1000);
+ cy.dataCy('sp-editor-save-pipeline').click();
+ cy.dataCy('sp-editor-pipeline-name').clear();
+ PipelineUtils.updatePipeline('Renamed Pipeline');
+ PipelineUtils.finalizePipelineStart();
+
+ PipelineUtils.verifyPipelineCount(1);
+ PipelineUtils.verifyPipelineName('Renamed Pipeline');
+
+ PipelineUtils.editPipeline();
+ cy.dataCy('sp-editor-save-pipeline').click();
+ cy.dataCy('sp-editor-pipeline-name').clear();
+ PipelineUtils.clonePipeline('Cloned Renamed Pipeline');
+ PipelineUtils.finalizePipelineStart();
+
+ PipelineUtils.verifyPipelineCount(2);
+ PipelineUtils.verifyPipelineName('Cloned Renamed Pipeline');
+ });
+});
diff --git
a/ui/src/app/editor/dialog/save-pipeline/save-pipeline-settings/save-pipeline-settings.component.html
b/ui/src/app/editor/dialog/save-pipeline/save-pipeline-settings/save-pipeline-settings.component.html
index 482d98e358..4b8020d004 100644
---
a/ui/src/app/editor/dialog/save-pipeline/save-pipeline-settings/save-pipeline-settings.component.html
+++
b/ui/src/app/editor/dialog/save-pipeline/save-pipeline-settings/save-pipeline-settings.component.html
@@ -17,6 +17,30 @@
-->
<div fxLayout="column">
+ <form [formGroup]="submitPipelineForm">
+ <div fxFlex="100" fxLayout="column">
+ <mat-form-field fxFlex color="accent">
+ <mat-label>Pipeline Name</mat-label>
+ <input
+ [formControlName]="'pipelineName'"
+ data-cy="sp-editor-pipeline-name"
+ matInput
+ name="pipelineName"
+ (blur)="triggerTutorial()"
+ />
+ <mat-error
+ >Pipeline name must have between 3 and 40 characters.
+ </mat-error>
+ </mat-form-field>
+ <mat-form-field fxFlex color="accent">
+ <mat-label>Description</mat-label>
+ <input [formControlName]="'pipelineDescription'" matInput />
+ <mat-error
+ >Pipeline description must not have more than 80
characters.
+ </mat-error>
+ </mat-form-field>
+ </div>
+ </form>
<div
id="overwriteCheckbox"
class="checkbox"
@@ -33,7 +57,7 @@
style="padding-left: 0"
data-cy="pipeline-update-mode-update"
>
- Update pipeline <b>{{ currentPipelineName }}</b>
+ Update pipeline
</mat-radio-button>
<mat-radio-button
[value]="'clone'"
@@ -44,37 +68,6 @@
</mat-radio-button>
</mat-radio-group>
</div>
- <form [formGroup]="submitPipelineForm">
- <div
- fxFlex="100"
- fxLayout="column"
- *ngIf="
- !storageOptions.updateModeActive ||
- storageOptions.updateMode === 'clone'
- "
- >
- <mat-form-field fxFlex color="accent">
- <mat-label>Pipeline Name</mat-label>
- <input
- [formControlName]="'pipelineName'"
- data-cy="sp-editor-pipeline-name"
- matInput
- name="pipelineName"
- (blur)="triggerTutorial()"
- />
- <mat-error
- >Pipeline name must have between 3 and 40 characters.
- </mat-error>
- </mat-form-field>
- <mat-form-field fxFlex color="accent">
- <mat-label>Description</mat-label>
- <input [formControlName]="'pipelineDescription'" matInput />
- <mat-error
- >Pipeline description must not have more than 80
characters.
- </mat-error>
- </mat-form-field>
- </div>
- </form>
<mat-checkbox
[(ngModel)]="storageOptions.startPipelineAfterStorage"
color="accent"