@@ -130,6 +130,8 @@ const TestRun = () => {
130130 const [ currentAtVersion , setCurrentAtVersion ] = useState ( '' ) ;
131131 const [ currentBrowserVersion , setCurrentBrowserVersion ] = useState ( '' ) ;
132132 const [ pageReady , setPageReady ] = useState ( false ) ;
133+ const [ selectedIssueType , setSelectedIssueType ] = useState ( 'test' ) ;
134+ const [ selectedCommandForIssue , setSelectedCommandForIssue ] = useState ( '' ) ;
133135
134136 const auth = evaluateAuth ( data && data . me ? data . me : { } ) ;
135137 let { id : userId , isSignedIn, isAdmin } = auth ;
@@ -374,7 +376,8 @@ const TestRun = () => {
374376 browserName : testPlanReport . browser . name ,
375377 atVersionName : currentAtVersion ?. name ,
376378 browserVersionName : currentBrowserVersion ?. name ,
377- conflictMarkdown : conflictMarkdownRef . current
379+ conflictMarkdown : conflictMarkdownRef . current ,
380+ commandString : selectedCommandForIssue
378381 } ) ;
379382 }
380383
@@ -885,6 +888,25 @@ const TestRun = () => {
885888 editAtBrowserDetailsButtonRef . current . focus ( ) ;
886889 } ;
887890
891+ const onIssueTypeChange = e => {
892+ const type = e . target . value ;
893+ if ( type === 'command' ) {
894+ const scenario = currentTest . scenarios [ 0 ] ;
895+ const commandText = scenario . commands
896+ . map ( command => command . text )
897+ . join ( ' then ' ) ;
898+ if ( ! selectedCommandForIssue ) setSelectedCommandForIssue ( commandText ) ;
899+ } else {
900+ setSelectedCommandForIssue ( '' ) ;
901+ }
902+ setSelectedIssueType ( type ) ;
903+ } ;
904+
905+ const onSelectedCommandForIssueChange = e => {
906+ const command = e . target . value ;
907+ setSelectedCommandForIssue ( command ) ;
908+ } ;
909+
888910 const renderTestContent = ( testPlanReport , currentTest , heading ) => {
889911 const { index } = currentTest ;
890912 const isComplete = currentTest . testResult
@@ -963,7 +985,60 @@ const TestRun = () => {
963985 < div role = "complementary" >
964986 < h2 id = "test-options-heading" > Test Options</ h2 >
965987 < ul className = "options-wrapper" aria-labelledby = "test-options-heading" >
966- < li >
988+ < li className = "raise-issue-container" >
989+ < span className = "title" > Raise an issue for ...</ span >
990+ < div className = "options type" onChange = { onIssueTypeChange } >
991+ < label >
992+ < input
993+ id = "testIssueType"
994+ name = "issueTypeOption"
995+ type = "radio"
996+ value = "test"
997+ defaultChecked
998+ />
999+ test
1000+ </ label >
1001+ < label >
1002+ < input
1003+ id = "commandIssueType"
1004+ name = "issueTypeOption"
1005+ type = "radio"
1006+ value = "command"
1007+ />
1008+ command
1009+ </ label >
1010+ </ div >
1011+ { selectedIssueType === 'command' && (
1012+ < >
1013+ < span className = "title" > Select command ...</ span >
1014+ < div
1015+ className = "options command"
1016+ onChange = { onSelectedCommandForIssueChange }
1017+ >
1018+ { currentTest . scenarios . map ( ( scenario , index ) => {
1019+ const commandKey = `${ scenario . id } -${ scenario . commands
1020+ . map ( command => command . id )
1021+ . join ( '_' ) } `;
1022+ const commandText = scenario . commands
1023+ . map ( command => command . text )
1024+ . join ( ' then ' ) ;
1025+
1026+ return (
1027+ < label key = { commandKey } >
1028+ < input
1029+ id = { commandKey }
1030+ name = "commandOption"
1031+ type = "radio"
1032+ value = { commandText }
1033+ defaultChecked = { index === 0 }
1034+ />
1035+ { commandText }
1036+ </ label >
1037+ ) ;
1038+ } ) }
1039+ </ div >
1040+ </ >
1041+ ) }
9671042 < OptionButton
9681043 text = "Raise an Issue"
9691044 icon = {
0 commit comments