From 6b62532b485c3436d205e0cebcdfabe67307a589 Mon Sep 17 00:00:00 2001 From: Brahim Hadriche Date: Wed, 22 Jan 2025 18:04:44 -0500 Subject: [PATCH] [skip ci] shutdown script --- package.json | 3 ++- tools/shutdown.js | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 tools/shutdown.js diff --git a/package.json b/package.json index 785b2bfd..01615e35 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,8 @@ "registry:write": "node tools/registry.js --input registry.json", "registry:read": "node tools/registry.js --output registry.json", "registry:clear": "node tools/registry.js --clear", - "restart-app": "node tools/restart-app.js" + "restart-app": "node tools/restart-app.js", + "shutdown": "node tools/shutdown.js" }, "optionalDependencies": { "@rollup/rollup-linux-x64-gnu": "^4.30.1" diff --git a/tools/shutdown.js b/tools/shutdown.js new file mode 100644 index 00000000..323d2805 --- /dev/null +++ b/tools/shutdown.js @@ -0,0 +1,22 @@ +// Shutdown a Roku device +const rokuTestAutomation = require('roku-test-automation'); +const ecp = rokuTestAutomation.ecp; +const utils = rokuTestAutomation.utils; +const Key = rokuTestAutomation.ECP.Key; + +const getEnvVars = require('./get-env-vars'); + +const config = getEnvVars(['ROKU_DEV_TARGET']); + +(async () => { + utils.setupEnvironmentFromConfig({ + RokuDevice: { + devices: [{ + host: config.ROKU_DEV_TARGET, + password: '' + }] + } + }); + + await ecp.sendKeypress(Key.PowerOff); +})();