This is an automated email from the ASF dual-hosted git repository.
tenthe 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 6092b88907 fix: Fix failing nightly e2e tests (#4778)
6092b88907 is described below
commit 6092b889073b44b796a164e5629bb9af6d70a1a2
Author: Philipp Zehnder <[email protected]>
AuthorDate: Mon Jul 27 15:16:28 2026 +0200
fix: Fix failing nightly e2e tests (#4778)
---
ui/cypress/support/utils/connect/ConnectBtns.ts | 24 +++-
ui/cypress/support/utils/connect/ConnectUtils.ts | 19 +++-
ui/cypress/tests/connect/adapterWithAssets.spec.ts | 10 +-
.../tests/connect/compact/uiConfiguration.spec.ts | 9 +-
ui/cypress/tests/connect/editAdapter.spec.ts | 6 +-
.../connect/editAdapterDatasetSchemaUpdate.spec.ts | 3 +-
.../adapter-configuration.component.ts | 19 +++-
.../adapter-code-dialog.component.html | 8 +-
.../adapter-started-dialog.component.ts | 123 +++++++++++++--------
9 files changed, 151 insertions(+), 70 deletions(-)
diff --git a/ui/cypress/support/utils/connect/ConnectBtns.ts
b/ui/cypress/support/utils/connect/ConnectBtns.ts
index 6d300ea502..733ed0f356 100644
--- a/ui/cypress/support/utils/connect/ConnectBtns.ts
+++ b/ui/cypress/support/utils/connect/ConnectBtns.ts
@@ -56,6 +56,22 @@ export class ConnectBtns {
GeneralUtils.openMenuForRow(adapterName);
}
+ public static adapterConfigurationOptions() {
+ return cy.dataCy('options-adapter', { timeout: 10000 });
+ }
+
+ public static manageAdapter() {
+ return cy.dataCy('manage-adapter-btn', { timeout: 10000 });
+ }
+
+ public static managedResourceName() {
+ return cy.dataCy('managed-resource-name', { timeout: 10000 });
+ }
+
+ public static manageResourceSave() {
+ return cy.dataCy('sp-manage-save', { timeout: 10000 });
+ }
+
public static refreshSchema() {
return cy.dataCy('refresh-schema');
}
@@ -131,8 +147,12 @@ export class ConnectBtns {
return cy.dataCy('stop-all-adapters-btn');
}
- public static showCodeCheckbox() {
- return cy.dataCy('show-code-checkbox');
+ public static showAdapterCode() {
+ return cy.dataCy('show-adapter-code', { timeout: 10000 });
+ }
+
+ public static closeAdapterCodeDialog() {
+ return cy.dataCy('close-adapter-code-dialog', { timeout: 10000 });
}
public static deleteAdapterAndAssociatedPipelineConfirmation() {
diff --git a/ui/cypress/support/utils/connect/ConnectUtils.ts
b/ui/cypress/support/utils/connect/ConnectUtils.ts
index 38fb88c406..6879d522b7 100644
--- a/ui/cypress/support/utils/connect/ConnectUtils.ts
+++ b/ui/cypress/support/utils/connect/ConnectUtils.ts
@@ -143,9 +143,22 @@ export class ConnectUtils {
}
}
- public static renameAdapter(newName: string) {
- ConnectBtns.adapterNameInput().clear().type(newName);
- ConnectBtns.adapterNameInput().should('have.value', newName);
+ public static manageEditedAdapter(newName: string, assetNameList = []) {
+ ConnectBtns.adapterConfigurationOptions().click();
+ ConnectBtns.manageAdapter().click();
+
+ ConnectBtns.managedResourceName().clear().type(newName);
+ ConnectBtns.managedResourceName().should('have.value', newName);
+
+ if (assetNameList.length > 0) {
+ cy.get('mat-tree.asset-tree', { timeout: 10000 }).should('exist');
+ assetNameList.forEach(assetName => {
+ this.selectAssetTreeNode(assetName);
+ });
+ }
+
+ ConnectBtns.manageResourceSave().click();
+ ConnectBtns.manageResourceSave().should('not.exist');
}
public static addMachineDataSimulator(
diff --git a/ui/cypress/tests/connect/adapterWithAssets.spec.ts
b/ui/cypress/tests/connect/adapterWithAssets.spec.ts
index ed12a5e409..0d6a84e1c1 100644
--- a/ui/cypress/tests/connect/adapterWithAssets.spec.ts
+++ b/ui/cypress/tests/connect/adapterWithAssets.spec.ts
@@ -78,19 +78,13 @@ describe('Creates a new adapter with a linked asset', () =>
{
ConnectBtns.editAdapter().should('not.be.disabled');
ConnectBtns.editAdapter().click();
+ ConnectUtils.manageEditedAdapter('Changed', [assetName1, assetName3]);
+
// Go adapter settings page
ConnectBtns.adapterSettingsNextBtn().click();
ConnectBtns.configureSchemaNextBtn().click();
ConnectBtns.configureFieldsNextBtn().click();
- // Rename
- ConnectUtils.renameAdapter('Changed');
-
- // Deselect Asset 2
- ConnectUtils.editAsset([assetName1]);
-
- ConnectUtils.editAsset([assetName3]);
-
ConnectBtns.storeEditAdapter().click();
cy.dataCy('sp-connect-adapter-success-added', {
diff --git a/ui/cypress/tests/connect/compact/uiConfiguration.spec.ts
b/ui/cypress/tests/connect/compact/uiConfiguration.spec.ts
index 78f771a9d6..29187cbbb4 100644
--- a/ui/cypress/tests/connect/compact/uiConfiguration.spec.ts
+++ b/ui/cypress/tests/connect/compact/uiConfiguration.spec.ts
@@ -35,12 +35,13 @@ describe('Test Compact Adapters', () => {
.build();
ConnectUtils.addAdapter(adapterInput);
+ ConnectUtils.startAdapter(adapterInput);
- // Validate code editor in start dialog
- ConnectBtns.showCodeCheckbox().click();
+ // Validate code editor from adapter overview context menu
+ GeneralUtils.openMenuForRow(adapterInput.adapterName);
+ ConnectBtns.showAdapterCode().click();
validateCodeEditor();
-
- ConnectUtils.startAdapter(adapterInput);
+ ConnectBtns.closeAdapterCodeDialog().click();
// Validate code editor in adapter details
GeneralUtils.openMenuForRow(adapterInput.adapterName);
diff --git a/ui/cypress/tests/connect/editAdapter.spec.ts
b/ui/cypress/tests/connect/editAdapter.spec.ts
index c43bf59235..151f4ea758 100644
--- a/ui/cypress/tests/connect/editAdapter.spec.ts
+++ b/ui/cypress/tests/connect/editAdapter.spec.ts
@@ -44,7 +44,9 @@ describe('Test Edit Adapter', () => {
ConnectBtns.editAdapter().should('not.be.disabled');
ConnectBtns.editAdapter().click();
- // Change adapter name and wait time
+ ConnectUtils.manageEditedAdapter(newAdapterName);
+
+ // Change adapter wait time
const newUserConfiguration = AdapterBuilder.create(
'Machine_Data_Simulator',
@@ -66,8 +68,6 @@ describe('Test Edit Adapter', () => {
ConnectUtils.refreshEventSchema();
ConnectUtils.finishConfigureFieldsConfiguration();
- ConnectBtns.adapterNameInput().clear().type(newAdapterName);
-
// This wait is required to ensure that there is no couch db update
conflict
ConnectBtns.storeEditAdapter().click();
diff --git a/ui/cypress/tests/connect/editAdapterDatasetSchemaUpdate.spec.ts
b/ui/cypress/tests/connect/editAdapterDatasetSchemaUpdate.spec.ts
index 2ebf5d07d2..01eae6aca3 100644
--- a/ui/cypress/tests/connect/editAdapterDatasetSchemaUpdate.spec.ts
+++ b/ui/cypress/tests/connect/editAdapterDatasetSchemaUpdate.spec.ts
@@ -66,7 +66,6 @@ describe('Test adapter updates with data lake schema
changes', () => {
PipelineBtns.measurementUpdateDialogEditPipelineBtn().click();
PipelineBtns.savePipelineBtn().click();
- PipelineBtns.editorApplyBtn().click();
PipelineBtns.pipelineStartedError();
});
@@ -103,6 +102,8 @@ describe('Test adapter updates with data lake schema
changes', () => {
ConnectBtns.adapterManualPipelineMigrationWarning().should('not.exist');
ConnectBtns.adapterChartEditWarning().should('not.exist');
+ ConnectBtns.updateAndMigratePipelines().click();
+ ConnectBtns.connectAdapterAddedSuccessfully().should('be.visible');
ConnectUtils.closeAdapterPreview();
PipelineUtils.goToPipelines();
diff --git
a/ui/src/app/connect/components/adapter-configuration/adapter-configuration.component.ts
b/ui/src/app/connect/components/adapter-configuration/adapter-configuration.component.ts
index 90e5c338da..56853582e3 100644
---
a/ui/src/app/connect/components/adapter-configuration/adapter-configuration.component.ts
+++
b/ui/src/app/connect/components/adapter-configuration/adapter-configuration.component.ts
@@ -25,7 +25,10 @@ import {
ViewChild,
} from '@angular/core';
import { MatStep, MatStepLabel, MatStepper } from '@angular/material/stepper';
-import { AdapterDescription } from '@streampipes/platform-services';
+import {
+ AdapterDescription,
+ SpAssetTreeNode,
+} from '@streampipes/platform-services';
import { ShepherdService } from '../../../services/tour/shepherd.service';
import { Router } from '@angular/router';
import { TranslatePipe, TranslateService } from '@ngx-translate/core';
@@ -98,6 +101,7 @@ export class AdapterConfigurationComponent implements
OnInit, OnDestroy {
myStepper: MatStepper;
pageTitle = '';
private pendingManageAdapterResult?:
ObjectManageDialogResult<AdapterDescription>;
+ private readonly emptyAssets: SpAssetTreeNode[] = [];
ngOnInit() {
this.pageTitle = this.isEditMode
@@ -222,15 +226,22 @@ export class AdapterConfigurationComponent implements
OnInit, OnDestroy {
}
get pendingSelectedAssets() {
- return this.pendingManageAdapterResult?.selectedAssets ?? [];
+ return (
+ this.pendingManageAdapterResult?.selectedAssets ?? this.emptyAssets
+ );
}
get pendingDeselectedAssets() {
- return this.pendingManageAdapterResult?.deselectedAssets ?? [];
+ return (
+ this.pendingManageAdapterResult?.deselectedAssets ??
+ this.emptyAssets
+ );
}
get pendingOriginalAssets() {
- return this.pendingManageAdapterResult?.originalAssets ?? [];
+ return (
+ this.pendingManageAdapterResult?.originalAssets ?? this.emptyAssets
+ );
}
get shouldAddToAssets() {
diff --git
a/ui/src/app/connect/dialog/adapter-code-dialog/adapter-code-dialog.component.html
b/ui/src/app/connect/dialog/adapter-code-dialog/adapter-code-dialog.component.html
index 8bcce8d4d0..89023dd15d 100644
---
a/ui/src/app/connect/dialog/adapter-code-dialog/adapter-code-dialog.component.html
+++
b/ui/src/app/connect/dialog/adapter-code-dialog/adapter-code-dialog.component.html
@@ -30,7 +30,13 @@
</div>
<mat-divider></mat-divider>
<div class="sp-dialog-actions">
- <button mat-button mat-flat-button class="mat-basic" (click)="close()">
+ <button
+ mat-button
+ mat-flat-button
+ class="mat-basic"
+ data-cy="close-adapter-code-dialog"
+ (click)="close()"
+ >
{{ 'Close' | translate }}
</button>
</div>
diff --git
a/ui/src/app/connect/dialog/adapter-started/adapter-started-dialog.component.ts
b/ui/src/app/connect/dialog/adapter-started/adapter-started-dialog.component.ts
index dc2d7db4ab..698b4d01d0 100644
---
a/ui/src/app/connect/dialog/adapter-started/adapter-started-dialog.component.ts
+++
b/ui/src/app/connect/dialog/adapter-started/adapter-started-dialog.component.ts
@@ -100,9 +100,9 @@ export class AdapterStartedDialog implements OnInit {
/**
* Assets selectedAsset to link the adapter tp
*/
- @Input() selectedAssets: SpAssetTreeNode[];
- @Input() deselectedAssets: SpAssetTreeNode[];
- @Input() originalAssets: SpAssetTreeNode[];
+ @Input() selectedAssets: SpAssetTreeNode[] = [];
+ @Input() deselectedAssets: SpAssetTreeNode[] = [];
+ @Input() originalAssets: SpAssetTreeNode[] = [];
@Input() permission?: Permission;
@Input() addToAssets = true;
@@ -145,11 +145,13 @@ export class AdapterStartedDialog implements OnInit {
deletedFromAssetText = '';
ngOnInit() {
- if (this.editMode) {
- this.initAdapterUpdatePreflight();
- } else {
- this.addAdapter();
- }
+ queueMicrotask(() => {
+ if (this.editMode) {
+ this.initAdapterUpdatePreflight();
+ } else {
+ this.addAdapter();
+ }
+ });
}
initAdapterUpdatePreflight(): void {
@@ -192,10 +194,14 @@ export class AdapterStartedDialog implements OnInit {
this.adapterService.updateAdapter(this.adapter).subscribe({
next: async status => {
if (status.success) {
- await this.persistManageMetadata();
- this.onAdapterReady(
- `Adapter ${this.adapter.name} was successfully updated
and is available in the pipeline editor.`,
- );
+ try {
+ await this.persistManageMetadata();
+ this.onAdapterReady(
+ `Adapter ${this.adapter.name} was successfully
updated and is available in the pipeline editor.`,
+ );
+ } catch (error) {
+ this.onAssetSaveFailure(error);
+ }
} else {
const errorLogMessage = this.getErrorLogMessage(status);
@@ -227,12 +233,12 @@ export class AdapterStartedDialog implements OnInit {
if (status.success) {
const adapterElementId = status.notifications[0].title;
this.adapterElementId = adapterElementId;
- this.adapterElementId = adapterElementId;
if (this.saveInDataLake) {
this.startSaveInDataLakePipeline(adapterElementId);
} else {
- this.startAdapter(adapterElementId, true);
- this.addToAsset();
+ this.startAdapter(adapterElementId, true, () =>
+ this.addToAsset(),
+ );
}
} else {
const errorMsg: SpLogMessage =
@@ -261,7 +267,11 @@ export class AdapterStartedDialog implements OnInit {
};
}
- startAdapter(adapterElementId: string, showPreview = false) {
+ startAdapter(
+ adapterElementId: string,
+ showPreview = false,
+ afterStart?: () => Promise<void>,
+ ): void {
const successMessage = this.translateService.instant(
'Your new data stream is now available in the pipeline editor.',
);
@@ -281,19 +291,46 @@ export class AdapterStartedDialog implements OnInit {
);
this.adapterService
.startAdapterByElementId(adapterElementId)
- .subscribe(
- () => {
- this.onAdapterReady(successMessage, showPreview);
+ .subscribe({
+ next: () => {
+ void this.finishAdapterStart(
+ successMessage,
+ showPreview,
+ afterStart,
+ );
},
- error => {
+ error: error => {
this.onAdapterFailure(error.error);
},
- );
+ });
} else {
- this.onAdapterReady(successMessage, false);
+ void this.finishAdapterStart(successMessage, false, afterStart);
+ }
+ }
+
+ private async finishAdapterStart(
+ successMessage: string,
+ showPreview: boolean,
+ afterStart?: () => Promise<void>,
+ ): Promise<void> {
+ try {
+ await afterStart?.();
+ this.onAdapterReady(successMessage, showPreview);
+ } catch (error) {
+ this.onAssetSaveFailure(error);
}
}
+ private onAssetSaveFailure(error: unknown): void {
+ this.onAdapterFailure({
+ cause: `${error}`,
+ detail: '',
+ fullStackTrace: `${error}`,
+ level: 'ERROR',
+ title: 'Could not save asset links',
+ });
+ }
+
onAdapterFailure(adapterErrorMessage: SpLogMessage) {
this.adapterInstalled = true;
@@ -322,30 +359,27 @@ export class AdapterStartedDialog implements OnInit {
async addToAsset(pipelineId = ''): Promise<void> {
let linkageData: LinkageData[];
- try {
- if (!this.editMode) {
- const adapter = await this.getAdapter();
- linkageData = this.createLinkageData(adapter);
-
- if (this.saveInDataLake && pipelineId !== '') {
- await this.addDataLakeLinkageData(
- adapter,
- linkageData,
- pipelineId,
- );
- }
- } else {
- linkageData = this.createLinkageData(this.adapter);
- }
- if (this.addToAssets) {
- await this.saveAssets(linkageData);
+ if (!this.editMode) {
+ const adapter = await this.getAdapter();
+ linkageData = this.createLinkageData(adapter);
+
+ if (this.saveInDataLake && pipelineId !== '') {
+ await this.addDataLakeLinkageData(
+ adapter,
+ linkageData,
+ pipelineId,
+ );
}
+ } else {
+ linkageData = this.createLinkageData(this.adapter);
+ }
- this.setSuccessMessage();
- } catch (err) {
- console.error('Error in addToAsset:', err);
+ if (this.addToAssets) {
+ await this.saveAssets(linkageData);
}
+
+ this.setSuccessMessage();
}
private async getAdapter(): Promise<AdapterDescription> {
@@ -463,8 +497,9 @@ export class AdapterStartedDialog implements OnInit {
pipelineOperationStatus => {
this.pipelineOperationStatus =
pipelineOperationStatus;
- this.startAdapter(adapterElementId, true);
- this.addToAsset(pipelineId);
+ this.startAdapter(adapterElementId, true, () =>
+ this.addToAsset(pipelineId),
+ );
},
error => {
this.onAdapterFailure(error.error);