Skip to content

Commit

Permalink
Use testPlanVersion.metadata.testFormatVersion
Browse files Browse the repository at this point in the history
  • Loading branch information
howard-e committed Nov 21, 2023
1 parent c0ba18e commit cd1cdc9
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ const NumberedList = styled.ol`
}
`;

const InstructionsRenderer = ({ testResult, testPageUrl, at }) => {
const InstructionsRenderer = ({
testResult,
testPageUrl,
at,
testFormatVersion = 1
}) => {
const { test = {} } = testResult;
const { renderableContent } = test;
const [testRunExport, setTestRunExport] = useState();
Expand Down Expand Up @@ -122,9 +127,7 @@ const InstructionsRenderer = ({ testResult, testPageUrl, at }) => {
}, [testRunExport]);

let allInstructions;
const isV2 =
!!renderableContent.target.at?.raw
?.defaultConfigurationInstructionsHTML;
const isV2 = testFormatVersion === 2;

if (isV2) {
const commandSettingSpecified = renderableContent.commands.some(
Expand Down Expand Up @@ -185,7 +188,8 @@ InstructionsRenderer.propTypes = {
testPageUrl: PropTypes.string,
at: PropTypes.shape({
name: PropTypes.string.isRequired
})
}),
testFormatVersion: PropTypes.number
};

export default InstructionsRenderer;
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,9 @@ const CandidateTestPlanRun = () => {
completedAt: new Date()
}}
testPageUrl={testPlanReport.testPlanVersion.testPageUrl}
testFormatVersion={
testPlanVersion.metadata.testFormatVersion
}
/>,
...testPlanReports.map(testPlanReport => {
const testResult =
Expand Down
6 changes: 3 additions & 3 deletions client/components/TestRenderer/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ const TestRenderer = ({
at,
testResult = {},
testPageUrl,
testFormatVersion = 1,
testRunStateRef,
recentTestRunStateRef,
testRunResultRef,
Expand Down Expand Up @@ -481,9 +482,7 @@ const TestRenderer = ({

const InstructionsContent = ({ labelIdRef }) => {
let allInstructions;
const isV2 =
!!renderableContent.target.at?.raw
?.defaultConfigurationInstructionsHTML;
const isV2 = testFormatVersion === 2;
let settingsContent = [];

if (isV2) {
Expand Down Expand Up @@ -1080,6 +1079,7 @@ TestRenderer.propTypes = {
testResult: PropTypes.object,
support: PropTypes.object,
testPageUrl: PropTypes.string,
testFormatVersion: PropTypes.number,
testRunStateRef: PropTypes.any,
recentTestRunStateRef: PropTypes.any,
testRunResultRef: PropTypes.any,
Expand Down
4 changes: 4 additions & 0 deletions client/components/TestRun/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1011,6 +1011,10 @@ const TestRun = () => {
)
}
testPageUrl={testPlanVersion.testPageUrl}
testFormatVersion={
testPlanVersion.metadata
.testFormatVersion
}
testRunStateRef={testRunStateRef}
recentTestRunStateRef={
recentTestRunStateRef
Expand Down
8 changes: 8 additions & 0 deletions client/components/TestRun/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ export const TEST_RUN_PAGE_QUERY = gql`
testPlan {
directory
}
metadata
}
runnableTests {
id
Expand Down Expand Up @@ -252,6 +253,7 @@ export const TEST_RUN_PAGE_ANON_QUERY = gql`
testPlan {
directory
}
metadata
}
runnableTests {
id
Expand Down Expand Up @@ -441,6 +443,7 @@ export const FIND_OR_CREATE_TEST_RESULT_MUTATION = gql`
testPlan {
directory
}
metadata
}
runnableTests {
id
Expand Down Expand Up @@ -536,6 +539,7 @@ export const FIND_OR_CREATE_TEST_RESULT_MUTATION = gql`
testPlan {
directory
}
metadata
}
runnableTests {
id
Expand Down Expand Up @@ -729,6 +733,7 @@ export const SAVE_TEST_RESULT_MUTATION = gql`
testPlan {
directory
}
metadata
}
runnableTests {
id
Expand Down Expand Up @@ -824,6 +829,7 @@ export const SAVE_TEST_RESULT_MUTATION = gql`
testPlan {
directory
}
metadata
}
runnableTests {
id
Expand Down Expand Up @@ -1017,6 +1023,7 @@ export const SUBMIT_TEST_RESULT_MUTATION = gql`
testPlan {
directory
}
metadata
}
runnableTests {
id
Expand Down Expand Up @@ -1112,6 +1119,7 @@ export const SUBMIT_TEST_RESULT_MUTATION = gql`
testPlan {
directory
}
metadata
}
runnableTests {
id
Expand Down

0 comments on commit cd1cdc9

Please sign in to comment.