Skip to content

Commit 6f42b96

Browse files
authored
Merge pull request openstf#768 from 0rzech/screen-reset-option
Screen reset option
2 parents 6fc5d2f + e8db600 commit 6f42b96

5 files changed

Lines changed: 26 additions & 2 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
.DS_Store
33
.eslintcache
44
.idea/
5+
*.iml
56
.python-version
67
/*.tgz
78
/.env

lib/cli/device/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ module.exports.builder = function(yargs) {
108108
, type: 'number'
109109
, demand: true
110110
})
111+
.option('screen-reset', {
112+
describe: 'Go back to home screen and reset screen rotation ' +
113+
'when user releases device. Negate with --no-screen-reset.'
114+
, type: 'boolean'
115+
, default: true
116+
})
111117
.option('screen-ws-url-pattern', {
112118
describe: 'The URL pattern to use for the screen WebSocket.'
113119
, type: 'string'
@@ -165,5 +171,6 @@ module.exports.handler = function(argv) {
165171
, muteMaster: argv.muteMaster
166172
, lockRotation: argv.lockRotation
167173
, cleanup: argv.cleanup
174+
, screenReset: argv.screenReset
168175
})
169176
}

lib/cli/local/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,12 @@ module.exports.builder = function(yargs) {
156156
, type: 'string'
157157
, default: 'localhost'
158158
})
159+
.option('screen-reset', {
160+
describe: 'Go back to home screen and reset screen rotation ' +
161+
'when user releases device. Negate with --no-screen-reset.'
162+
, type: 'boolean'
163+
, default: true
164+
})
159165
.option('serial', {
160166
describe: 'Only use devices with these serial numbers.'
161167
, type: 'array'
@@ -282,6 +288,7 @@ module.exports.handler = function(argv) {
282288
.concat(argv.allowRemote ? ['--allow-remote'] : [])
283289
.concat(argv.lockRotation ? ['--lock-rotation'] : [])
284290
.concat(!argv.cleanup ? ['--no-cleanup'] : [])
291+
.concat(!argv.screenReset ? ['--no-screen-reset'] : [])
285292
.concat(argv.serial))
286293

287294
// auth

lib/cli/provider/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,12 @@ module.exports.builder = function(yargs) {
122122
, type: 'number'
123123
, default: 30000
124124
})
125+
.option('screen-reset', {
126+
describe: 'Go back to home screen and reset screen rotation ' +
127+
'when user releases device. Negate with --no-screen-reset.'
128+
, type: 'boolean'
129+
, default: true
130+
})
125131
.option('screen-ws-url-pattern', {
126132
describe: 'The URL pattern to use for the screen WebSocket.'
127133
, type: 'string'
@@ -199,6 +205,7 @@ module.exports.handler = function(argv) {
199205
}, []))
200206
.concat(argv.lockRotation ? ['--lock-rotation'] : [])
201207
.concat(!argv.cleanup ? ['--no-cleanup'] : [])
208+
.concat(!argv.screenReset ? ['--no-screen-reset'] : [])
202209

203210
return fork(cli, args)
204211
}

lib/units/device/plugins/group.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,10 @@ module.exports = syrup.serial()
104104
})
105105

106106
plugin.on('leave', function() {
107-
service.pressKey('home')
108-
service.thawRotation()
107+
if (options.screenReset) {
108+
service.pressKey('home')
109+
service.thawRotation()
110+
}
109111
service.releaseWakeLock()
110112
})
111113

0 commit comments

Comments
 (0)