File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed
Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,8 @@ class DetoxWorker {
6363 this . system = null ;
6464 /** @type {Detox.PilotFacade } */
6565 this . pilot = null ;
66+ /** @type {Detox.PilotFacade } */
67+ this . copilot = null ;
6668
6769 this . _deviceCookie = null ;
6870
@@ -110,6 +112,13 @@ class DetoxWorker {
110112 }
111113 } ;
112114 this . pilot = new DetoxPilot ( ) ;
115+ Object . defineProperty ( this , 'copilot' , {
116+ get : ( ) => {
117+ console . warn ( 'Warning: "copilot" is deprecated. Please use "pilot" instead.' ) ;
118+ return this . pilot ;
119+ } ,
120+ configurable : true ,
121+ } ) ;
113122
114123 yield this . _client . connect ( ) ;
115124
@@ -169,10 +178,7 @@ class DetoxWorker {
169178 this . _injectedGlobalProperties = Object . keys ( injectedGlobals ) ;
170179 Object . assign ( DetoxWorker . global , injectedGlobals ) ;
171180 Object . defineProperty ( DetoxWorker . global , 'copilot' , {
172- get : ( ) => {
173- console . warn ( 'Warning: "copilot" is deprecated. Please use "pilot" instead.' ) ;
174- return this . pilot ;
175- } ,
181+ get : ( ) => this . copilot ,
176182 configurable : true ,
177183 } ) ;
178184 }
Original file line number Diff line number Diff line change 1+ import { copilot } from 'detox' ;
2+
13describe . forPilot ( 'Pilot Sanity' , ( ) => {
24 beforeEach ( async ( ) => {
35 await pilot . perform (
@@ -19,6 +21,10 @@ describe.forPilot('Pilot Sanity', () => {
1921 } ) ;
2022
2123 it ( 'should show world screen after tap with Copilot (deprecated API)' , async ( ) => {
24+ await global . copilot . autopilot ( 'tap on the Say World button in the sanity screen and expect to see "World!!!" text displayed' ) ;
25+ } ) ;
26+
27+ it ( 'should access copilot via destructuring' , async ( ) => {
2228 await copilot . autopilot ( 'tap on the Say World button in the sanity screen and expect to see "World!!!" text displayed' ) ;
2329 } ) ;
2430} ) ;
You can’t perform that action at this time.
0 commit comments