From 7dd31e11a60fa03e46160a05ca4d2fbe3fde0fa4 Mon Sep 17 00:00:00 2001 From: Stalgia Grigg Date: Thu, 16 Nov 2023 11:07:46 -0800 Subject: [PATCH 1/3] Fix bug that causes crash on DataManagement page ManageTestQueue AT dropdown --- client/components/DataManagement/queries.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/components/DataManagement/queries.js b/client/components/DataManagement/queries.js index d5c40cc46..0f2aa05a1 100644 --- a/client/components/DataManagement/queries.js +++ b/client/components/DataManagement/queries.js @@ -10,6 +10,10 @@ export const DATA_MANAGEMENT_PAGE_QUERY = gql` ats { id name + browsers { + id + name + } atVersions { id name From 9319e3780ec1bc82edc81b8073682fe1848e8452 Mon Sep 17 00:00:00 2001 From: Stalgia Grigg Date: Thu, 16 Nov 2023 11:16:37 -0800 Subject: [PATCH 2/3] Remove browsers from query and state in TestQueue and DataManagement in favor of at.browsers --- client/components/DataManagement/index.jsx | 10 +--------- client/components/DataManagement/queries.js | 4 ---- client/components/ManageTestQueue/index.jsx | 10 +++++----- client/components/TestQueue/index.jsx | 4 ---- client/components/TestQueue/queries.js | 4 ---- 5 files changed, 6 insertions(+), 26 deletions(-) diff --git a/client/components/DataManagement/index.jsx b/client/components/DataManagement/index.jsx index 3c68d48d7..5f4cc2414 100644 --- a/client/components/DataManagement/index.jsx +++ b/client/components/DataManagement/index.jsx @@ -30,7 +30,6 @@ const DataManagement = () => { const [pageReady, setPageReady] = useState(false); const [ats, setAts] = useState([]); - const [browsers, setBrowsers] = useState([]); const [testPlans, setTestPlans] = useState([]); const [testPlanVersions, setTestPlanVersions] = useState([]); const [filter, setFilter] = useState( @@ -42,14 +41,8 @@ const DataManagement = () => { useEffect(() => { if (data) { - const { - ats = [], - browsers = [], - testPlanVersions = [], - testPlans = [] - } = data; + const { ats = [], testPlanVersions = [], testPlans = [] } = data; setAts(ats); - setBrowsers(browsers); setTestPlans(testPlans); setTestPlanVersions(testPlanVersions); setPageReady(true); @@ -131,7 +124,6 @@ const DataManagement = () => { diff --git a/client/components/DataManagement/queries.js b/client/components/DataManagement/queries.js index 0f2aa05a1..413bb0ce5 100644 --- a/client/components/DataManagement/queries.js +++ b/client/components/DataManagement/queries.js @@ -26,10 +26,6 @@ export const DATA_MANAGEMENT_PAGE_QUERY = gql` id } } - browsers { - id - name - } testPlans { id directory diff --git a/client/components/ManageTestQueue/index.jsx b/client/components/ManageTestQueue/index.jsx index 513480016..cd5aee9c2 100644 --- a/client/components/ManageTestQueue/index.jsx +++ b/client/components/ManageTestQueue/index.jsx @@ -91,7 +91,6 @@ const DisclosureContainer = styled.div` const ManageTestQueue = ({ ats = [], - browsers = [], testPlanVersions = [], triggerUpdate = () => {} }) => { @@ -667,9 +666,11 @@ const ManageTestQueue = ({ item => item.id === selectedTestPlanVersionId )} at={ats.find(item => item.id === selectedAtId)} - browser={browsers.find( - item => item.id === selectedBrowserId - )} + browser={ats + .find(at => at.id === selectedAtId) + ?.browsers.find( + browser => browser.id === selectedBrowserId + )} triggerUpdate={triggerUpdate} disabled={ !selectedTestPlanVersionId || @@ -738,7 +739,6 @@ const ManageTestQueue = ({ ManageTestQueue.propTypes = { ats: PropTypes.array, - browsers: PropTypes.array, testPlanVersions: PropTypes.array, triggerUpdate: PropTypes.func }; diff --git a/client/components/TestQueue/index.jsx b/client/components/TestQueue/index.jsx index 2fb8ef344..da9f8a3fd 100644 --- a/client/components/TestQueue/index.jsx +++ b/client/components/TestQueue/index.jsx @@ -21,7 +21,6 @@ const TestQueue = () => { const [pageReady, setPageReady] = useState(false); const [testers, setTesters] = useState([]); const [ats, setAts] = useState([]); - const [browsers, setBrowsers] = useState([]); const [testPlanVersions, setTestPlanVersions] = useState([]); const [testPlanReports, setTestPlanReports] = useState([]); const [latestTestPlanVersions, setLatestTestPlanVersions] = useState([]); @@ -45,7 +44,6 @@ const TestQueue = () => { const { users = [], ats = [], - browsers = [], testPlanVersions = [], testPlanReports = [], testPlans = [] @@ -60,7 +58,6 @@ const TestQueue = () => { setAts(ats); setTestPlanVersions(testPlanVersions); setTestPlanReports(testPlanReports); - setBrowsers(browsers); setLatestTestPlanVersions(testPlans); setPageReady(true); } @@ -254,7 +251,6 @@ const TestQueue = () => { {isAdmin && ( diff --git a/client/components/TestQueue/queries.js b/client/components/TestQueue/queries.js index 37f6b2d52..2393b1ac3 100644 --- a/client/components/TestQueue/queries.js +++ b/client/components/TestQueue/queries.js @@ -33,10 +33,6 @@ export const TEST_QUEUE_PAGE_QUERY = gql` name } } - browsers { - id - name - } testPlanVersions { id title From c1bf56ad7700369c08754aa52c8de6e95134dc3c Mon Sep 17 00:00:00 2001 From: Stalgia Grigg Date: Thu, 16 Nov 2023 11:29:56 -0800 Subject: [PATCH 3/3] Update DataManagement test mock --- .../DataManagementPagePopulatedMock.js | 48 +++++++++++++------ 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/client/tests/__mocks__/GraphQLMocks/DataManagementPagePopulatedMock.js b/client/tests/__mocks__/GraphQLMocks/DataManagementPagePopulatedMock.js index be5024bca..dda16c31a 100644 --- a/client/tests/__mocks__/GraphQLMocks/DataManagementPagePopulatedMock.js +++ b/client/tests/__mocks__/GraphQLMocks/DataManagementPagePopulatedMock.js @@ -39,6 +39,16 @@ export default ( releasedAt: '2021-11-01T04:00:00.000Z' } ], + browsers: [ + { + id: '2', + name: 'Chrome' + }, + { + id: '1', + name: 'Firefox' + } + ], candidateBrowsers: [{ id: '2' }], recommendedBrowsers: [{ id: '1' }, { id: '2' }] }, @@ -52,6 +62,16 @@ export default ( releasedAt: '2021-02-19T05:00:00.000Z' } ], + browsers: [ + { + id: '2', + name: 'Chrome' + }, + { + id: '1', + name: 'Firefox' + } + ], candidateBrowsers: [{ id: '2' }], recommendedBrowsers: [{ id: '1' }, { id: '2' }] }, @@ -65,24 +85,24 @@ export default ( releasedAt: '2019-09-01T04:00:00.000Z' } ], + browsers: [ + { + id: '2', + name: 'Chrome' + }, + { + id: '1', + name: 'Firefox' + }, + { + id: '3', + name: 'Safari' + } + ], candidateBrowsers: [{ id: '3' }], recommendedBrowsers: [{ id: '2' }, { id: '3' }] } ], - browsers: [ - { - id: '2', - name: 'Chrome' - }, - { - id: '1', - name: 'Firefox' - }, - { - id: '3', - name: 'Safari' - } - ], testPlans: [ { id: '27',