This is an automated email from the ASF dual-hosted git repository. tenthe pushed a commit to branch fix-e2e-map in repository https://gitbox.apache.org/repos/asf/streampipes.git
commit 6fa4536710e4b695907ea48159e78b940b985368 Author: Philipp Zehnder <[email protected]> AuthorDate: Tue May 19 09:48:47 2026 +0200 fix: add compact adapter and map test --- ui/cypress/tests/chart/chart-types/map.spec.ts | 14 ++++++-------- .../connect/compact/addCompactAdapter.spec.ts | 2 +- .../map/config/map-widget-config.component.html | 16 ++++++++++------ .../components/charts/map/map-widget.component.ts | 22 ++++++++++++++-------- 4 files changed, 31 insertions(+), 23 deletions(-) diff --git a/ui/cypress/tests/chart/chart-types/map.spec.ts b/ui/cypress/tests/chart/chart-types/map.spec.ts index abf925577f..128d307a1b 100644 --- a/ui/cypress/tests/chart/chart-types/map.spec.ts +++ b/ui/cypress/tests/chart/chart-types/map.spec.ts @@ -35,12 +35,12 @@ describe('Test Map View in Charts', () => { ChartUtils.openVisualizationConfig(); cy.dataCy('data-view-map-select-latitude') .click() - .get('mat-option') - .contains('randomnumber (prepared_data #1)') + .find('mat-option') + .contains('count (prepared_data #1)') .click(); cy.dataCy('data-view-map-select-longitude') .click() - .get('mat-option') + .find('mat-option') .contains('randomnumber (prepared_data #1)') .click(); @@ -54,11 +54,9 @@ describe('Test Map View in Charts', () => { // Change from markers to trace ChartUtils.openVisualizationConfig(); - cy.dataCy('data-view-map-select-marker-or-trace') - .click() - .get('mat-option') - .contains('Trace') - .click(); + cy.dataCy('data-view-map-select-marker-or-trace').click(); + cy.dataCy('data-view-map-option-trace').click(); + cy.dataCy('data-view-map-option-trace').should('not.exist'); // Check if trace is visible cy.get('path').should('have.class', 'leaflet-interactive'); diff --git a/ui/cypress/tests/connect/compact/addCompactAdapter.spec.ts b/ui/cypress/tests/connect/compact/addCompactAdapter.spec.ts index 3a28832474..aca0238661 100644 --- a/ui/cypress/tests/connect/compact/addCompactAdapter.spec.ts +++ b/ui/cypress/tests/connect/compact/addCompactAdapter.spec.ts @@ -105,7 +105,7 @@ describe('Add Compact Adapters', () => { .withScript( 'function transform(event, out, ctx) {\n' + ' out.collect(event);\n' + - '}\n', + '', ) .build(); diff --git a/ui/src/app/chart-shared/components/charts/map/config/map-widget-config.component.html b/ui/src/app/chart-shared/components/charts/map/config/map-widget-config.component.html index 51e5772f47..12a71635b5 100644 --- a/ui/src/app/chart-shared/components/charts/map/config/map-widget-config.component.html +++ b/ui/src/app/chart-shared/components/charts/map/config/map-widget-config.component.html @@ -87,12 +87,16 @@ (selectionChange)="triggerViewRefresh()" data-cy="data-view-map-select-marker-or-trace" > - <mat-option [value]="'marker'">{{ - 'Marker' | translate - }}</mat-option> - <mat-option [value]="'trace'">{{ - 'Trace' | translate - }}</mat-option> + <mat-option + [value]="'marker'" + data-cy="data-view-map-option-marker" + >{{ 'Marker' | translate }}</mat-option + > + <mat-option + [value]="'trace'" + data-cy="data-view-map-option-trace" + >{{ 'Trace' | translate }}</mat-option + > </mat-select> </mat-form-field> </sp-form-field> diff --git a/ui/src/app/chart-shared/components/charts/map/map-widget.component.ts b/ui/src/app/chart-shared/components/charts/map/map-widget.component.ts index ea5ed5af96..2afaaa0ce2 100644 --- a/ui/src/app/chart-shared/components/charts/map/map-widget.component.ts +++ b/ui/src/app/chart-shared/components/charts/map/map-widget.component.ts @@ -91,6 +91,11 @@ export class MapWidgetComponent options = {}; ngOnInit(): void { + this.mapWidth = this.initialSize.width; + this.mapHeight = this.initialSize.height; + this.layers = []; + this.markerIds = []; + this.showMarkers = true; super.ngOnInit(); this.locationConfigService.getLocationConfig().subscribe(config => { this.options = { @@ -98,10 +103,8 @@ export class MapWidgetComponent zoom: 1, center: this.defaultCenter, }; + this.invalidateMapSize(); }); - this.layers = []; - this.markerIds = []; - this.showMarkers = true; } markerImage(selectedMarker: string): string { @@ -112,7 +115,7 @@ export class MapWidgetComponent onMapReady(map: Map) { this.map = map; - this.map.invalidateSize(); + this.invalidateMapSize(); } makeMarker(point: LatLngExpression, markerType: string): Marker { @@ -147,16 +150,14 @@ export class MapWidgetComponent this.makeLayers(this.lastDataResults); if (this.map) { this.map.setView(usedCenter, zoom); - this.map.invalidateSize(); + this.invalidateMapSize(); } } onResize(width: number, height: number) { this.mapWidth = width; this.mapHeight = height; - if (this.map) { - this.map.invalidateSize(); - } + this.invalidateMapSize(); } handleUpdatedFields( @@ -164,6 +165,10 @@ export class MapWidgetComponent removedFields: DataExplorerField[], ) {} + private invalidateMapSize(): void { + setTimeout(() => this.map?.invalidateSize()); + } + beforeDataFetched() { this.setShownComponents(false, false, true); } @@ -172,6 +177,7 @@ export class MapWidgetComponent this.setShownComponents(false, true, false, false); this.lastDataResults = spQueryResult[0]; this.makeLayers(spQueryResult[0]); + this.invalidateMapSize(); } transform(rows, index: number): any[] {
