1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-05 10:39:25 +02:00

Add option to control screen resetting on device release

This commit is contained in:
Piotr Orzechowski 2018-03-07 11:11:27 +01:00
parent 4463fe139c
commit e8db600878
4 changed files with 25 additions and 2 deletions

View file

@ -108,6 +108,12 @@ module.exports.builder = function(yargs) {
, type: 'number' , type: 'number'
, demand: true , demand: true
}) })
.option('screen-reset', {
describe: 'Go back to home screen and reset screen rotation ' +
'when user releases device. Negate with --no-screen-reset.'
, type: 'boolean'
, default: true
})
.option('screen-ws-url-pattern', { .option('screen-ws-url-pattern', {
describe: 'The URL pattern to use for the screen WebSocket.' describe: 'The URL pattern to use for the screen WebSocket.'
, type: 'string' , type: 'string'
@ -165,5 +171,6 @@ module.exports.handler = function(argv) {
, muteMaster: argv.muteMaster , muteMaster: argv.muteMaster
, lockRotation: argv.lockRotation , lockRotation: argv.lockRotation
, cleanup: argv.cleanup , cleanup: argv.cleanup
, screenReset: argv.screenReset
}) })
} }

View file

@ -156,6 +156,12 @@ module.exports.builder = function(yargs) {
, type: 'string' , type: 'string'
, default: 'localhost' , default: 'localhost'
}) })
.option('screen-reset', {
describe: 'Go back to home screen and reset screen rotation ' +
'when user releases device. Negate with --no-screen-reset.'
, type: 'boolean'
, default: true
})
.option('serial', { .option('serial', {
describe: 'Only use devices with these serial numbers.' describe: 'Only use devices with these serial numbers.'
, type: 'array' , type: 'array'
@ -282,6 +288,7 @@ module.exports.handler = function(argv) {
.concat(argv.allowRemote ? ['--allow-remote'] : []) .concat(argv.allowRemote ? ['--allow-remote'] : [])
.concat(argv.lockRotation ? ['--lock-rotation'] : []) .concat(argv.lockRotation ? ['--lock-rotation'] : [])
.concat(!argv.cleanup ? ['--no-cleanup'] : []) .concat(!argv.cleanup ? ['--no-cleanup'] : [])
.concat(!argv.screenReset ? ['--no-screen-reset'] : [])
.concat(argv.serial)) .concat(argv.serial))
// auth // auth

View file

@ -122,6 +122,12 @@ module.exports.builder = function(yargs) {
, type: 'number' , type: 'number'
, default: 30000 , default: 30000
}) })
.option('screen-reset', {
describe: 'Go back to home screen and reset screen rotation ' +
'when user releases device. Negate with --no-screen-reset.'
, type: 'boolean'
, default: true
})
.option('screen-ws-url-pattern', { .option('screen-ws-url-pattern', {
describe: 'The URL pattern to use for the screen WebSocket.' describe: 'The URL pattern to use for the screen WebSocket.'
, type: 'string' , type: 'string'
@ -199,6 +205,7 @@ module.exports.handler = function(argv) {
}, [])) }, []))
.concat(argv.lockRotation ? ['--lock-rotation'] : []) .concat(argv.lockRotation ? ['--lock-rotation'] : [])
.concat(!argv.cleanup ? ['--no-cleanup'] : []) .concat(!argv.cleanup ? ['--no-cleanup'] : [])
.concat(!argv.screenReset ? ['--no-screen-reset'] : [])
return fork(cli, args) return fork(cli, args)
} }

View file

@ -104,8 +104,10 @@ module.exports = syrup.serial()
}) })
plugin.on('leave', function() { plugin.on('leave', function() {
if (options.screenReset) {
service.pressKey('home') service.pressKey('home')
service.thawRotation() service.thawRotation()
}
service.releaseWakeLock() service.releaseWakeLock()
}) })