From 694488268389054502d205d4d924e3d70ba48dd8 Mon Sep 17 00:00:00 2001 From: Lais Portugal Date: Wed, 28 Aug 2024 15:15:16 +0100 Subject: [PATCH] Simplify the tests --- desktop/integration-test/openFile.test.ts | 30 +++++++++-------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/desktop/integration-test/openFile.test.ts b/desktop/integration-test/openFile.test.ts index f221f0bb76..a33d5de1a9 100644 --- a/desktop/integration-test/openFile.test.ts +++ b/desktop/integration-test/openFile.test.ts @@ -1,9 +1,8 @@ // SPDX-FileCopyrightText: Copyright (C) 2023-2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // SPDX-License-Identifier: MPL-2.0 -import path from "path"; - import { AppType, launchApp } from "./launchApp"; +import path from "path"; describe("menus", () => { const closeDataSourceDialogAfterAppLaunch = async (app: AppType) => { @@ -12,7 +11,7 @@ describe("menus", () => { await expect(app.renderer.getByTestId("DataSourceDialog").isVisible()).resolves.toBe(false); }; - it("when opening the rosbag file the data should be shown on the 3D panel", async () => { +it("should open the rosbag file when dragging and dropping it", async () => { await using app = await launchApp(); await closeDataSourceDialogAfterAppLaunch(app); @@ -21,25 +20,18 @@ describe("menus", () => { __dirname, "../../packages/suite-base/src/test/fixtures/example.bag", ); + + //Expect that there are not preloaded files await expect( app.renderer.getByText("No data source", { exact: true }).innerText(), ).resolves.toBe("No data source"); - const fileInput = app.renderer.locator("[data-puppeteer-file-upload]"); - await fileInput.setInputFiles(filePath); - - // wait until the elements are rendered - await app.renderer.waitForTimeout(6000); - //Click on play button - const playButton = app.renderer.getByTitle("Play").nth(0); - await playButton.click(); + //Drag and drop file + const fileInput= app.renderer.locator('[data-puppeteer-file-upload]'); + await fileInput.setInputFiles(filePath); - //Click on 3D panel - const threeDeeSettingsIcon = app.renderer.getByTestId("SettingsIcon").nth(0); - await threeDeeSettingsIcon.waitFor(); - await threeDeeSettingsIcon.click(); - // Verify if the file was loaded by searching on the left panel for the element contained on the file - const textContent = app.renderer.locator('div[role="button"]').textContent(); - expect(textContent).toContain("world"); - }, 20_000); + //Expect that the file is being shown + await expect( + app.renderer.getByText("example.bag", { exact: true }).innerText(), + ).resolves.toBe("example.bag");}, 20_000); });