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 2024/03/19 13:35:02 UTC
(streampipes) branch dev updated: test(#2574): Add test to validate pipeline element documentation (#2575)
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 85c724950c test(#2574): Add test to validate pipeline element documentation (#2575)
85c724950c is described below
commit 85c724950c216f048d24c0cedfb93785f324ca75
Author: Philipp Zehnder <te...@users.noreply.github.com>
AuthorDate: Tue Mar 19 14:34:57 2024 +0100
test(#2574): Add test to validate pipeline element documentation (#2575)
---
ui/cypress/support/utils/PipelineUtils.ts | 4 +--
.../PipelineElementDocumentation.spec.ts | 32 ++++++++++++++++++++++
ui/src/app/core-ui/help/help.component.ts | 10 ++-----
.../pipeline-element-documentation.component.html | 1 +
.../pipeline-element-documentation.component.ts | 8 +++---
.../pipeline-element-icon-stand-row.component.html | 2 ++
6 files changed, 43 insertions(+), 14 deletions(-)
diff --git a/ui/cypress/support/utils/PipelineUtils.ts b/ui/cypress/support/utils/PipelineUtils.ts
index 42cfcc45e9..c05ecb1d7a 100644
--- a/ui/cypress/support/utils/PipelineUtils.ts
+++ b/ui/cypress/support/utils/PipelineUtils.ts
@@ -35,9 +35,9 @@ export class PipelineUtils {
cy.visit('#/pipelines');
}
- private static goToPipelineEditor() {
+ public static goToPipelineEditor() {
// Go to StreamPipes editor
- cy.visit('#/pipelines');
+ this.goToPipelines();
cy.dataCy('pipelines-navigate-to-editor').click();
}
diff --git a/ui/cypress/tests/pipelineElement/PipelineElementDocumentation.spec.ts b/ui/cypress/tests/pipelineElement/PipelineElementDocumentation.spec.ts
new file mode 100644
index 0000000000..726ed1c5e2
--- /dev/null
+++ b/ui/cypress/tests/pipelineElement/PipelineElementDocumentation.spec.ts
@@ -0,0 +1,32 @@
+/*
+ * 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/PipelineUtils';
+
+describe('Validate that the markdown documentation for pipeline elements works', () => {
+ beforeEach('Setup Test', () => {
+ cy.initStreamPipesTest();
+ });
+
+ it('Perform Test', () => {
+ PipelineUtils.goToPipelineEditor();
+ cy.dataCy('pipeline-element-icon-stand-row').first().click();
+ cy.dataCy('help-button-icon-stand').click();
+ cy.dataCy('pipeline-element-documentation-markdown').should('exist');
+ });
+});
diff --git a/ui/src/app/core-ui/help/help.component.ts b/ui/src/app/core-ui/help/help.component.ts
index 5b7ff21d04..d6d3cf0b08 100644
--- a/ui/src/app/core-ui/help/help.component.ts
+++ b/ui/src/app/core-ui/help/help.component.ts
@@ -17,10 +17,7 @@
*/
import { Component, Input, OnInit } from '@angular/core';
-import {
- PipelineElementService,
- SpDataStream,
-} from '@streampipes/platform-services';
+import { SpDataStream } from '@streampipes/platform-services';
import { DialogRef } from '@streampipes/shared-ui';
import { PipelineElementUnion } from '../../editor/model/editor.model';
@@ -60,10 +57,7 @@ export class HelpComponent implements OnInit {
@Input()
pipelineElement: PipelineElementUnion;
- constructor(
- private pipelineElementService: PipelineElementService,
- private dialogRef: DialogRef<HelpComponent>,
- ) {
+ constructor(private dialogRef: DialogRef<HelpComponent>) {
this.pollingActive = true;
}
diff --git a/ui/src/app/core-ui/pipeline-element-documentation/pipeline-element-documentation.component.html b/ui/src/app/core-ui/pipeline-element-documentation/pipeline-element-documentation.component.html
index 27c4d56f15..59a122dc28 100644
--- a/ui/src/app/core-ui/pipeline-element-documentation/pipeline-element-documentation.component.html
+++ b/ui/src/app/core-ui/pipeline-element-documentation/pipeline-element-documentation.component.html
@@ -20,6 +20,7 @@
[data]="documentationMarkdown"
*ngIf="documentationMarkdown && !error"
[ngClass]="useStyling ? 'note' : ''"
+ data-cy="pipeline-element-documentation-markdown"
></markdown>
<p *ngIf="error" [ngClass]="useStyling ? 'note' : ''">
(no documentation available)
diff --git a/ui/src/app/core-ui/pipeline-element-documentation/pipeline-element-documentation.component.ts b/ui/src/app/core-ui/pipeline-element-documentation/pipeline-element-documentation.component.ts
index d82c700589..fb368d9d90 100644
--- a/ui/src/app/core-ui/pipeline-element-documentation/pipeline-element-documentation.component.ts
+++ b/ui/src/app/core-ui/pipeline-element-documentation/pipeline-element-documentation.component.ts
@@ -38,15 +38,15 @@ export class PipelineElementDocumentationComponent implements OnInit {
constructor(private pipelineElementService: PipelineElementService) {}
ngOnInit(): void {
- this.pipelineElementService.getDocumentation(this.appId).subscribe(
- msg => {
+ this.pipelineElementService.getDocumentation(this.appId).subscribe({
+ next: msg => {
this.error = false;
this.documentationMarkdown = this.compileMarkdown(msg);
},
- error => {
+ error: () => {
this.error = true;
},
- );
+ });
}
compileMarkdown(value: string): string {
diff --git a/ui/src/app/editor/components/pipeline-element-icon-stand-row/pipeline-element-icon-stand-row.component.html b/ui/src/app/editor/components/pipeline-element-icon-stand-row/pipeline-element-icon-stand-row.component.html
index a01350953e..8aeaa0c53d 100644
--- a/ui/src/app/editor/components/pipeline-element-icon-stand-row/pipeline-element-icon-stand-row.component.html
+++ b/ui/src/app/editor/components/pipeline-element-icon-stand-row/pipeline-element-icon-stand-row.component.html
@@ -23,6 +23,7 @@
[attr.data-pe]="element.elementId"
(mouseenter)="updateMouseOver(element.name)"
(mouseleave)="updateMouseOver('')"
+ data-cy="pipeline-element-icon-stand-row"
>
<div fxFlex="50px">
<div
@@ -61,6 +62,7 @@
mat-raised-button
color="accent"
class="help-button-stand"
+ data-cy="help-button-icon-stand"
(click)="openHelpDialog(element)"
>
?