File tree 2 files changed +16
-4
lines changed
2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,8 @@ class DetoxWorker {
63
63
this . system = null ;
64
64
/** @type {Detox.PilotFacade } */
65
65
this . pilot = null ;
66
+ /** @type {Detox.PilotFacade } */
67
+ this . copilot = null ;
66
68
67
69
this . _deviceCookie = null ;
68
70
@@ -110,6 +112,13 @@ class DetoxWorker {
110
112
}
111
113
} ;
112
114
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
+ } ) ;
113
122
114
123
yield this . _client . connect ( ) ;
115
124
@@ -169,10 +178,7 @@ class DetoxWorker {
169
178
this . _injectedGlobalProperties = Object . keys ( injectedGlobals ) ;
170
179
Object . assign ( DetoxWorker . global , injectedGlobals ) ;
171
180
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 ,
176
182
configurable : true ,
177
183
} ) ;
178
184
}
Original file line number Diff line number Diff line change
1
+ import { copilot } from 'detox' ;
2
+
1
3
describe . forPilot ( 'Pilot Sanity' , ( ) => {
2
4
beforeEach ( async ( ) => {
3
5
await pilot . perform (
@@ -19,6 +21,10 @@ describe.forPilot('Pilot Sanity', () => {
19
21
} ) ;
20
22
21
23
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 ( ) => {
22
28
await copilot . autopilot ( 'tap on the Say World button in the sanity screen and expect to see "World!!!" text displayed' ) ;
23
29
} ) ;
24
30
} ) ;
You can’t perform that action at this time.
0 commit comments