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 509c5c08f Added two new tests for editing adapters and pipelines
(#2110)
509c5c08f is described below
commit 509c5c08feace82689532a69b0717b622f1f94b3
Author: Marcelfrueh <[email protected]>
AuthorDate: Thu Nov 2 15:46:07 2023 +0100
Added two new tests for editing adapters and pipelines (#2110)
* added new tests for edit adapter and pipeline
* added header
---
.../support/builder/PipelineElementBuilder.ts | 3 +-
ui/cypress/tests/adapter/editAdapter.smoke.spec.ts | 1 -
.../adapter/editAdapterSettingsAndPipeline.spec.ts | 113 +++++++++++++++++
.../adapter/editAdapterValuesAndFields.spec.ts | 133 +++++++++++++++++++++
...adapter-started-update-migration.component.html | 7 +-
.../pipeline-element-options.component.html | 1 +
.../pipeline-overview.component.html | 8 +-
7 files changed, 262 insertions(+), 4 deletions(-)
diff --git a/ui/cypress/support/builder/PipelineElementBuilder.ts
b/ui/cypress/support/builder/PipelineElementBuilder.ts
index 9464317f2..fa56292ce 100644
--- a/ui/cypress/support/builder/PipelineElementBuilder.ts
+++ b/ui/cypress/support/builder/PipelineElementBuilder.ts
@@ -18,6 +18,7 @@
import { UserInput } from '../model/UserInput';
import { PipelineElementInput } from '../model/PipelineElementInput';
+import { UserInputType } from '../model/UserInputType';
export class PipelineElementBuilder {
pipelineElementInput: PipelineElementInput;
@@ -32,7 +33,7 @@ export class PipelineElementBuilder {
return new PipelineElementBuilder(name);
}
- public addInput(type: string, selector: string, value: string) {
+ public addInput(type: UserInputType, selector: string, value: string) {
const userInput = new UserInput();
userInput.type = type;
userInput.selector = selector;
diff --git a/ui/cypress/tests/adapter/editAdapter.smoke.spec.ts
b/ui/cypress/tests/adapter/editAdapter.smoke.spec.ts
index 28e4fe04a..ba8a1f54e 100644
--- a/ui/cypress/tests/adapter/editAdapter.smoke.spec.ts
+++ b/ui/cypress/tests/adapter/editAdapter.smoke.spec.ts
@@ -42,7 +42,6 @@ describe('Test Edit Adapter', () => {
const newUserConfiguration = AdapterBuilder.create(
'Machine_Data_Simulator',
)
- // .setName(name)
.addInput('input', 'wait-time-ms', '2000')
.addInput('radio', 'selected', 'simulator-option-pressure')
.build();
diff --git a/ui/cypress/tests/adapter/editAdapterSettingsAndPipeline.spec.ts
b/ui/cypress/tests/adapter/editAdapterSettingsAndPipeline.spec.ts
new file mode 100644
index 000000000..ca0eb4f88
--- /dev/null
+++ b/ui/cypress/tests/adapter/editAdapterSettingsAndPipeline.spec.ts
@@ -0,0 +1,113 @@
+/*
+ * 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 { ConnectBtns } from '../../support/utils/connect/ConnectBtns';
+import { PipelineUtils } from '../../support/utils/PipelineUtils';
+import { PipelineElementBuilder } from
'../../support/builder/PipelineElementBuilder';
+import { PipelineBuilder } from '../../support/builder/PipelineBuilder';
+import { AdapterBuilder } from '../../support/builder/AdapterBuilder';
+import { DashboardUtils } from '../../support/utils/DashboardUtils';
+
+describe('Test Edit Adapter and Pipeline', () => {
+ beforeEach('Setup Test', () => {
+ // To set up test add a stream adapter that can be configured
+ cy.initStreamPipesTest();
+ ConnectUtils.addMachineDataSimulator('simulator');
+
+ const adapterName = 'simulator';
+ const pipelineInput = PipelineBuilder.create('Pipeline Test')
+ .addSource(adapterName)
+ .addProcessingElement(
+ PipelineElementBuilder.create('numerical_filter')
+ .addInput('input', 'value', '10')
+ .build(),
+ )
+ .addSink(
+ PipelineElementBuilder.create('data_lake')
+ .addInput('input', 'db_measurement', 'demo')
+ .build(),
+ )
+ .build();
+
+ PipelineUtils.addPipeline(pipelineInput);
+ });
+
+ it('Edit adapter and test Pipeline behaviour', () => {
+ // Edit Apater and select pressure
+ ConnectUtils.goToConnect();
+ ConnectBtns.editAdapter().should('not.be.disabled');
+ ConnectBtns.editAdapter().click();
+ const newUserConfiguration = AdapterBuilder.create(
+ 'Machine_Data_Simulator',
+ )
+ .addInput('input', 'wait-time-ms', '2000')
+ .addInput('radio', 'selected', 'simulator-option-pressure')
+ .build();
+
+ ConnectUtils.configureAdapter(newUserConfiguration);
+
+ // Update event schema
+ ConnectUtils.finishEventSchemaConfiguration();
+ ConnectBtns.storeEditAdapter().click();
+
+ // Check for warning message
+ cy.dataCy('sp-connect-adapter-edit-warning', {
+ timeout: 60000,
+ }).should('be.visible');
+ cy.dataCy('btn-update-adapter-migrate-pipelines').click();
+ ConnectUtils.closeAdapterPreview();
+
+ // Go to pipelines, check for warning icon and edit pipeline
+ cy.visit('#/pipelines').wait(1000);
+
+ cy.dataCy('pipeline-warning-icon', {
+ timeout: 60000,
+ }).should('be.visible');
+
+ cy.dataCy('pipeline-sync-problem-icon', {
+ timeout: 60000,
+ }).should('be.visible');
+
+ cy.dataCy('modify-pipeline-btn').click();
+ cy.dataCy('settings-pipeline-element-button').eq(0).click();
+ cy.dataCy('number-mapping').contains('pressure').click({ force: true
});
+ cy.dataCy('sp-element-configuration-save').click({ force: true });
+ cy.dataCy('sp-editor-save-pipeline').click();
+ cy.dataCy('sp-editor-save').click();
+ cy.dataCy('start-pipeline-button').click();
+ cy.dataCy('sp-pipeline-dialog-close').click();
+
+ // Visit dashboard
+ cy.wait(1000);
+ DashboardUtils.goToDashboard();
+
+ // Add new dashboard widget and check if edited adapter appears
+ const dashboardName = 'testDashboard';
+ DashboardUtils.addAndEditDashboard(dashboardName);
+ cy.dataCy('dashboard-add-widget').click();
+ cy.dataCy('dashboard-visualize-pipeline-Pipeline_Test').click();
+ cy.dataCy('dashboard-select-widget-table').click();
+ cy.get('[type="checkbox"]').check();
+ cy.dataCy('dashboard-new-widget-next-btn').click();
+ cy.dataCy('dashboard-save-edit-mode').click();
+ cy.get('.main-panel').should('include.text', 'pressure');
+ cy.get('.main-panel').should('include.text', 'sensorId');
+ cy.get('.main-panel').should('include.text', 'time');
+ });
+});
diff --git a/ui/cypress/tests/adapter/editAdapterValuesAndFields.spec.ts
b/ui/cypress/tests/adapter/editAdapterValuesAndFields.spec.ts
new file mode 100644
index 000000000..60ce694b2
--- /dev/null
+++ b/ui/cypress/tests/adapter/editAdapterValuesAndFields.spec.ts
@@ -0,0 +1,133 @@
+/*
+ * 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 { ConnectBtns } from '../../support/utils/connect/ConnectBtns';
+import { AdapterBuilder } from '../../support/builder/AdapterBuilder';
+
+describe('Test Edit Adapter', () => {
+ beforeEach('Setup Test', () => {
+ cy.initStreamPipesTest();
+ });
+
+ it('Test configuration of adapter fields ', () => {
+ // Set up new adapter
+ const builder = AdapterBuilder.create('Machine_Data_Simulator')
+ .setName('Machine_Data_Simulator')
+ .addInput('input', 'wait-time-ms', '1000');
+ const configuration = builder.build();
+ ConnectUtils.goToConnect();
+ ConnectUtils.goToNewAdapterPage();
+ ConnectUtils.selectAdapter(configuration.adapterType);
+ cy.contains('Next').click();
+
+ // Add new property and edit field
+ cy.dataCy('connect-add-static-property').click();
+ cy.dataCy('connect-add-field-name').type('test-property-1');
+ cy.dataCy('connect-add-field-name-button').click();
+ cy.dataCy('edit-density').click();
+ // Change runtime name
+ cy.dataCy('connect-edit-field-runtime-name')
+ .clear()
+ .type('test-density');
+ // Change field semantic type
+ cy.get('[id="domainproperty"]')
+ .clear()
+ .type('http://schema.org/Numbers');
+ // Change field data type
+ cy.dataCy('connect-change-runtime-type')
+ .click()
+ .get('mat-option')
+ .contains('Double')
+ .click();
+ // Provide correction value and operator
+ cy.dataCy('connect-schema-correction-value').type('2');
+ cy.dataCy('connect-schema-correction-operator')
+ .click()
+ .get('mat-option')
+ .contains('Multiply')
+ .click();
+ cy.dataCy('sp-save-edit-property').click();
+ cy.dataCy('sp-event-schema-next-button').click();
+
+ // Fill in adapter name and close view
+ cy.dataCy('sp-adapter-name').type('Test Adapter');
+ cy.dataCy('adapter-settings-start-adapter-btn').click();
+ ConnectUtils.closeAdapterPreview();
+
+ // Edit adapter and check if given values and added property still
provided
+ ConnectBtns.editAdapter().should('not.be.disabled');
+ ConnectBtns.editAdapter().click();
+ cy.contains('Next').click();
+ cy.dataCy('edit-density').click();
+ cy.dataCy('connect-edit-field-runtime-name').should(
+ 'have.value',
+ 'test-density',
+ );
+ cy.get('[id="domainproperty"]').should(
+ 'have.value',
+ 'http://schema.org/Numbers',
+ );
+ cy.dataCy('connect-change-runtime-type').should(
+ 'include.text',
+ 'Double',
+ );
+ cy.dataCy('connect-schema-correction-value').should('have.value', '2');
+ cy.dataCy('connect-schema-correction-operator').should(
+ 'include.text',
+ 'Multiply',
+ );
+
+ // Delete inserted values in edit field
+ cy.dataCy('connect-edit-field-runtime-name').clear();
+ cy.get('[id="domainproperty"]').clear();
+ cy.dataCy('connect-change-runtime-type')
+ .click()
+ .get('mat-option')
+ .contains('Float')
+ .click();
+ cy.dataCy('connect-schema-correction-value').clear();
+ cy.dataCy('sp-save-edit-property').click();
+ cy.get('[class="general-panel"]').should(
+ 'include.text',
+ 'test-property-1',
+ );
+ cy.dataCy('sp-event-schema-next-button').click();
+ cy.dataCy('store-edit-adapter').click();
+ ConnectUtils.closeAdapterPreview();
+
+ // Configure adapter with pressure instead of flowrate
+ ConnectBtns.editAdapter().click();
+ const newUserConfiguration = AdapterBuilder.create(
+ 'Machine_Data_Simulator',
+ )
+ .addInput('input', 'wait-time-ms', '2000')
+ .addInput('radio', 'selected', 'simulator-option-pressure')
+ .build();
+ ConnectUtils.configureAdapter(newUserConfiguration);
+
+ // Check if given property still exists and close view afterwards
+ cy.get('[class="general-panel"]').should(
+ 'include.text',
+ 'test-property-1',
+ );
+ cy.dataCy('sp-event-schema-next-button').click();
+ cy.dataCy('store-edit-adapter').click();
+ ConnectUtils.closeAdapterPreview();
+ });
+});
diff --git
a/ui/src/app/connect/dialog/adapter-started/adapter-started-update-migration/adapter-started-update-migration.component.html
b/ui/src/app/connect/dialog/adapter-started/adapter-started-update-migration/adapter-started-update-migration.component.html
index 85da7bdb4..eee4c8347 100644
---
a/ui/src/app/connect/dialog/adapter-started/adapter-started-update-migration/adapter-started-update-migration.component.html
+++
b/ui/src/app/connect/dialog/adapter-started/adapter-started-update-migration/adapter-started-update-migration.component.html
@@ -33,7 +33,11 @@
*ngIf="!updateInfo.canAutoMigrate"
fxLayoutAlign="start center"
>
- <i class="material-icons">warning</i>
+ <i
+ class="material-icons"
+ data-cy="sp-connect-adapter-edit-warning"
+ >warning</i
+ >
Pipeline <b>{{ updateInfo.pipelineName }}</b
> will be stopped and needs manual review.
</div>
@@ -50,6 +54,7 @@
mat-raised-button
color="accent"
(click)="startUpdateEmitter.emit()"
+ data-cy="btn-update-adapter-migrate-pipelines"
>
Update adapter and migrate pipelines
</button>
diff --git
a/ui/src/app/editor/components/pipeline-element-options/pipeline-element-options.component.html
b/ui/src/app/editor/components/pipeline-element-options/pipeline-element-options.component.html
index 17ea0eb25..a879e6b37 100644
---
a/ui/src/app/editor/components/pipeline-element-options/pipeline-element-options.component.html
+++
b/ui/src/app/editor/components/pipeline-element-options/pipeline-element-options.component.html
@@ -35,6 +35,7 @@
matTooltip="Configure Element"
[matTooltipPosition]="'above'"
(click)="customizeElement(pipelineElement)"
+ data-cy="settings-pipeline-element-button"
>
<i class="material-icons options-icon-size">settings</i>
</button>
diff --git
a/ui/src/app/pipelines/components/pipeline-overview/pipeline-overview.component.html
b/ui/src/app/pipelines/components/pipeline-overview/pipeline-overview.component.html
index a428276dd..6e3805e1b 100644
---
a/ui/src/app/pipelines/components/pipeline-overview/pipeline-overview.component.html
+++
b/ui/src/app/pipelines/components/pipeline-overview/pipeline-overview.component.html
@@ -82,13 +82,17 @@
? 's'
: ''
}}"
+ data-cy="pipeline-warning-icon"
>
<i class="material-icons pipeline-notification"
>warning</i
>
</button>
</div>
- <div class="ml-10 notification-icon">
+ <div
+ class="ml-10 notification-icon"
+ data-cy="pipeline-sync-problem-icon"
+ >
<mat-icon
color="warn"
matTooltip="Invalid pipeline: Modify to fix
problems"
@@ -108,6 +112,7 @@
mat-icon-button
matTooltip="Start pipeline"
matTooltipPosition="above"
+ data-cy="start-pipeline-button"
(click)="
pipelineOperationsService.startPipeline(
pipeline._id,
@@ -205,6 +210,7 @@
pipeline._id
)
"
+ data-cy="modify-pipeline-btn"
>
<i class="material-icons">mode_edit</i>
</button>