@@ -12,7 +12,11 @@ import {
1212} from "@material-ui/core" ;
1313import { TestRun } from "../types" ;
1414import { createStyles , makeStyles , Theme } from "@material-ui/core/styles" ;
15- import { testsService } from "../services" ;
15+ import {
16+ testsService ,
17+ testRunService ,
18+ testVariationService ,
19+ } from "../services" ;
1620import DrawArea from "./DrawArea" ;
1721import { TestStatus } from "../types/testStatus" ;
1822import { useHistory , Prompt } from "react-router-dom" ;
@@ -42,11 +46,11 @@ const TestDetailsModal: React.FunctionComponent<{
4246 const [ selectedRectId , setSelectedRectId ] = React . useState < string > ( ) ;
4347
4448 const [ ignoreAreas , setIgnoreAreas ] = React . useState < IgnoreArea [ ] > (
45- JSON . parse ( testRun . testVariation . ignoreAreas )
49+ JSON . parse ( testRun . ignoreAreas )
4650 ) ;
4751
4852 React . useEffect ( ( ) => {
49- setIgnoreAreas ( JSON . parse ( testRun . testVariation . ignoreAreas ) ) ;
53+ setIgnoreAreas ( JSON . parse ( testRun . ignoreAreas ) ) ;
5054 } , [ testRun ] ) ;
5155
5256 const removeSelection = ( event : KonvaEventObject < MouseEvent > ) => {
@@ -72,7 +76,7 @@ const TestDetailsModal: React.FunctionComponent<{
7276 } ;
7377
7478 const isIgnoreAreasSaved = ( ) => {
75- return testRun . testVariation . ignoreAreas === JSON . stringify ( ignoreAreas ) ;
79+ return testRun . ignoreAreas === JSON . stringify ( ignoreAreas ) ;
7680 } ;
7781
7882 return (
@@ -85,7 +89,7 @@ const TestDetailsModal: React.FunctionComponent<{
8589 < Toolbar >
8690 < Grid container justify = "space-between" >
8791 < Grid item >
88- < Typography variant = "h6" > { testRun . testVariation . name } </ Typography >
92+ < Typography variant = "h6" > { testRun . name } </ Typography >
8993 </ Grid >
9094 { testRun . status === TestStatus . unresolved && (
9195 < Grid item >
@@ -135,30 +139,24 @@ const TestDetailsModal: React.FunctionComponent<{
135139 < Paper variant = "outlined" >
136140 < Grid container spacing = { 2 } >
137141 < Grid item >
138- < Typography > OS: { testRun . testVariation . os } </ Typography >
142+ < Typography > OS: { testRun . os } </ Typography >
139143 </ Grid >
140144 < Grid item >
141- < Typography >
142- Browser: { testRun . testVariation . browser }
143- </ Typography >
145+ < Typography > Browser: { testRun . browser } </ Typography >
144146 </ Grid >
145147 < Grid item >
146- < Typography >
147- Viewport: { testRun . testVariation . viewport }
148- </ Typography >
148+ < Typography > Viewport: { testRun . viewport } </ Typography >
149149 </ Grid >
150150 < Grid item >
151- < Typography >
152- Diff: { testRun . diffPercent } %
153- </ Typography >
151+ < Typography > Diff: { testRun . diffPercent } %</ Typography >
154152 </ Grid >
155153 < Grid item >
156154 < Typography >
157155 Diff tollerance: { testRun . diffTollerancePercent } %
158156 </ Typography >
159157 </ Grid >
160158 < Grid item >
161- < Typography display = ' inline' > Status: </ Typography >
159+ < Typography display = " inline" > Status: </ Typography >
162160 < TestStatusChip status = { testRun . status } />
163161 </ Grid >
164162 </ Grid >
@@ -202,14 +200,16 @@ const TestDetailsModal: React.FunctionComponent<{
202200 < IconButton
203201 disabled = { isIgnoreAreasSaved ( ) }
204202 onClick = { ( ) => {
205- testsService
206- . setIgnoreAreas ( testRun . testVariation . id , ignoreAreas )
207- . then ( ( testVariation ) =>
208- updateTestRun ( {
209- ...testRun ,
210- testVariation,
211- } )
212- ) ;
203+ // update in test run
204+ testRunService
205+ . setIgnoreAreas ( testRun . id , ignoreAreas )
206+ . then ( ( testRun ) => updateTestRun ( testRun ) ) ;
207+
208+ // update in variation
209+ testVariationService . setIgnoreAreas (
210+ testRun . testVariationId ,
211+ ignoreAreas
212+ ) ;
213213 } }
214214 >
215215 < Save />
@@ -225,7 +225,7 @@ const TestDetailsModal: React.FunctionComponent<{
225225 < DrawArea
226226 width = { stageWidth }
227227 height = { stageHeigth }
228- imageUrl = { testRun . testVariation . baselineName }
228+ imageUrl = { testRun . baselineName }
229229 ignoreAreas = { [ ] }
230230 setIgnoreAreas = { setIgnoreAreas }
231231 selectedRectId = { selectedRectId }
0 commit comments