Skip to content

Commit

Permalink
Simplify the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
laisspportugal committed Aug 28, 2024
1 parent 4cd373c commit 6944882
Showing 1 changed file with 11 additions and 19 deletions.
30 changes: 11 additions & 19 deletions desktop/integration-test/openFile.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// 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";

Check failure on line 4 in desktop/integration-test/openFile.test.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-20.04)

There should be at least one empty line between import groups
import path from "path";

Check failure on line 5 in desktop/integration-test/openFile.test.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-20.04)

`path` import should occur before import of `./launchApp`

describe("menus", () => {
const closeDataSourceDialogAfterAppLaunch = async (app: AppType) => {
Expand All @@ -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 () => {

Check failure on line 14 in desktop/integration-test/openFile.test.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-20.04)

Insert `··`
await using app = await launchApp();
await closeDataSourceDialogAfterAppLaunch(app);

Expand All @@ -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]');

Check failure on line 30 in desktop/integration-test/openFile.test.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-20.04)

Replace `=·app.renderer.locator('[data-puppeteer-file-upload]'` with `·=·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(

Check failure on line 34 in desktop/integration-test/openFile.test.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-20.04)

Replace `⏎······app.renderer.getByText("example.bag",·{·exact:·true·}).innerText(),⏎····).resolves.toBe("example.bag");` with `app.renderer.getByText("example.bag",·{·exact:·true·}).innerText()).resolves.toBe(⏎······"example.bag",⏎····);⏎··`
app.renderer.getByText("example.bag", { exact: true }).innerText(),
).resolves.toBe("example.bag");}, 20_000);
});

0 comments on commit 6944882

Please sign in to comment.