From df3e2037c313b916fd93f601d92f6053beba90b3 Mon Sep 17 00:00:00 2001 From: Paul Clue <67766160+Paul-Clue@users.noreply.github.com> Date: Thu, 29 Feb 2024 15:18:53 -0500 Subject: [PATCH 01/11] Add recent changes --- .../InstructionsRenderer.jsx | 78 +++++++++++++++++-- shared/convertAssertionPriority.js | 7 +- 2 files changed, 74 insertions(+), 11 deletions(-) diff --git a/client/components/CandidateReview/CandidateTestPlanRun/InstructionsRenderer.jsx b/client/components/CandidateReview/CandidateTestPlanRun/InstructionsRenderer.jsx index abf723901..05a706228 100644 --- a/client/components/CandidateReview/CandidateTestPlanRun/InstructionsRenderer.jsx +++ b/client/components/CandidateReview/CandidateTestPlanRun/InstructionsRenderer.jsx @@ -1,7 +1,7 @@ import React, { useEffect, useState } from 'react'; import PropTypes from 'prop-types'; import styled from '@emotion/styled'; -import { Button } from 'react-bootstrap'; +import { Button, Table } from 'react-bootstrap'; import { unescape } from 'lodash'; import { parseListContent, @@ -19,6 +19,7 @@ import { TestWindow } from '../../../resources/aria-at-test-window.mjs'; import { evaluateAtNameKey } from '../../../utils/aria.js'; import commandsJson from '../../../resources/commands.json'; import supportJson from '../../../resources/support.json'; +import { convertAssertionPriority } from 'shared'; const NumberedList = styled.ol` counter-reset: numbered-list; @@ -169,19 +170,82 @@ const InstructionsRenderer = ({ commandsContent ); - const assertions = [...pageContent.instructions.assertions.assertions]; - const assertionsContent = parseListContent(assertions); - + headingLevel = 5; const Heading = `h${headingLevel}`; + console.log(renderableContent) + return ( <> {allInstructionsContent} - {pageContent.instructions.assertions.header} - {pageContent.instructions.assertions.description} - {assertionsContent} {settingsContent.length ? settingsContent : null} + {renderableContent.commands.map(({ id, settings }, i) => { + debugger; + const settingsScreenText = + renderableContent.target.at.raw.settings[settings] + ?.screenText ?? ''; + + let mustCount = 0; + let shouldCount = 0; + let mayCount = 0; + + renderableContent.assertions.forEach(({ priority }) => { + const priorityString = convertAssertionPriority(priority); + if (priorityString === 'MUST') mustCount += 1; + if (priorityString === 'SHOULD') shouldCount += 1; + if (priorityString === 'MAY') mayCount += 1; + }); + + const settingsScreenTextFormatted = + settingsScreenText === '' ? '' : ` (${settingsScreenText})`; + + const scenarioTitle = + `${renderableContent.commands[i].keystroke}` + + `${settingsScreenTextFormatted}: ${mustCount} MUST, ` + + `${shouldCount} SHOULD, ${mayCount} MAY Assertions`; + + return ( + <> + {scenarioTitle} + + + + + + + + + + {renderableContent.assertions.map( + ({ + assertionPhrase, + assertionStatement, + priority, + assertionId + }) => ( + + + + + + ) + )} + +
PriorityAssertion PhraseAssertion Statement
+ {convertAssertionPriority( + priority + )} + {assertionPhrase}{assertionStatement}
+ + ); + })} +