diff --git a/client/components/TestManagement/StatusSummaryRow/index.jsx b/client/components/TestManagement/StatusSummaryRow/index.jsx index a789962ee..f2f2e34c4 100644 --- a/client/components/TestManagement/StatusSummaryRow/index.jsx +++ b/client/components/TestManagement/StatusSummaryRow/index.jsx @@ -30,6 +30,10 @@ const PhaseText = styled.span` } `; +const NoPhaseText = styled.span` + margin-left: 12px; +`; + const PhaseDot = styled.span` display: inline-block; height: 10px; @@ -114,63 +118,69 @@ const StatusSummaryRow = ({ reportResult, testPlanVersion }) => { {testPlanVersion.title} - - {phase} - + {Object.entries(reportResult).length > 0 && ( + + {phase} + + )} - - - - {phase} - - - { - await bulkUpdateReportStatus( - testPlanReports.map(i => i.id), - 'DRAFT' - ); - }} - > - - Draft - - { - await bulkUpdateReportStatus( - testPlanReports.map(i => i.id), - 'CANDIDATE' - ); - }} - > - - Candidate - - { - await bulkUpdateReportStatus( - testPlanReports.map(i => i.id), - 'RECOMMENDED' - ); - }} + {(Object.entries(reportResult).length <= 0 && ( + Not tested + )) || ( + + - - Recommended - - - + + {phase} + + + { + await bulkUpdateReportStatus( + testPlanReports.map(i => i.id), + 'DRAFT' + ); + }} + > + + Draft + + { + await bulkUpdateReportStatus( + testPlanReports.map(i => i.id), + 'CANDIDATE' + ); + }} + > + + Candidate + + { + await bulkUpdateReportStatus( + testPlanReports.map(i => i.id), + 'RECOMMENDED' + ); + }} + > + + Recommended + + + + )} diff --git a/client/components/TestManagement/index.jsx b/client/components/TestManagement/index.jsx index 6cb17a120..44d787f34 100644 --- a/client/components/TestManagement/index.jsx +++ b/client/components/TestManagement/index.jsx @@ -25,6 +25,7 @@ const TestManagement = () => { const [pageReady, setPageReady] = useState(false); const [ats, setAts] = useState([]); const [browsers, setBrowsers] = useState([]); + const [testPlans, setTestPlans] = useState([]); const [testPlanVersions, setTestPlanVersions] = useState([]); const [testPlanReports, setTestPlanReports] = useState([]); @@ -34,11 +35,13 @@ const TestManagement = () => { ats = [], browsers = [], testPlanVersions = [], - testPlanReports = [] + testPlanReports = [], + testPlans = [] } = data; setAts(ats); setTestPlanVersions(testPlanVersions); setTestPlanReports(testPlanReports); + setTestPlans(testPlans); setBrowsers(browsers); setPageReady(true); } @@ -102,6 +105,7 @@ const TestManagement = () => { ] = null; }); }); + testPlanReports.forEach(testPlanReport => { const { testPlanVersion, at, browser } = testPlanReport; const directory = testPlanVersion.testPlan.directory; @@ -117,6 +121,12 @@ const TestManagement = () => { ].testPlanVersion = testPlanVersion; }); + testPlans.forEach(testPlan => { + if (!(testPlan.directory in tabularReportsByDirectory)) { + tabularReportsByDirectory[testPlan.directory] = testPlan; + } + }); + const combineObject = originalObject => { let combinedTestPlanVersionIdArray = []; let resultTestPlanTargets = Object.values(originalObject)[0]; @@ -223,14 +233,17 @@ const TestManagement = () => { {/* Sort the summary items by title */} {Object.values(tabularReportsByDirectory) - .sort((a, b) => - Object.values(a)[0].testPlanVersion - .title < - Object.values(b)[0].testPlanVersion - .title - ? -1 - : 1 - ) + .sort((a, b) => { + return ( + a.title || + Object.values(a)[0].testPlanVersion + .title + ).localeCompare( + b.title || + Object.values(b)[0] + .testPlanVersion.title + ); + }) .map(tabularReport => { let reportResult = null; let testPlanVersionId = null; @@ -238,6 +251,24 @@ const TestManagement = () => { // Evaluate what is prioritised across the // collection of testPlanVersions if ( + typeof Object.values( + tabularReport + )[0] !== 'object' + ) { + return ( + + ); + } else if ( Object.values(tabularReport) .length > 1 ) { diff --git a/client/components/TestManagement/queries.js b/client/components/TestManagement/queries.js index 0926ae8a1..8a1d78e7c 100644 --- a/client/components/TestManagement/queries.js +++ b/client/components/TestManagement/queries.js @@ -15,6 +15,15 @@ export const TEST_MANAGEMENT_PAGE_QUERY = gql` id name } + testPlans { + directory + id + title + latestTestPlanVersion { + id + title + } + } testPlanVersions { id title diff --git a/server/graphql-schema.js b/server/graphql-schema.js index 7b37ee5fd..04d8a32e1 100644 --- a/server/graphql-schema.js +++ b/server/graphql-schema.js @@ -212,6 +212,7 @@ const graphqlSchema = gql` as a directory, and this allows you to do both. """ id: ID! + title: String! """ Corresponds to directory in the ARIA-AT repo which stores the test plan, e.g. "checkbox-tri-state" or "disclosure-navigation" diff --git a/server/models/services/TestPlanVersionService.js b/server/models/services/TestPlanVersionService.js index 1d8c28eb3..bd5f3d221 100644 --- a/server/models/services/TestPlanVersionService.js +++ b/server/models/services/TestPlanVersionService.js @@ -375,6 +375,7 @@ const getTestPlans = async ({ directory as "id", directory as "directory", id as "latestTestPlanVersionId", + "title", "updatedAt" FROM "TestPlanVersion" ${whereClause}