From 26ac253709d7cdfe4715b9411f210b38c16aaccf Mon Sep 17 00:00:00 2001
From: Ramesh Kumar <ramesh.p@matriotsolutions.com>
Date: Tue, 13 Sep 2022 18:12:53 +0530
Subject: [PATCH] TMSS-1648: Fixed selected station test in task edit and view
 tests

---
 .../tmss_webapp/src/components/JSONEditor/JEditor.js        | 2 +-
 SAS/TMSS/frontend/tmss_webapp/src/routes/Task/edit.test.js  | 3 ++-
 SAS/TMSS/frontend/tmss_webapp/src/routes/Task/view.test.js  | 6 ++++--
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/SAS/TMSS/frontend/tmss_webapp/src/components/JSONEditor/JEditor.js b/SAS/TMSS/frontend/tmss_webapp/src/components/JSONEditor/JEditor.js
index de1840eeba5..ca787e5e175 100644
--- a/SAS/TMSS/frontend/tmss_webapp/src/components/JSONEditor/JEditor.js
+++ b/SAS/TMSS/frontend/tmss_webapp/src/components/JSONEditor/JEditor.js
@@ -1069,7 +1069,7 @@ function Jeditor(props) {
                 if (editor && editor.editors && editor.editors[stationPath]) {
                     let stationList =  editor.editors[stationPath].value;
                     let selectedStationsContent = '<label for="specification[resources][selected_station_list]">Selected Stations</label>';
-                    selectedStationsContent += `<div id='${stationPath}.stations_tag'>`;
+                    selectedStationsContent += `<div id='${stationPath}.stations_tag' role='selected_stations'>`;
                     if (stationList && stationList.length>0) {
                         for (const station of stationList) {
                             selectedStationsContent += `<span class="tag-content p-chips-token-label selected-station-tag">${station}</span>`;
diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Task/edit.test.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Task/edit.test.js
index 351583767d9..05c49cbc472 100644
--- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Task/edit.test.js
+++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Task/edit.test.js
@@ -543,7 +543,8 @@ it("test IM BF Cal&Tgt Task Draft edit", async () => {
     
     expect(content.getByLabelText("specification[beamformer][pipelines][0][name]")).toBeInTheDocument();
     expect(content.getAllByText("Station groups").length).toBe(2);
-    expect(content.getByText("Station 21")).toBeInTheDocument();
+    expect(content.getAllByRole("selected_stations").length).toBe(1);
+    expect(content.getAllByRole("selected_stations")[0].children.length).toBe(21);
     expect(content.getByLabelText("specification[beamformer][pipelines][0][station_groups][0][max_nr_missing]")).toBeInTheDocument();
     expect(content.getByText("Use PPF when beamforming")).toBeInTheDocument();
     
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 84d071e0d3a..e327128f7ba 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
@@ -355,7 +355,8 @@ it("test IM BF Cal&Tgt Task Draft view", async () => {
     
     expect(content.getByLabelText("specification[beamformer][pipelines][0][name]")).toBeInTheDocument();
     expect(content.getAllByText("Station groups").length).toBe(2);
-    expect(content.getByText("Station 21")).toBeInTheDocument();
+    expect(content.getAllByRole("selected_stations").length).toBe(1);
+    expect(content.getAllByRole("selected_stations")[0].children.length).toBe(21);
     expect(content.getByLabelText("specification[beamformer][pipelines][0][station_groups][0][max_nr_missing]")).toBeInTheDocument();
     expect(content.getByText("Use PPF when beamforming")).toBeInTheDocument();
     
@@ -963,7 +964,8 @@ it("test IM BF Cal&Tgt Task Blueprint view", async () => {
     
     expect(content.getByLabelText("specification[beamformer][pipelines][0][name]")).toBeInTheDocument();
     expect(content.getAllByText("Station groups").length).toBe(2);
-    expect(content.getByText("Station 21")).toBeInTheDocument();
+    expect(content.getAllByRole("selected_stations").length).toBe(1);
+    expect(content.getAllByRole("selected_stations")[0].children.length).toBe(21);
     expect(content.getByLabelText("specification[beamformer][pipelines][0][station_groups][0][max_nr_missing]")).toBeInTheDocument();
     expect(content.getByText("Use PPF when beamforming")).toBeInTheDocument();
     
-- 
GitLab