@@ -435,9 +435,14 @@ describe("device targeting across hosts", () => {
435435 run ( [ ] , ( { opened, call } ) =>
436436 Effect . gen ( function * ( ) {
437437 const result = yield * call ( "device_open" , { deviceId : "MAC-UDID" } ) ;
438+ const byLabel = yield * call ( "device_open" , { platform : "ios" , hostId : "MAC MINI" } ) ;
439+ expect ( byLabel . isError ) . toBe ( false ) ;
438440 expect ( text ( result ) ) . not . toContain ( "No device" ) ;
439441 expect ( result . isError ) . toBe ( false ) ;
440- expect ( opened ) . toEqual ( [ { hostId : "mac-mini" , deviceId : "MAC-UDID" } ] ) ;
442+ expect ( opened ) . toEqual ( [
443+ { hostId : "mac-mini" , deviceId : "MAC-UDID" } ,
444+ { hostId : "mac-mini" , deviceId : "MAC-UDID" } ,
445+ ] ) ;
441446 } ) ,
442447 ) ,
443448 ) ;
@@ -531,7 +536,7 @@ describe("device targeting across hosts", () => {
531536 "No device Pixel_9 on 'Mac Mini' (hostId mac-mini). Call device_list for current ids." ,
532537 ) ;
533538 expect ( yield * missing ( { hostId : "unknown-host" } ) ) . toBe (
534- "No device Pixel_9 on hostId unknown-host. Call device_list for current ids ." ,
539+ "No device host unknown-host. Known hosts: This machine (local), Mac Mini (mac-mini) ." ,
535540 ) ;
536541 expect ( opened ) . toEqual ( [ ] ) ;
537542 } ) ,
@@ -544,6 +549,9 @@ describe("device targeting across hosts", () => {
544549 const result = yield * call ( "device_screenshot" , { deviceId : "MAC-UDID" } ) ;
545550 expect ( result . isError ) . toBe ( false ) ;
546551 expect ( result . structuredContent ) . toMatchObject ( { device : { hostId : "mac-mini" } } ) ;
552+ const byLabel = yield * call ( "device_screenshot" , { hostId : "MAC MINI" } ) ;
553+ expect ( byLabel . isError ) . toBe ( false ) ;
554+ expect ( byLabel . structuredContent ) . toMatchObject ( { device : { hostId : "mac-mini" } } ) ;
547555 } ) ,
548556 ) ,
549557 ) ;
@@ -614,9 +622,14 @@ describe("device targeting across hosts", () => {
614622 Effect . gen ( function * ( ) {
615623 expect ( ( yield * call ( "device_close" , { deviceId : "MAC-UDID" } ) ) . isError ) . toBe ( false ) ;
616624 expect ( ( yield * call ( "device_close" , { deviceId : "Pixel_9" } ) ) . isError ) . toBe ( false ) ;
625+ expect ( ( yield * call ( "device_close" , { hostId : "MAC MINI" } ) ) . isError ) . toBe ( false ) ;
626+ const unknown = yield * call ( "device_close" , { hostId : "unknown-host" } ) ;
627+ expect ( unknown . isError ) . toBe ( true ) ;
628+ expect ( text ( unknown ) ) . toContain ( "No device host unknown-host." ) ;
617629 expect ( closed ) . toEqual ( [
618630 { hostId : "mac-mini" , deviceId : "MAC-UDID" } ,
619631 { hostId : undefined , deviceId : "Pixel_9" } ,
632+ { hostId : "mac-mini" , deviceId : undefined } ,
620633 ] ) ;
621634 } ) ,
622635 ) ,
0 commit comments