Skip to content

Commit

Permalink
Support V2 test format on the test review page (#883)
Browse files Browse the repository at this point in the history
* Update client/resources

* Update import script to support v2 test format import

* Update import script to include flattened commandsV2.json and add uniquely generated scenario and assertion IDs

* Updating client and server files to support V2 test format

* Remove console.log and add TODO

* Include tokenized assertionStatement in TestPlanVersion.tests[x].assertions

* Add retrieveCommands utility

* Update candidate review and datamanagement page

* Update Reports/queries to also include mayOptionalAssertionResults

* Add support for AtMode and and referencing appropriate screen text in testsResolver

* Remove console log

* Fix edge case issue when saving test result and add priority standardizing utility

* Add assertions checks for may assertions

* Update getMetrics utils

* Update test-import to account for single {at}-focused .collected file

* Address file error

* Fix tests

* Update import branch

* Fix edge case crash when viewing CandidateTestPlanRun

* Update tests and prepare support for testing v2 format test plan versions

* Update tests

* Update workflow

* Clarifying comment

* Update runtest.yml to exclude v2 test format import

* Update server/resolvers/TestPlanVersion/testsResolver.js

Remove unnecessary `at.settings` check

Co-authored-by: Stalgia Grigg <stalgia@bocoup.com>

* Clearer differences between v1 and v2 test format tests being imported

* Include typedef for RenderableContent

* Update thrown error message when missing commands.json (v2)

* Additional check for flattenObject

* Fix bug found after rebase and update jsdoc on 'retrieveAttributes'

* Updating Test Run page to support #743

* Update Test Run page instructions for v2 test format

* Add react-html-parser; update InstructionsRenderer

* Use testPlanVersion.metadata.testFormatVersion

* Stop defaulting testFormatVersion to 1

* Stop using NumberedList

* Update client/components/TestRenderer/utils.js

Co-authored-by: Stalgia Grigg <stalgia@bocoup.com>

* Define instructions variables

* Prepend tests with 'Test {number}' on reports page

* Address CG comments

* Address PR feedback

* Consistency

* Passed/failed for assertion results in TestRenderer

* Update test plan report conflict calculation to support pass/fail assertion results

* Correct assertion legend, margin right for checkbox

* Update inline snapshot for test queue

* Remove failedReason

* Update server/resolvers/TestResultOperations/saveTestResultCommon.js

Co-authored-by: Howard Edwards <howarde.edwards@gmail.com>

* Fix linting issue in saveTestResultCommon

* Undo change to checkAssertionResult

* Consistency

* Do radio group and supporting docs

* Revert "Do radio group and supporting docs"

This reverts commit 579f545.

* Re-commit missing update

* Commit to new branch

* Add conditional for test data

* Push to check branch

* Get page to render for v2

* Fix loop

* Fix changes

* Remove TODO items to make test plan review page available after merging in main

* Add support for aria links on review page

* Update single page view grouping under title for v2 format

* Fix styling

* Update InstructionsRenderer to also include settings specific instructions for v2 test plan version

* Include upcoming TODOs

* Include upcoming TODOs

* Add formatting change

* remove comment

* Remove comments

---------

Co-authored-by: Howard Edwards <howarde.edwards@gmail.com>
Co-authored-by: Stalgia Grigg <stalgia@bocoup.com>
  • Loading branch information
3 people authored Feb 5, 2024
1 parent 9110a14 commit 4053f67
Show file tree
Hide file tree
Showing 7 changed files with 194 additions and 100 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ import PropTypes from 'prop-types';
import styled from '@emotion/styled';
import { Button } from 'react-bootstrap';
import { unescape } from 'lodash';
import { parseListContent } from '../../TestRenderer/utils';
import {
parseListContent,
parseSettingsContent
} from '../../TestRenderer/utils';
import {
userCloseWindow,
userOpenWindow
Expand Down Expand Up @@ -120,8 +123,10 @@ const InstructionsRenderer = ({

let allInstructions;
const isV2 = testFormatVersion === 2;
let settingsContent = [];

if (isV2) {
// There is at least one defined 'setting' for the list of AT commands
const commandSettingSpecified = renderableContent.commands.some(
({ settings }) => settings && settings !== 'defaultMode'
);
Expand All @@ -144,6 +149,10 @@ const InstructionsRenderer = ({
setupScriptDescription + '.',
testInstructions + ' ' + settingsInstructions
].map(e => unescape(e));
settingsContent = parseSettingsContent(
renderableContent.instructions.mode,
renderableContent.target.at.raw.settings
);
} else {
allInstructions = [
...pageContent.instructions.instructions.instructions,
Expand All @@ -168,8 +177,12 @@ const InstructionsRenderer = ({
return (
<>
<NumberedList>{allInstructionsContent}</NumberedList>
<Heading>Assertions</Heading>

<Heading>{pageContent.instructions.assertions.header}</Heading>
{pageContent.instructions.assertions.description}
<NumberedList>{assertionsContent}</NumberedList>
{settingsContent.length ? settingsContent : null}

<Button
disabled={!pageContent.instructions.openTestPage.enabled}
onClick={pageContent.instructions.openTestPage.click}
Expand Down
22 changes: 4 additions & 18 deletions client/components/DataManagement/DataManagementRow/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -507,12 +507,6 @@ const DataManagementRow = ({
}
};

// TODO: Remove this testFormatVersion check when #745 is implemented
const getLinkHref = version =>
version.metadata?.testFormatVersion === 2
? null
: `/test-review/${version.id}`;

switch (phase) {
case 'RD': {
// If the latest version of the plan is in the draft, candidate, or recommended
Expand Down Expand Up @@ -555,14 +549,12 @@ const DataManagementRow = ({
// "active"
insertActivePhaseForTestPlan(latestVersion);

// TODO: Remove this testFormatVersion check when #745 is implemented
const linkHref = getLinkHref(latestVersion);
return (
<PhaseCell role="list" aria-setsize={isAdmin ? 2 : 1}>
<VersionString
role="listitem"
iconColor="#2BA51C"
linkHref={linkHref}
linkHref={`/test-review/${latestVersion.id}`}
>
{latestVersion.versionString}
</VersionString>
Expand Down Expand Up @@ -685,15 +677,13 @@ const DataManagementRow = ({
// Phase is "active"
insertActivePhaseForTestPlan(latestVersion);

// TODO: Remove this testFormatVersion check when #745 is implemented
const linkHref = getLinkHref(latestVersion);
return (
<PhaseCell role="list" aria-setsize={isAdmin ? 3 : 2}>
<VersionString
role="listitem"
iconColor="#2BA51C"
linkRef={draftVersionStringRef}
linkHref={linkHref}
linkHref={`/test-review/${latestVersion.id}`}
>
{latestVersion.versionString}
</VersionString>
Expand Down Expand Up @@ -887,15 +877,13 @@ const DataManagementRow = ({
// Phase is "active"
insertActivePhaseForTestPlan(latestVersion);

// TODO: Remove this testFormatVersion check when #745 is implemented
const linkHref = getLinkHref(latestVersion);
return (
<PhaseCell role="list" aria-setsize={isAdmin ? 5 : 4}>
<VersionString
role="listitem"
iconColor="#2BA51C"
linkRef={candidateVersionStringRef}
linkHref={linkHref}
linkHref={`/test-review/${latestVersion.id}`}
>
{latestVersion.versionString}
</VersionString>
Expand Down Expand Up @@ -1009,15 +997,13 @@ const DataManagementRow = ({
// Phase is "active"
insertActivePhaseForTestPlan(latestVersion);

// TODO: Remove this testFormatVersion check when #745 is implemented
const linkHref = getLinkHref(latestVersion);
return (
<PhaseCell role="list">
<VersionString
role="listitem"
iconColor="#2BA51C"
linkRef={recommendedVersionStringRef}
linkHref={linkHref}
linkHref={`/test-review/${latestVersion.id}`}
>
{latestVersion.versionString}
</VersionString>
Expand Down
42 changes: 15 additions & 27 deletions client/components/TestPlanVersionsPage/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -409,13 +409,7 @@ const TestPlanVersionsPage = () => {
testPlanVersion
)}
autoWidth={false}
// TODO: Remove this testFormatVersion check when #745 is implemented
linkHref={
testPlanVersion.metadata
?.testFormatVersion === 2
? null
: `/test-review/${testPlanVersion.id}`
}
linkHref={`/test-review/${testPlanVersion.id}`}
>
{testPlanVersion.versionString}
</VersionString>
Expand Down Expand Up @@ -672,27 +666,21 @@ const TestPlanVersionsPage = () => {
: {testPlanVersion.gitMessage}
</a>
</li>
{/* TODO: Remove this testFormatVersion check when #745 is implemented */}
{testPlanVersion.metadata
.testFormatVersion === 2 ? null : (
<li>
<a
href={`/test-review/${testPlanVersion.id}`}
>
<FontAwesomeIcon
icon={
faArrowUpRightFromSquare
}
size="xs"
color="#818F98"
/>
View tests in{' '}
{
testPlanVersion.versionString
<li>
<a
href={`/test-review/${testPlanVersion.id}`}
>
<FontAwesomeIcon
icon={
faArrowUpRightFromSquare
}
</a>
</li>
)}
size="xs"
color="#818F98"
/>
View tests in{' '}
{testPlanVersion.versionString}
</a>
</li>
{!hasFinalReports ? null : (
<li>
<a
Expand Down
Loading

0 comments on commit 4053f67

Please sign in to comment.