@@ -279,6 +279,42 @@ void nodeDrainsAfterSessionCountIsReached() throws URISyntaxException {
279
279
assertThat (localNode .isDraining ()).isTrue ();
280
280
}
281
281
282
+ @ Test
283
+ void seVncCdpUrlCapabilityWhenGridUrlWithSubPath () throws URISyntaxException {
284
+ Tracer tracer = DefaultTestTracer .createTracer ();
285
+ EventBus bus = new GuavaEventBus ();
286
+ String gridUrl = "http://localhost:7890/subPath" ;
287
+ URI uri = new URI (gridUrl );
288
+ Capabilities stereotype =
289
+ new ImmutableCapabilities (
290
+ "se:vncLocalAddress" , "ws://localhost:7900" ,
291
+ "se:cdp" , "ws://localhost:9222/devtools/browser/1a2b3c4d5e6f" );
292
+
293
+ LocalNode .Builder builder =
294
+ LocalNode .builder (tracer , bus , uri , uri , registrationSecret )
295
+ .enableCdp (true )
296
+ .add (
297
+ stereotype ,
298
+ new TestSessionFactory (
299
+ (id , caps ) -> new Session (id , uri , stereotype , caps , Instant .now ())));
300
+ LocalNode localNode = builder .build ();
301
+
302
+ Either <WebDriverException , CreateSessionResponse > response =
303
+ localNode .newSession (
304
+ new CreateSessionRequest (ImmutableSet .of (W3C ), stereotype , ImmutableMap .of ()));
305
+ assertThat (response .isRight ()).isTrue ();
306
+
307
+ CreateSessionResponse sessionResponse = response .right ();
308
+ Capabilities capabilities = sessionResponse .getSession ().getCapabilities ();
309
+ Object seVnc = capabilities .getCapability ("se:vnc" );
310
+ assertThat (seVnc ).isNotNull ();
311
+ assertThat (seVnc .toString ().contains (gridUrl .replace ("http" , "ws" ))).isTrue ();
312
+
313
+ Object seCdp = capabilities .getCapability ("se:cdp" );
314
+ assertThat (seCdp ).isNotNull ();
315
+ assertThat (seCdp .toString ().contains (gridUrl .replace ("http" , "ws" ))).isTrue ();
316
+ }
317
+
282
318
@ Test
283
319
void cdpIsDisabledAndResponseCapsShowThat () throws URISyntaxException {
284
320
Tracer tracer = DefaultTestTracer .createTracer ();
0 commit comments