roku-test-automation
Advanced tools
Comparing version 2.0.0-beta.17 to 2.0.0-beta.18
@@ -40,9 +40,11 @@ import type { ActiveAppResponse } from './types/ActiveAppResponse'; | ||
sendKeyPressSequence(keys: Key[], options?: SendKeyPressOptions): Promise<void>; | ||
sendLaunchChannel({ channelId, launchParameters, skipIfAlreadyRunning, verifyLaunch, verifyLaunchTimeOut }?: { | ||
sendLaunchChannel({ channelId, params, verifyLaunch, verifyLaunchTimeOut }?: { | ||
channelId?: string | undefined; | ||
launchParameters?: {} | undefined; | ||
skipIfAlreadyRunning?: boolean | undefined; | ||
params?: {} | undefined; | ||
verifyLaunch?: boolean | undefined; | ||
verifyLaunchTimeOut?: number | undefined; | ||
}): Promise<void>; | ||
sendInput({ params }?: { | ||
params?: {} | undefined; | ||
}): Promise<void>; | ||
getActiveApp(): Promise<ActiveAppResponse>; | ||
@@ -49,0 +51,0 @@ getChannelId(channelId?: string): string; |
@@ -70,3 +70,3 @@ "use strict"; | ||
} | ||
await this.device.sendECP(`keypress/${encodeURIComponent(key)}`, {}, ''); | ||
await this.device.sendEcpPost(`keypress/${encodeURIComponent(key)}`); | ||
const keyPressDelay = (_b = (_a = this.getConfig()) === null || _a === void 0 ? void 0 : _a.default) === null || _b === void 0 ? void 0 : _b.keyPressDelay; | ||
@@ -138,11 +138,7 @@ let wait = options === null || options === void 0 ? void 0 : options.wait; | ||
} | ||
async sendLaunchChannel({ channelId = '', launchParameters = {}, skipIfAlreadyRunning = false, verifyLaunch = true, verifyLaunchTimeOut = 3000 } = {}) { | ||
async sendLaunchChannel({ channelId = '', params = {}, verifyLaunch = true, verifyLaunchTimeOut = 3000 } = {}) { | ||
channelId = this.getChannelId(channelId); | ||
if (skipIfAlreadyRunning) { | ||
if (await this.isActiveApp(channelId)) { | ||
console.log('already running skipping launch'); | ||
return; | ||
} | ||
} | ||
await this.device.sendECP(`launch/${channelId}`, launchParameters, ''); | ||
// We always append a param as if none is passed and the application is already running it will not restart the application | ||
params['RTA_LAUNCH'] = 1; | ||
await this.device.sendEcpPost(`launch/${channelId}`, params); | ||
if (verifyLaunch) { | ||
@@ -162,5 +158,9 @@ const startTime = new Date(); | ||
} | ||
// Helper for sending a /input request to the device that can be handled via roInput | ||
async sendInput({ params = {} } = {}) { | ||
await this.device.sendEcpPost(`input`, params); | ||
} | ||
async getActiveApp() { | ||
var _a; | ||
const result = await this.device.sendECP(`query/active-app`); | ||
const result = await this.device.sendEcpGet(`query/active-app`); | ||
const children = (_a = result.body) === null || _a === void 0 ? void 0 : _a.children; | ||
@@ -193,3 +193,3 @@ if (!children) | ||
var _a; | ||
const result = await this.device.sendECP(`query/media-player`); | ||
const result = await this.device.sendEcpGet(`query/media-player`); | ||
const player = result.body; | ||
@@ -214,3 +214,3 @@ if (!player) | ||
async getChanperf() { | ||
const { body } = await this.device.sendECP(`query/chanperf`); | ||
const { body } = await this.device.sendEcpGet(`query/chanperf`); | ||
const response = this.simplifyEcpResponse(body); | ||
@@ -217,0 +217,0 @@ const plugin = response.plugin; |
@@ -52,4 +52,5 @@ /// <reference types="node" /> | ||
getFocusedNode(args?: ODC.GetFocusedNodeArgs, options?: ODC.RequestOptions): Promise<{ | ||
node: ODC.NodeRepresentation; | ||
node?: ODC.NodeRepresentation | undefined; | ||
ref?: number | undefined; | ||
keyPath?: string | undefined; | ||
}>; | ||
@@ -116,2 +117,3 @@ hasFocus(args: ODC.HasFocusArgs, options?: ODC.RequestOptions): Promise<boolean>; | ||
focusNode(args: ODC.FocusNodeArgs, options?: ODC.RequestOptions): Promise<ODC.ReturnTimeTaken>; | ||
removeNodeChildren(args: ODC.RemoveNodeChildrenArgs, options?: ODC.RequestOptions): Promise<ODC.ReturnTimeTaken>; | ||
readRegistry(args?: ODC.ReadRegistryArgs, options?: ODC.RequestOptions): Promise<{ | ||
@@ -118,0 +120,0 @@ values: { |
@@ -394,2 +394,8 @@ "use strict"; | ||
} | ||
async removeNodeChildren(args, options = {}) { | ||
this.conditionallyAddDefaultBase(args); | ||
this.conditionallyAddDefaultNodeReferenceKey(args); | ||
const result = await this.sendRequest(ODC.RequestType.removeNodeChildren, args, options); | ||
return result.json; | ||
} | ||
//#endregion | ||
@@ -396,0 +402,0 @@ //#region requests run on task thread |
@@ -19,3 +19,5 @@ /// <reference types="node" /> | ||
}, beforeZipCallback?: (info: rokuDeploy.BeforeZipCallbackInfo) => void): Promise<void>; | ||
sendECP(path: string, params?: object, body?: needle.BodyData): Promise<needle.NeedleResponse>; | ||
sendEcpPost(path: string, params?: {}, body?: needle.BodyData): Promise<needle.NeedleResponse>; | ||
sendEcpGet(path: string, params?: {}): Promise<needle.NeedleResponse>; | ||
private sendEcp; | ||
/** | ||
@@ -22,0 +24,0 @@ * @param outputFilePath - Where to output the generated screenshot. Extension is automatically appended based on what type of screenshotFormat you have specified for this device |
@@ -69,3 +69,9 @@ "use strict"; | ||
} | ||
sendECP(path, params, body) { | ||
sendEcpPost(path, params = {}, body = '') { | ||
return this.sendEcp(path, params, body); | ||
} | ||
sendEcpGet(path, params = {}) { | ||
return this.sendEcp(path, params); | ||
} | ||
sendEcp(path, params = {}, body) { | ||
let url = `http://${this.getCurrentDeviceConfig().host}:8060/${path}`; | ||
@@ -72,0 +78,0 @@ if (params && Object.keys(params).length) { |
@@ -30,2 +30,3 @@ /// <reference types="node" /> | ||
readRegistry = "readRegistry", | ||
removeNodeChildren = "removeNodeChildren", | ||
renameFile = "renameFile", | ||
@@ -154,2 +155,4 @@ setSettings = "setSettings", | ||
includeRef?: boolean; | ||
/** If you only need access to the `ref` or `keyPath` in the output then you can speed up the request by choosing not to include the node in the response. Defaults to true */ | ||
includeNode?: boolean; | ||
/** If true, will try to return the actual ArrayGrid itemComponent that is currently focused */ | ||
@@ -212,2 +215,8 @@ returnFocusedArrayGridChild?: boolean; | ||
} | ||
export interface RemoveNodeChildrenArgs extends BaseKeyPath { | ||
/** The first index of the node(s) that we want to remove */ | ||
index: number; | ||
/** The total count of nodes we want to remove. -1 for all */ | ||
count?: number; | ||
} | ||
export interface GetAllCountArgs { | ||
@@ -214,0 +223,0 @@ } |
@@ -30,2 +30,3 @@ "use strict"; | ||
RequestType["readRegistry"] = "readRegistry"; | ||
RequestType["removeNodeChildren"] = "removeNodeChildren"; | ||
RequestType["renameFile"] = "renameFile"; | ||
@@ -32,0 +33,0 @@ RequestType["setSettings"] = "setSettings"; |
@@ -203,2 +203,6 @@ { | ||
"properties": { | ||
"includeNode": { | ||
"description": "If you only need access to the `ref` or `keyPath` in the output then you can speed up the request by choosing not to include the node in the response. Defaults to true", | ||
"type": "boolean" | ||
}, | ||
"includeRef": { | ||
@@ -223,2 +227,3 @@ "description": "returns `ref` field in response that can be matched up with storeNodeReferences response for determining where we are in the node tree", | ||
"includeRef", | ||
"includeNode", | ||
"returnFocusedArrayGridChild", | ||
@@ -225,0 +230,0 @@ "responseMaxChildDepth", |
@@ -29,2 +29,3 @@ { | ||
"readRegistry", | ||
"removeNodeChildren", | ||
"renameFile", | ||
@@ -31,0 +32,0 @@ "setSettings", |
{ | ||
"name": "roku-test-automation", | ||
"version": "2.0.0-beta.17", | ||
"version": "2.0.0-beta.18", | ||
"description": "Helps with automating functional tests", | ||
@@ -5,0 +5,0 @@ "main": "client/dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
358842
4147