From 684ff30cd7b49305606c8f0674bda632148f4468 Mon Sep 17 00:00:00 2001 From: Howard Edwards Date: Wed, 22 Jan 2025 10:45:00 -0500 Subject: [PATCH] Implement suggested single click 'Raise an Issue for command' link in TestRun --- client/components/TestRenderer/index.jsx | 17 +- client/components/TestRun/TestRun.css | 32 -- client/components/TestRun/index.jsx | 87 +-- client/tests/e2e/snapshots/saved/_run_2.html | 248 ++++++--- .../snapshots/saved/_test-plan-report_1.html | 516 +++++++++++------- 5 files changed, 510 insertions(+), 390 deletions(-) diff --git a/client/components/TestRenderer/index.jsx b/client/components/TestRenderer/index.jsx index c3a9b5eee..c83dcb409 100644 --- a/client/components/TestRenderer/index.jsx +++ b/client/components/TestRenderer/index.jsx @@ -27,6 +27,7 @@ import UnexpectedBehaviorsFieldset from './UnexpectedBehaviorsFieldset'; import supportJson from '../../resources/support.json'; import commandsJson from '../../resources/commands.json'; import { AtPropType, TestResultPropType } from '../common/proptypes/index.js'; +import createIssueLink from '@client/utils/createIssueLink'; const Container = styled.div` width: 100%; @@ -163,7 +164,8 @@ const TestRenderer = ({ isReviewingBot = false, isReadOnly = false, isEdit = false, - setIsRendererReady = false + setIsRendererReady = false, + issueContent }) => { const { scenarioResults, test = {}, completedAt } = testResult; const { renderableContent } = test; @@ -543,6 +545,13 @@ const TestRenderer = ({ unexpectedBehaviors, assertionsHeader } = value; + + const commandString = header.replace('After ', ''); + const issueLink = createIssueLink({ + ...issueContent, + commandString + }); + return ( {header} @@ -564,6 +573,9 @@ const TestRenderer = ({ isSubmitted={isSubmitted} readOnly={isReadOnly} /> + + Raise an issue for {commandString} + ); })} @@ -604,7 +616,8 @@ TestRenderer.propTypes = { isReadOnly: PropTypes.bool, isEdit: PropTypes.bool, isReviewingBot: PropTypes.bool, - setIsRendererReady: PropTypes.func + setIsRendererReady: PropTypes.func, + issueContent: PropTypes.object }; export default TestRenderer; diff --git a/client/components/TestRun/TestRun.css b/client/components/TestRun/TestRun.css index 8210e19e1..4731f8d00 100644 --- a/client/components/TestRun/TestRun.css +++ b/client/components/TestRun/TestRun.css @@ -523,35 +523,3 @@ a.btn-options:hover { .form-control.is-invalid { background-image: none; } - -.raise-issue-container { - display: flex; - flex-direction: column; - font-size: 0.75rem; -} - -.raise-issue-container .title { - align-self: flex-start; - font-weight: bold; -} - -.raise-issue-container input[type="radio"] { - margin-right: 0.25rem; - vertical-align: middle; -} - -.raise-issue-container .options { - display: flex; -} - -.raise-issue-container .options.type { - justify-content: space-between; - margin-bottom: 0.5rem; -} - -.raise-issue-container .options.command { - flex-direction: column; - align-items: flex-start; - text-align: left; - margin-bottom: 1rem; -} diff --git a/client/components/TestRun/index.jsx b/client/components/TestRun/index.jsx index 792ab05c2..3c9ae03ef 100644 --- a/client/components/TestRun/index.jsx +++ b/client/components/TestRun/index.jsx @@ -130,8 +130,6 @@ const TestRun = () => { const [currentAtVersion, setCurrentAtVersion] = useState(''); const [currentBrowserVersion, setCurrentBrowserVersion] = useState(''); const [pageReady, setPageReady] = useState(false); - const [selectedIssueType, setSelectedIssueType] = useState('test'); - const [selectedCommandForIssue, setSelectedCommandForIssue] = useState(''); const auth = evaluateAuth(data && data.me ? data.me : {}); let { id: userId, isSignedIn, isAdmin } = auth; @@ -361,10 +359,10 @@ const TestRun = () => { } adminReviewerCheckedRef.current = true; - let issueLink; + let issueLink, issueContent; const hasLoadingCompleted = Object.keys(currentTest).length; if (hasLoadingCompleted) { - issueLink = createIssueLink({ + issueContent = { testPlanTitle: testPlanVersion.title, testPlanDirectory: testPlanVersion.testPlan.directory, versionString: testPlanVersion.versionString, @@ -376,9 +374,9 @@ const TestRun = () => { browserName: testPlanReport.browser.name, atVersionName: currentAtVersion?.name, browserVersionName: currentBrowserVersion?.name, - conflictMarkdown: conflictMarkdownRef.current, - commandString: selectedCommandForIssue - }); + conflictMarkdown: conflictMarkdownRef.current + }; + issueLink = createIssueLink(issueContent); } const remapScenarioResults = ( @@ -888,25 +886,6 @@ const TestRun = () => { editAtBrowserDetailsButtonRef.current.focus(); }; - const onIssueTypeChange = e => { - const type = e.target.value; - if (type === 'command') { - const scenario = currentTest.scenarios[0]; - const commandText = scenario.commands - .map(command => command.text) - .join(' then '); - if (!selectedCommandForIssue) setSelectedCommandForIssue(commandText); - } else { - setSelectedCommandForIssue(''); - } - setSelectedIssueType(type); - }; - - const onSelectedCommandForIssueChange = e => { - const command = e.target.value; - setSelectedCommandForIssue(command); - }; - const renderTestContent = (testPlanReport, currentTest, heading) => { const { index } = currentTest; const isComplete = currentTest.testResult @@ -985,60 +964,7 @@ const TestRun = () => {

Test Options