From 1561ef7a60bb1d0a8aedef6354e03dfbce417d7f Mon Sep 17 00:00:00 2001 From: kraaij <kraaij@astron.nl> Date: Tue, 17 Oct 2023 19:57:56 +0200 Subject: [PATCH] Corrected typo in Unit Test For Task View test --- .../frontend/tmss_webapp/src/routes/Task/view.test.js | 8 +++----- SAS/TMSS/frontend/tmss_webapp/src/utils/test.helper.js | 3 ++- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Task/view.test.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Task/view.test.js index 5a6dcc003a6..67139aab113 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Task/view.test.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Task/view.test.js @@ -1,7 +1,7 @@ import React from 'react'; import { BrowserRouter as Router } from 'react-router-dom'; import { act } from "react-dom/test-utils"; -import { render, cleanup, fireEvent,waitFor } from '@testing-library/react'; +import { render, cleanup, waitFor } from '@testing-library/react'; import '@testing-library/jest-dom'; import mockConsole from 'jest-mock-console'; import _ from 'lodash'; @@ -1519,15 +1519,13 @@ it("Checking Correctness of Custom fields in JEditor using Simple Observation dr expect(freqSAP.value).toBe('99.9-147.6'); - /* These seems to be actually not present in the node. Unclear if this is due too a failing test, or recently changed design */ - + await waitFor(()=>expect(content.getByRole("textbox",{name: "specification[station_configuration][SAPs][0][digital_pointing][angle1]"})).toBeInTheDocument()); await waitFor(()=>expect(content.getByRole("textbox",{name: "specification[station_configuration][SAPs][0][digital_pointing][angle2]"})).toBeInTheDocument()); const angle1El =content.getByRole("textbox",{name: "specification[station_configuration][SAPs][0][digital_pointing][angle1]"}); - const angle1E2 =content.getByRole("textbox",{name: "specification[station_configuration][SAPs][0][digital_pointing][angle1]"}); + const angle1E2 =content.getByRole("textbox",{name: "specification[station_configuration][SAPs][0][digital_pointing][angle2]"}); expect(angle1El.value).toBe('03h06m00s'); - //const angle1E2 = content.getByLabelText("specification[station_configuration][SAPs][0][digital_pointing][angle2]"); expect(angle1E2.value).toBe('89d59m00s'); }); \ No newline at end of file diff --git a/SAS/TMSS/frontend/tmss_webapp/src/utils/test.helper.js b/SAS/TMSS/frontend/tmss_webapp/src/utils/test.helper.js index 289339801b5..7e47597f9a4 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/utils/test.helper.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/utils/test.helper.js @@ -1,5 +1,5 @@ import {act} from "react-dom/test-utils"; -import {fireEvent, render, screen} from "@testing-library/react"; +import {fireEvent, render, screen,waitFor} from "@testing-library/react"; import {BrowserRouter as Router} from "react-router-dom"; const TIMEOUT = 300 @@ -12,6 +12,7 @@ export async function clickItem(item, timeout = TIMEOUT) { } export async function setMultiSelectValue(pageContent, multiSelectTestId, multiSelectValue, timeout = TIMEOUT) { + await waitFor(() => expect(pageContent.queryByTestId(multiSelectTestId)).toBeInTheDocument()); // give rendering the time to have it. await clickItem(pageContent.queryByTestId(multiSelectTestId)); let items = [] -- GitLab