Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
6bffcc1
TAG-0.10.0 tag creation for 0.10.0
anjalimukundan Dec 27, 2023
2da817f
TAG-0.10.0 fixed linting issues
anjalimukundan Dec 27, 2023
066b672
TAG-0.10.0 removed rpcEventHandler import
anjalimukundan Jan 2, 2024
b86f82e
Added FIRECERT-1744 changes
Abhishk123 Jan 3, 2024
373a8c2
Updated FireboltExampleInvoker.js
anjalimukundan Mar 1, 2024
54bff6f
Updated core version in package.json
anjalimukundan Mar 1, 2024
6a17c2d
Add support for all sdk versions with new handler added to make lifec…
SnehalP251 May 17, 2024
fc4ca71
Updated LifecycleMethodHandler.js
SnehalP251 May 21, 2024
87f7e11
updated LifecycleMethodHandler.js
SnehalP251 May 28, 2024
f1208d7
method update
SnehalP251 May 30, 2024
3bfced2
Merge pull request #109 from rdkcentral/FIRECERT-2103-Tag-0.10.0]
SnehalP251 May 31, 2024
db64d1a
FIRECERT-2152 - [FCA] Authentication.token to authentication.root for…
SnehalP251 Jun 13, 2024
504f374
Merge pull request #152 from rdkcentral/FIRECERT-2152-Tag-0.10.0
SnehalP251 Jun 14, 2024
cbaa673
2027 - Schema validation changes
PreethiMaai Jun 19, 2024
6809a34
Merge pull request #161 from rdkcentral/FIRECERT-2027-TAG-0.10.0
Abhishk123 Jun 28, 2024
8d18a38
Removed lzutf8 dependency
Abhishk123 Jul 29, 2024
c462cab
Merge pull request #181 from rdkcentral/fixedCompressionIssue-0.10.0
Eswar2103 Aug 21, 2024
1f3fe22
Porting errorSchema changes (#210)
PreethiMaai Sep 2, 2024
7dcb57e
feat: TAG-0.10.0 Sanity report logging (#218)
Abhishk123 Sep 10, 2024
686a83d
pub sub changes
PreethiMaai Nov 1, 2024
956ecd1
Accept SAT in urlParam or Intent for FCA 0.10.0
anjalimukundan Nov 7, 2024
ae66b15
Ported entos and extension SDK changes from dev
Eswar2103 Nov 8, 2024
216f991
Added minor changes
Eswar2103 Nov 12, 2024
0c3b245
reverted default_mac logic
anjalimukundan Nov 15, 2024
849f5ad
Update package.json
anjalimukundan Nov 15, 2024
d86850b
updated winston library
anjalimukundan Nov 19, 2024
4d7d4d7
Update package.json
anjalimukundan Nov 19, 2024
2ffbf08
Merge branch 'TAG-0.10.0' into entos-extension-sdk-0.10.0
anjalimukundan Nov 19, 2024
dff88f5
Merge pull request #244 from rdkcentral/entos-extension-sdk-0.10.0
anjalimukundan Nov 19, 2024
233b309
Reverted default mac code
Eswar2103 Nov 19, 2024
ff1e748
Resolved merge conflicts
Eswar2103 Nov 19, 2024
7234054
Catching region from URL params
Eswar2103 Nov 26, 2024
f3003c6
Merge pull request #241 from rdkcentral/sat-changes2-0.10.0
ibrahimshuail Nov 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 47 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,26 @@ It has the following features -

## Table of Contents

- [Brief overview](#brief-overview)
- [Setup](#setup)
- [FCA URL deployed and available in the S3](#fca-url-deployed-and-available-in-the-s3)
- [Below are the steps to run FCA in local system](#below-are-the-steps-to-run-fca-in-local-system)
- [Supported ways of Execution](#supported-ways-of-execution)
- [Supported targets](#supported-targets)
- [Supported Modes of execution](#supported-modes-of-execution)
- [Supported validations](#supported-validations)
- [Supported ways of retrieving reports](#supported-ways-of-retrieving-reports)
- [Supported Report Parameters](#supported-report-parameters)
- [PR and merge process](#pr-and-merge-process)
- [Supported URL parameters](#supported-url-parameters)
- [Supported PubSub Handlers](#supported-pubsub-handlers)
- [Plugins](#plugins)
- [Connect to mock Firebolt OS](#connect-to-mock-firebolt-os)
- [Timeout in UI prompt](#timeout-in-ui-prompt)

- [firebolt-certification-app](#firebolt-certification-app)
- [Brief overview](#brief-overview)
- [Table of Contents](#table-of-contents)
- [Setup](#setup)
- [FCA URL deployed and available in the S3](#fca-url-deployed-and-available-in-the-s3)
- [Below are the steps to run FCA in local system](#below-are-the-steps-to-run-fca-in-local-system)
- [Supported ways of Execution](#supported-ways-of-execution)
- [Supported targets](#supported-targets)
- [Supported Modes of execution](#supported-modes-of-execution)
- [Supported validations](#supported-validations)
- [Supported ways of retrieving reports](#supported-ways-of-retrieving-reports)
- [Supported Report Parameters](#supported-report-parameters)
- [PR and merge process](#pr-and-merge-process)
- [Supported URL parameters](#supported-url-parameters)
- [Supported Intent Parameters](#supported-intent-parameters)
- [Supported PubSub Handlers](#supported-pubsub-handlers)
- [Plugins](#plugins)
- [Connect to mock Firebolt OS](#connect-to-mock-firebolt-os)
- [Timeout in UI prompt](#timeout-in-ui-prompt)

## Setup

Use a recent version of node. At the time of writing, Node 14.15.x was LTS. An `.nvmrc` file is included for those using a node version manager. Everyone else, swim at your own risk.
Expand Down Expand Up @@ -112,7 +115,33 @@ Mode of execution implies the way in which an API is invoked. There are 2 modes
- If FCA systemui=true, FCA acts as the base app in case of ripple. The background color will be changed to purple and it will display one more button as "Launch FCA app" to launch FCA as third-party app on Ripple devices.
- TestContext: testContext=true
- If testContext=true, it will add the field context in mocha report generated

- AppId: appId=`<appId>`
- `appId` used to launch the app.
- Mac Address: macAddress=`<macAddress>`
- `macAddress` of the device running the tests.
- appType: appType=`<appType>`
- `appType` is the type of app being launched.
- Pub Sub Subscribe suffix : pubSubSubscribeSuffix=`<pubSubSubscribeSuffix>`
- `pubSubSubscribeSuffix` is the subscribe suffix value used for Pub Sub communication.
- Pub Sub Publish suffix : pubSubPublishSuffix=`<pubSubPublishSuffix>`
- `pubSubPublishSuffix` is the publish suffix value used for Pub Sub communication.

## Supported Intent Parameters
- appType:
- Classifier for the app - Launch the certification app for certification validations. Launching a firebolt app for app certification.
- appId:
- When `appId` is specified in the intent, it will be used to launch the app.
- macAddress:
- When `macAddress` is specified in the intent, it indicates the mac address of the device running the tests.
- PubSub Publish Suffix:
- When `pubSubPublishSuffix` is specified in the intent, it publishes to the topic.
- PubSub Subscribe Suffix:
- When `pubSubSubscribeSuffix` is specified in the intent, it subscribes to the topic.
- pubSubUrl:
- Sets the the url to use for a PubSub server.
- registerprovider:
- When `registerProvider = false`, then certification app will not register for userInterest provider.

## Supported PubSub Handlers

The code for handling different types of PubSub requests is located in `./src/pubsub/handlers`. Below are the supported handlers for various types of PubSub requests.
Expand Down
Binary file added docs/images/generateAPIValidaionResult.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/testRunnerFlow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Sanity Suite Flow chart

## Implementation
![Implementation Diagram](./images/testRunnerFlow.png)

## Generating Report Logs
![Manual Trigger Diagram](./images/generateAPIValidaionResult.png)
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"version": "1.0.0",
"version": "0.10.0",
"name": "firebolt-certification",
"description": "Reference App to demonstrate Firebolt APIs and Lifecycle",
"dependencies": {
"@apidevtools/json-schema-ref-parser": "^9.0.9",
"@firebolt-js/manage-sdk": "1.0.0",
"@firebolt-js/sdk": "1.0.0",
"@lightningjs/core": "*",
"@firebolt-js/manage-sdk": "0.1.0-next.1",
"@firebolt-js/sdk": "0.10.0",
"@lightningjs/core": "2.11.0",
"@lightningjs/sdk": "^5.0.1",
"@lightningjs/ui-components": "^2.2.2",
"dotenv": "^14.2.0",
Expand All @@ -16,11 +16,11 @@
"glob-parent": "^5.1.2",
"json-schema-ref-parser": "^9.0.9",
"jsonschema": "^1.4.0",
"lzutf8": "0.6.0",
"perf_hooks": "^0.0.1",
"rxjs": "7.2.0",
"uuid": "^9.0.0",
"winston": "^3.8.2",
"winston": "3.15.0",
"winston-transport": "4.7.1",
"xml2js": "^0.5.0"
},
"scripts": {
Expand Down
45 changes: 34 additions & 11 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,11 @@ import PinChallengeProviderDelegater from './providers/PinChallengeDelegater';
import KeyboardProviderDelegater from './providers/KeyboardProviderDelegater';
import AckChallengeProviderDelegater from './providers/AckChallengeDelegater';
const logger = require('./utils/Logger')('App.js');
import FireboltTransportInvoker from './FireboltTransportInvoker';
import { handleAsyncFunction } from './utils/Utils';
import { withAnnouncer } from '@lightningjs/ui-components';
const Base = withAnnouncer(lng.Application);
import Toast, { eventEmitter } from './Toast';
import IntentReader from './IntentReader';
import IntentReader from 'IntentReader';

export default class App extends Base {
static _template() {
Expand Down Expand Up @@ -100,18 +99,28 @@ export default class App extends Base {
const testContext = new URLSearchParams(window.location.search).get('testContext');
const reportingId = new URLSearchParams(appUrl.search).get('reportingId');
const standalone = new URLSearchParams(appUrl.search).get('standalone');
const standalonePrefix = new URLSearchParams(appUrl.search).get('standalonePrefix');
this.systemui = new URLSearchParams(window.location.search).get('systemui');
this.testToken = new URLSearchParams(window.location.search).get('testtoken');
this.pubSubUuidPresent = false;
this.appContinue = false;
process.env.LIFECYCLE_VALIDATION = lifecycle;
process.env.MOCKOS = false;
process.env.MF_VALUE = false;
testContext ? (process.env.TESTCONTEXT = JSON.parse(testContext)) : (process.env.TESTCONTEXT = false);
process.env.TESTCONTEXT = true; // Making TESTCONTEXT = true by default. This line will be removed in later stages when required
process.env.TEST_TOKEN = this.testToken;
process.env.REPORTINGID = reportingId;
process.env.STANDALONE = standalone;
process.env.STANDALONE_PREFIX = standalonePrefix;
process.env.ID = 0;
process.env.MACADDRESS = new URLSearchParams(appUrl.search).get('macaddress');
process.env.CURRENT_APPID = new URLSearchParams(appUrl.search).get('appId');
process.env.APP_TYPE = new URLSearchParams(appUrl.search).get('appType');
process.env.PUB_SUB_URL = new URLSearchParams(appUrl.search).get('pubSubUrl');
process.env.PUB_SUB_TOKEN = new URLSearchParams(appUrl.search).get('pubSubToken');
process.env.PUBSUB_SUBSCRIBE_TOPIC_SUFFIX = new URLSearchParams(appUrl.search).get('pubSubSubscribeSuffix');
process.env.PUBSUB_PUBLISH_TOPIC_SUFFIX = new URLSearchParams(appUrl.search).get('pubSubPublishSuffix');
process.env.SDKS_AVAILABLE = [...CONSTANTS.defaultSDKs, ...CONSTANTS.additionalSDKs];
process.env.REGION = new URLSearchParams(appUrl.search).get('region');
if (platform) {
process.env.PLATFORM = platform;
} else {
Expand Down Expand Up @@ -149,7 +158,6 @@ export default class App extends Base {
this.pubSubListener();
}
getCurrentAppID().then((res) => {
process.env.APPID = res;
this._setState('LoadingState');
});
}
Expand Down Expand Up @@ -377,6 +385,13 @@ export default class App extends Base {
if (lifecycle_validationString == true) {
process.env.LIFECYCLE_VALIDATION = 'true';
}
if (query.params.pubSubPublishSuffix) {
process.env.PUBSUB_PUBLISH_TOPIC_SUFFIX = query.params.pubSubPublishSuffix;
}

if (query.params.pubSubSubscribeSuffix) {
process.env.PUBSUB_SUBSCRIBE_TOPIC_SUFFIX = query.params.pubSubSubscribeSuffix;
}

process.env.APP_TYPE = query.params.appType ? query.params.appType.toLowerCase() : CONSTANTS.FIREBOLT_CONST;

Expand All @@ -393,18 +408,26 @@ export default class App extends Base {
console.log('Error getting App Id :: ', err);
}

if (query.params.testtoken) {
process.env.TEST_TOKEN = query.params.testtoken;
} else {
logger.error('No Test Token Found in Parameter Initialization response...', 'getParameterInitializationValues');
}

if (query.params.macaddress) {
process.env.MACADDRESS = query.params.macaddress;
} else {
logger.error('No Mac Address Found in Parameter Initialization response...', 'getParameterInitializationValues');
}
// Set the pubSub URL if present
if (query.params.pubSubUrl) {
process.env.PUB_SUB_URL = query.params.pubSubUrl;
}

// Set the pubSub token if present
if (query.params.pubSubToken) {
process.env.PUB_SUB_TOKEN = query.params.pubSubToken;
}

// Set the region if present
if (query.params.region) {
process.env.REGION = query.params.region;
}

if (query.task) {
setTimeout(() => {
const intentReader = new IntentReader();
Expand Down
110 changes: 71 additions & 39 deletions src/EventInvocation.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
// * Return results of all the events
// ************* End Description **********

import { dereferenceOpenRPC, errorSchemaCheck, rpcEventHandler } from './utils/Utils';
import { dereferenceOpenRPC, errorSchemaCheck } from './utils/Utils';
import { MODULE_MAP } from './FireboltExampleInvoker';
import { CONSTANTS } from './constant';
import Transport from '@firebolt-js/sdk/dist/lib/Transport/index.mjs';
Expand All @@ -39,7 +39,9 @@ class EventHandler {
this.moduleWithEventName = moduleWithEventName;
const event = moduleWithEventName.split('.')[1];
this.eventName = this.parseEventName(event);
this.eventSchema = this.getSchema(moduleWithEventName, schemaList);
if (process.env.STANDALONE == true) {
this.eventSchema = this.getSchema(moduleWithEventName, schemaList);
}
this.initializationTime = new Date();
this.eventListener = null;
}
Expand Down Expand Up @@ -69,14 +71,24 @@ class EventHandler {
}
// Handle, parse and store the resolved event data from listener
handleEvent(eventData) {
const eventSchemaResponse = this.eventSchemaValidation(eventData);
const eventDataObject = {
eventName: this.eventName,
eventListenerId: this.eventListener.eventListenerId,
eventResponse: eventData,
eventSchemaResult: eventSchemaResponse,
eventTime: new Date(),
};
let eventDataObject;
if (process.env.STANDALONE == true) {
const eventSchemaResponse = this.eventSchemaValidation(eventData);
eventDataObject = {
eventName: this.eventName,
eventListenerId: this.eventListener.eventListenerId,
eventResponse: eventData,
eventSchemaResult: eventSchemaResponse,
eventTime: new Date(),
};
} else {
eventDataObject = {
eventName: this.eventName,
eventListenerId: this.eventListener.id,
eventResponse: eventData,
eventTime: new Date(),
};
}
eventHistory.push(eventDataObject);
}
// Schema validation for resolved event data
Expand Down Expand Up @@ -107,53 +119,68 @@ class EventHandler {
export class EventInvocation {
// This method accepts the message params and return the listener response and schema response
async northBoundEventHandling(message) {
let responseCode;
const eventParams = message.params;
const moduleWithEventName = eventParams.event;
const params = eventParams.params;
const [listenerResponse, uniqueListenerKey] = await this.registerEvent(moduleWithEventName, params);

const registrationResponse = {};
registrationResponse['eventName'] = moduleWithEventName;
registrationResponse['eventListenerId'] = uniqueListenerKey;
if (listenerResponse && Number.isInteger(listenerResponse) && listenerResponse > 0) {
registrationResponse['eventListenerResponse'] = {
listenerResponse: listenerResponse,
error: null,
};
if (process.env.STANDALONE == true) {
registrationResponse['eventName'] = moduleWithEventName;
registrationResponse['eventListenerId'] = uniqueListenerKey;
if (listenerResponse && Number.isInteger(listenerResponse) && listenerResponse > 0) {
registrationResponse['eventListenerResponse'] = {
listenerResponse: listenerResponse,
error: null,
};
// Handling not supported api to check error schema if it gives a valid response
let schemaValidationResult = {};
let schemaValidationStatus = CONSTANTS.PASS;
if (message.params.isNotSupportedApi == true) {
schemaValidationResult = errorSchemaCheck(listenerResponse);
schemaValidationStatus = CONSTANTS.FAIL;
}
registrationResponse['eventListenerSchemaResult'] = {
status: schemaValidationStatus,
eventSchemaResult: schemaValidationResult,
};
eventHandlerMap.get(uniqueListenerKey).setEventListener(registrationResponse);
} else {
if (CONSTANTS.ERROR_LIST.includes(listenerResponse.message)) {
responseCode = CONSTANTS.STATUS_CODE[3];
registrationResponse['responseCode'] = responseCode;
}
registrationResponse['eventListenerResponse'] = { result: null, error: listenerResponse };
// In case of error, validate error against errorschema
const schemaValidationResult = errorSchemaCheck(listenerResponse);
if (schemaValidationResult && schemaValidationResult.errors && schemaValidationResult.errors.length > 0) {
registrationResponse['eventListenerSchemaResult'] = {
status: CONSTANTS.FAIL,
eventSchemaResult: {},
status: schemaValidationStatus,
eventSchemaResult: schemaValidationResult,
};
eventHandlerMap.get(uniqueListenerKey).setEventListener(registrationResponse);
} else {
registrationResponse['eventListenerSchemaResult'] = {
status: CONSTANTS.PASS,
eventSchemaResult: schemaValidationResult,
if (CONSTANTS.ERROR_LIST.includes(listenerResponse.message)) {
const responseCode = CONSTANTS.STATUS_CODE[3];
registrationResponse['responseCode'] = responseCode;
}
registrationResponse['eventListenerResponse'] = { result: null, error: listenerResponse };
// In case of error, validate error against errorschema
const schemaValidationResult = errorSchemaCheck(listenerResponse);
if (schemaValidationResult && schemaValidationResult.errors && schemaValidationResult.errors.length > 0) {
registrationResponse['eventListenerSchemaResult'] = {
status: CONSTANTS.FAIL,
eventSchemaResult: {},
};
} else {
registrationResponse['eventListenerSchemaResult'] = {
status: CONSTANTS.PASS,
eventSchemaResult: schemaValidationResult,
};
}
}
return registrationResponse;
} else {
registrationResponse['jsonrpc'] = '2.0';
registrationResponse['id'] = null;
if (listenerResponse && Number.isInteger(listenerResponse) && listenerResponse > 0) {
registrationResponse['id'] = listenerResponse;
registrationResponse['result'] = {
listening: true,
event: moduleWithEventName,
};
eventHandlerMap.get(uniqueListenerKey).setEventListener(registrationResponse);
} else {
registrationResponse['error'] = listenerResponse;
}
return registrationResponse;
}
return registrationResponse;
}

// This method will listen to event and capture the event response after triggering
Expand Down Expand Up @@ -298,8 +325,13 @@ export class EventInvocation {
// Return the event response object for the eventName passed as the param
getEventResponse(message) {
try {
let filteredEventDataObjectList;
const eventName = message.params.event;
const filteredEventDataObjectList = eventHistory.filter((element) => element.eventListenerId == eventName);
if (process.env.STANDALONE == true) {
filteredEventDataObjectList = eventHistory.filter((element) => element.eventListenerId == eventName);
} else {
filteredEventDataObjectList = eventHistory.filter((element) => element.eventListenerId.toString() == eventName.split('-').pop());
}
if (filteredEventDataObjectList.length) {
const eventDataObject = filteredEventDataObjectList[filteredEventDataObjectList.length - 1];
return eventDataObject;
Expand Down
Loading