@@ -43,18 +43,13 @@ public class VisualRegressionTrackerTest {
43
43
44
44
private final static String BUILD_ID = "123123" ;
45
45
private final static String PROJECT_ID = "projectId" ;
46
+ private final static String CI_BUILD_ID = "123456789" ;
46
47
private final static String NAME = "Test name" ;
47
48
private final static String IMAGE_BASE_64 = "image" ;
48
49
49
50
private final Gson gson = new Gson ();
50
- private final VisualRegressionTrackerConfig config = new VisualRegressionTrackerConfig (
51
- "http://localhost" ,
52
- "733c148e-ef70-4e6d-9ae5-ab22263697cc" ,
53
- "XHGDZDFD3GMJDNM87JKEMP0JS1G5" ,
54
- "develop" ,
55
- false
56
- );
57
51
52
+ private VisualRegressionTrackerConfig config ;
58
53
private MockWebServer server ;
59
54
private VisualRegressionTracker vrt ;
60
55
private VisualRegressionTracker vrtMocked ;
@@ -66,7 +61,13 @@ public void setup() {
66
61
server .start ();
67
62
68
63
// target to mock server
69
- this .config .setApiUrl (server .url ("/" ).toString ());
64
+ config = new VisualRegressionTrackerConfig (
65
+ server .url ("/" ).toString (),
66
+ "733c148e-ef70-4e6d-9ae5-ab22263697cc" ,
67
+ "XHGDZDFD3GMJDNM87JKEMP0JS1G5" ,
68
+ "develop" ,
69
+ false ,
70
+ CI_BUILD_ID );
70
71
vrt = new VisualRegressionTracker (config );
71
72
vrtMocked = mock (VisualRegressionTracker .class );
72
73
vrtMocked .paths = new PathProvider ("baseApiUrl" );
@@ -84,10 +85,12 @@ public void shouldStartBuild() throws IOException, InterruptedException {
84
85
BuildRequest buildRequest = BuildRequest .builder ()
85
86
.branchName (this .config .getBranchName ())
86
87
.project (this .config .getProject ())
88
+ .ciBuildId (this .config .getCiBuildId ())
87
89
.build ();
88
90
BuildResponse buildResponse = BuildResponse .builder ()
89
91
.id (BUILD_ID )
90
92
.projectId (PROJECT_ID )
93
+ .ciBuildId (CI_BUILD_ID )
91
94
.build ();
92
95
server .enqueue (new MockResponse ()
93
96
.setResponseCode (200 )
@@ -209,7 +212,15 @@ public Object[][] trackErrorCases() {
209
212
expectedExceptions = TestRunException .class ,
210
213
expectedExceptionsMessageRegExp = "^(Difference found: https://someurl.com/test/123123|No baseline: https://someurl.com/test/123123)$" )
211
214
public void trackShouldThrowException (TestRunResponse testRunResponse , String expectedExceptionMessage ) throws IOException {
212
- vrtMocked .configuration = new VisualRegressionTrackerConfig ("" , "" , "" , "" , false );
215
+ vrtMocked .configuration = VisualRegressionTrackerConfig .builder ()
216
+ .apiUrl ("" )
217
+ .project ("" )
218
+ .apiKey ("" )
219
+ .branchName ("" )
220
+ .enableSoftAssert (false )
221
+ .ciBuildId ("" )
222
+ .build ();
223
+
213
224
when (vrtMocked .submitTestRun (anyString (), anyString (), any ())).thenReturn (testRunResponse );
214
225
215
226
doCallRealMethod ().when (vrtMocked ).track (anyString (), anyString (), any ());
@@ -224,7 +235,14 @@ public void trackShouldLogSevere(TestRunResponse testRunResponse, String expecte
224
235
listAppender .start ();
225
236
// add the appender to the logger
226
237
loggerMock .addAppender (listAppender );
227
- vrtMocked .configuration = new VisualRegressionTrackerConfig ("" , "" , "" , "" , true );
238
+ vrtMocked .configuration = VisualRegressionTrackerConfig .builder ()
239
+ .apiUrl ("" )
240
+ .project ("" )
241
+ .apiKey ("" )
242
+ .branchName ("" )
243
+ .enableSoftAssert (true )
244
+ .ciBuildId ("" )
245
+ .build ();
228
246
when (vrtMocked .submitTestRun (anyString (), anyString (), any ())).thenReturn (testRunResponse );
229
247
230
248
doCallRealMethod ().when (vrtMocked ).track (anyString (), anyString (), any ());
0 commit comments