@@ -9,27 +9,61 @@ export const useFailingAssertions = testPlanReport => {
99 return testPlanReport . finalizedTestResults . flatMap (
1010 ( testResult , testIndex ) => {
1111 return testResult . scenarioResults . flatMap ( scenarioResult => {
12- return (
13- scenarioResult . assertionResults
14- . filter ( assertionResult => ! assertionResult . passed )
15- // We only want to show MUST and SHOULD assertions
16- . filter (
17- assertionResult =>
18- assertionResult . assertion . priority !== 'MAY' &&
19- assertionResult . assertion . priority !== 'EXCLUDE'
20- )
21- . map ( assertionResult => ( {
22- testResultId : testResult . id ,
23- testIndex,
24- testTitle : testResult . test . title ,
25- scenarioCommands : scenarioResult . scenario . commands
26- . map ( cmd => cmd . text )
27- . join ( ', ' ) ,
28- assertionText : assertionResult . assertion . text ,
29- priority : assertionResult . assertion . priority ,
30- output : scenarioResult . output
31- } ) )
12+ const commonResult = {
13+ testResultId : testResult . id ,
14+ testIndex,
15+ testTitle : testResult . test . title ,
16+ scenarioCommands : scenarioResult . scenario . commands
17+ . map ( ( cmd , index ) => {
18+ if ( index === scenarioResult . scenario . commands . length - 1 ) {
19+ return cmd . text ;
20+ }
21+ // Prevent instances of duplicated setting in brackets.
22+ // eg. Down Arrow (virtual cursor active) then Down Arrow (virtual cursor active)
23+ //
24+ // Expectation is Down Arrow then Down Arrow (virtual cursor active), because the setting will always be
25+ // the same for the listed key combination.
26+ //
27+ // Some revision of how that key combination + setting is rendered may be useful
28+ return cmd . text . split ( ' (' ) [ 0 ] ;
29+ } )
30+ . join ( ' then ' )
31+ } ;
32+
33+ const assertionResults = scenarioResult . assertionResults
34+ . filter ( assertionResult => ! assertionResult . passed )
35+ // We only want to show MUST and SHOULD assertions
36+ . filter (
37+ assertionResult =>
38+ assertionResult . assertion . priority !== 'MAY' &&
39+ assertionResult . assertion . priority !== 'EXCLUDE'
40+ )
41+ . map ( assertionResult => ( {
42+ ...commonResult ,
43+ assertionText : assertionResult . assertion . text ,
44+ priority : assertionResult . assertion . priority ,
45+ output : scenarioResult . output
46+ } ) ) ;
47+
48+ const unexpectedResults = scenarioResult . unexpectedBehaviors . map (
49+ unexpectedBehavior => ( {
50+ ...commonResult ,
51+ assertionText :
52+ unexpectedBehavior . impact . toLowerCase ( ) === 'moderate'
53+ ? 'Other behaviors that create moderate negative impacts are not exhibited'
54+ : unexpectedBehavior . impact . toLowerCase ( ) === 'severe'
55+ ? 'Other behaviors that create severe negative impacts are not exhibited'
56+ : 'N/A' ,
57+ priority :
58+ unexpectedBehavior . impact . toLowerCase ( ) === 'moderate'
59+ ? 'SHOULD'
60+ : unexpectedBehavior . impact . toLowerCase ( ) === 'severe'
61+ ? 'MUST'
62+ : 'N/A' ,
63+ output : unexpectedBehavior . text
64+ } )
3265 ) ;
66+ return [ ...assertionResults , ...unexpectedResults ] ;
3367 } ) ;
3468 }
3569 ) ;
0 commit comments