From a1c178830acada5e94dc46ecd26804783249613d Mon Sep 17 00:00:00 2001 From: Brahim Hadriche Date: Mon, 17 Mar 2025 11:36:01 -0400 Subject: [PATCH] [skip ci] update device script --- package.json | 1 + tools/check-for-updates.js | 53 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 tools/check-for-updates.js diff --git a/package.json b/package.json index 4f619909..fa9a5fe3 100644 --- a/package.json +++ b/package.json @@ -71,6 +71,7 @@ "registry:read": "node tools/registry.js --output registry.json", "registry:clear": "node tools/registry.js --clear", "restart-app": "node tools/restart-app.js", + "check-for-updates": "node tools/check-for-updates.js", "shutdown": "node tools/shutdown.js" }, "optionalDependencies": { diff --git a/tools/check-for-updates.js b/tools/check-for-updates.js new file mode 100644 index 00000000..c9936af3 --- /dev/null +++ b/tools/check-for-updates.js @@ -0,0 +1,53 @@ +// Check for updates on 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: '' + }] + } + }); + + // Go to the home screen + await ecp.sendKeypress(Key.Home); + await utils.sleep(2000); + await ecp.sendKeypress(Key.Home); + await utils.sleep(2000); + + // Settings menu + await ecp.sendKeypress(Key.Up); + await utils.sleep(500); + await ecp.sendKeypress(Key.Right); + await utils.sleep(500); + + // System + await ecp.sendKeypress(Key.Up); + await utils.sleep(500); + await ecp.sendKeypress(Key.Right); + await utils.sleep(500); + + // Software update + await ecp.sendKeypress(Key.Up); + await utils.sleep(500); + await ecp.sendKeypress(Key.Up); + await utils.sleep(500); + await ecp.sendKeypress(Key.Up); + await utils.sleep(500); + await ecp.sendKeypress(Key.Right); + await utils.sleep(2000); + + // Check for updates + await ecp.sendKeypress(Key.Ok); + await utils.sleep(500); +})();