Skip to content

Commit

Permalink
[Fix] Map extension with mcap files (#163)
Browse files Browse the repository at this point in the history
**User-Facing Changes**
This is a bug fix. Previoulsy, when loading a file and trying to load
the Map panel there was an error being show.

**Description**
Due the past implementations some bug was introduced when loading the
config object on Panel Extension Adapter. When forcing it to be
initialized with 'initialState.current' the topics were not being loaded
correctly. We also added some tests to verify that the Map panel is
being loaded correctly.

**Checklist**

- [x] The web version was tested and it is running ok
- [x] The desktop version was tested and it is running ok
- [x] I've updated/created the storybook file(s)
  • Loading branch information
laisspportugal authored Aug 30, 2024
1 parent d51d02d commit 4619bb5
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
43 changes: 43 additions & 0 deletions desktop/integration-test/mapPanel.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// SPDX-FileCopyrightText: Copyright (C) 2023-2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)<[email protected]>
// SPDX-License-Identifier: MPL-2.0

import path from "path";

import { AppType, launchApp } from "./launchApp";

describe("mapPanel", () => {
const closeDataSourceDialogAfterAppLaunch = async (app: AppType) => {
await expect(app.renderer.getByTestId("DataSourceDialog").isVisible()).resolves.toBe(true);
await app.renderer.getByTestId("DataSourceDialog").getByTestId("CloseIcon").click();
await expect(app.renderer.getByTestId("DataSourceDialog").isVisible()).resolves.toBe(false);
};

it("should open map panel when loading a file", async () => {
await using app = await launchApp();
await closeDataSourceDialogAfterAppLaunch(app);
//Add rosbag file from source
const filePath = path.resolve(
__dirname,
"../../packages/suite-base/src/test/fixtures/example.bag",
);
//Drag and drop file
const fileInput = app.renderer.locator("[data-puppeteer-file-upload]");
await fileInput.setInputFiles(filePath);

//Click on add panel and select Map
await app.renderer.getByTestId("AddPanelButton").click();

// Click on "Search panels" input field and type Map
const searchInput = app.renderer.getByPlaceholder("Search panels");
// await searchInput.click();
await searchInput.type("Map");
await app.renderer.getByTestId("panel-menu-item Map").click();

const mapSettingsIcon = app.renderer.getByTestId("SettingsIcon").nth(0);
await mapSettingsIcon.click();

await expect(app.renderer.getByText("Map panel", { exact: true }).innerText()).resolves.toBe(
"Map panel",
);
}, 15_000);
});
1 change: 1 addition & 0 deletions packages/suite-base/src/components/AppBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ export function AppBar(props: AppBarProps): JSX.Element {
color="inherit"
disabled={!hasCurrentLayout}
id="add-panel-button"
data-testid="AddPanelButton"
data-tourid="add-panel-button"
title={t("addPanel")}
aria-label="Add panel button"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ function PanelExtensionAdapter(
sortedTopics,
subscriptions: localSubscriptions,
watchedFields,
config: initialState.current,
config: undefined,
});

if (!renderState) {
Expand Down

0 comments on commit 4619bb5

Please sign in to comment.