diff --git a/README.md b/README.md index c914122..1d458f5 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,10 @@ Roku Test Automation (RTA from here on out) helps with automating functional tests for Roku devices. It has quite a bit more capabilities than [Roku's first party option](https://developer.roku.com/docs/developer-program/dev-tools/automated-channel-testing/automated-testing-overview.md) and does not require a Go server in the middle to convert ECP commands. +## Contributing & Getting Help + +There is always more things that we would like to add than we have time for. If you would like to help contribute the best spot to reach out is in the [Roku Developers Slack](https://join.slack.com/t/rokudevelopers/shared_invite/zt-4vw7rg6v-NH46oY7hTktpRIBM_zGvwA). (We're in the #rta channel). If you are having trouble getting RTA working feel free to reach out there as well. If you see an issue or would like to see something added then feel free to [create a new Github Issue](https://github.com/triwav/roku-test-automation/issues/new) + ## v2.0 Changes Some incompatibility changes were made in v2.0. These include: diff --git a/client/src/OnDeviceComponent.ts b/client/src/OnDeviceComponent.ts index 41e27b3..0b18e4c 100644 --- a/client/src/OnDeviceComponent.ts +++ b/client/src/OnDeviceComponent.ts @@ -240,12 +240,7 @@ export class OnDeviceComponent { args.convertResponseToJsonCompatible = false; - let result: ODC.RequestResponse; - if (args.field !== undefined) { - result = await this.sendRequest(ODC.RequestType.setValue, args, options); - } else { - result = await this.sendRequest(ODC.RequestType.setValue, this.breakOutFieldFromKeyPath(args), options); - } + const result = await this.sendRequest(ODC.RequestType.setValue, this.breakOutFieldFromKeyPath(args), options); return result.json as ODC.ReturnTimeTaken; } @@ -733,12 +728,17 @@ export class OnDeviceComponent { // In some cases it makes sense to break out the last key path part as `field` to simplify code on the device - private breakOutFieldFromKeyPath(args: ODC.CallFuncArgs | ODC.OnFieldChangeOnceArgs | ODC.SetValueArgs) { + private breakOutFieldFromKeyPath(args: ODC.OnFieldChangeOnceArgs | ODC.SetValueArgs) { if (!args.keyPath) { args.keyPath = ''; } - const keyPathParts = args.keyPath.split('.'); - return {...args, field: keyPathParts.pop(), keyPath: keyPathParts.join('.')}; + + if (args.field === undefined) { + const keyPathParts = args.keyPath.split('.'); + return {...args, field: keyPathParts.pop(), keyPath: keyPathParts.join('.')}; + } + + return args; } private setupClientSocket(options: ODC.RequestOptions) { diff --git a/client/src/types/OnDeviceComponent.ts b/client/src/types/OnDeviceComponent.ts index 0bde2b6..5ad8f0f 100644 --- a/client/src/types/OnDeviceComponent.ts +++ b/client/src/types/OnDeviceComponent.ts @@ -380,6 +380,9 @@ export interface OnFieldChangeOnceArgs extends BaseKeyPath { /** If the `keyPath` does not exist yet, this specifies how long to wait before erroring out in milliseconds */ retryTimeout?: number; + /** The field that we want to observe for changes on. If not supplied, the last part of `keyPath` will be */ + field?: string; + /** If provided will only return when this matches (including if it already equals that value) */ match?: MatchObject | ComparableValueTypes; }