Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev to Main Merge 11/26 #258

Merged
merged 28 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
2570746
sanity ui changes
Nandana-NNR Oct 15, 2024
c3bdf30
sat change
Nandana-NNR Oct 23, 2024
a13eadd
formatting change
Nandana-NNR Oct 24, 2024
d0c1396
added debug logs
Nandana-NNR Oct 25, 2024
0d5b41f
navigate to changes
Nandana-NNR Oct 28, 2024
efa81ba
Streamline dependencies on pubsub (#230)
anjalimukundan Oct 28, 2024
8ba7d58
resolve conflicts
Nandana-NNR Oct 28, 2024
3d7c680
Update clearEventHandler.js
Abhishk123 Oct 28, 2024
c9c5692
Update clearEventHandler.js
Abhishk123 Oct 29, 2024
5f7d391
comment out testtoken
Nandana-NNR Oct 29, 2024
ce5c236
addressed comment
Nandana-NNR Oct 29, 2024
9e0af70
update logs
Nandana-NNR Oct 29, 2024
a935680
addressed comment
Nandana-NNR Oct 30, 2024
30bc15e
dummy commit
Nandana-NNR Oct 30, 2024
8bae4f6
Merge branch 'dev' into player-latest
Nandana-NNR Oct 30, 2024
7c8cab5
merge dev
Nandana-NNR Oct 30, 2024
95e5c6d
Merge pull request #236 from rdkcentral/fixClearEventListener
ibrahimshuail Nov 5, 2024
f0dc327
Catch region from intent
Eswar2103 Nov 12, 2024
52b8911
Merge branch 'dev' into RevertDefaultMac
anjalimukundan Nov 15, 2024
4dd7c53
reverted default_mac logic
anjalimukundan Nov 15, 2024
a883fe2
removed default_appId logic
anjalimukundan Nov 15, 2024
bcaf588
Merge pull request #247 from rdkcentral/RevertDefaultMac
ibrahimshuail Nov 19, 2024
7322a5e
Merge branch 'dev' into sat-changes
Eswar2103 Nov 19, 2024
e664755
Removed console logs
Eswar2103 Nov 19, 2024
9f53395
Removed console logs
Eswar2103 Nov 20, 2024
5503ab6
Catching region from url params
Eswar2103 Nov 25, 2024
a0b3f2d
Merge pull request #231 from rdkcentral/player-latest
neeradanelxsi Nov 26, 2024
6eabb31
Merge pull request #235 from rdkcentral/sat-changes
Eswar2103 Nov 26, 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
64 changes: 46 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,25 @@ 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)
- [Sanity Suite Flow](./docs/index.md)
- [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

Expand Down Expand Up @@ -113,6 +115,32 @@ 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

Expand Down Expand Up @@ -152,4 +180,4 @@ To activate Mock Firebolt, there are specific start-up scripts that exist inside

For pinChallenge and acknowledgeChallenge UI prompts , a timeout of 15s is added so that, if no action is taken when the prompts displays on the screen (i.e; neither yes/no/back button ), the prompts will be automatically dismissed with "null" value as the response.
The prompt is displayed when the user needs to grant/deny a particular api, or the user has to enter a pin in-case of pinChallenge.
If user wants to grant an api, yes button is pressed, for deniel - no button, and incase if the user wants to dismiss the prompt without any action, back button is pressed.
If user wants to grant an api, yes button is pressed, for deniel - no button, and incase if the user wants to dismiss the prompt without any action, back button is pressed.
33 changes: 22 additions & 11 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,13 @@ export default class App extends Base {
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;
Expand All @@ -120,7 +118,14 @@ export default class App extends Base {
process.env.SDKS_AVAILABLE = [...CONSTANTS.defaultSDKs, ...CONSTANTS.additionalSDKs];

// Set the pubSub URL if present
process.env.PUB_SUB_URL = new URLSearchParams(window.location.search).get('pubSubUrl');
process.env.PUB_SUB_URL = new URLSearchParams(appUrl.search).get('pubSubUrl');
process.env.PUB_SUB_TOKEN = new URLSearchParams(appUrl.search).get('pubSubToken');
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.PUBSUB_SUBSCRIBE_TOPIC_SUFFIX = new URLSearchParams(appUrl.search).get('pubSubSubscribeSuffix');
process.env.PUBSUB_PUBLISH_TOPIC_SUFFIX = new URLSearchParams(appUrl.search).get('pubSubPublishSuffix');
process.env.REGION = new URLSearchParams(appUrl.search).get('region');

if (platform) {
process.env.PLATFORM = platform;
Expand Down Expand Up @@ -159,7 +164,6 @@ export default class App extends Base {
this.pubSubListener();
}
getCurrentAppID().then((res) => {
process.env.APPID = res;
this._setState('LoadingState');
});
}
Expand Down Expand Up @@ -391,7 +395,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;

try {
Expand All @@ -407,12 +417,6 @@ 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 {
Expand All @@ -427,7 +431,14 @@ export default class App extends Base {
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
19 changes: 17 additions & 2 deletions src/FireboltTransportInvoker.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@
*/

import Transport from '@firebolt-js/sdk/dist/lib/Transport';
import { CONSTANTS } from './constant';

let invokeManager, invokeProvider;
try {
invokeManager = require('../plugins/FireboltExtensionInvoker').default.invokeManager;
invokeProvider = require('../plugins/FireboltExtensionInvoker').default.invokeProvider;
} catch (err) {
logger.error(`Unable to import additional invoker - ${err.message}`);
}

let instance = null;

Expand All @@ -32,7 +41,7 @@ export default class FireboltTransportInvoker {
return instance;
}

async invoke(methodName, params, paramNamesArray) {
async invoke(methodName, params, paramNamesArray, invoker = null) {
const module = methodName.split('.')[0];
const method = methodName.split('.')[1];
if (paramNamesArray) {
Expand All @@ -42,7 +51,13 @@ export default class FireboltTransportInvoker {
// For each param, construct json using param name and value
jsonParams[paramNamesArray[i]] = params[i];
}
return await Transport.send(module, method, jsonParams);
if (invoker == CONSTANTS.INVOKEPROVIDER) {
return await invokeProvider.send(module, method, jsonParams);
} else if (invoker == CONSTANTS.INVOKEMANAGER) {
return await invokeManager.send(module, method, jsonParams);
} else {
return await Transport.send(module, method, jsonParams);
}
} else {
throw Error('Could not find params for ' + methodName);
}
Expand Down
4 changes: 2 additions & 2 deletions src/LifeCycleHistory.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@ export default class LifecycleHistory {
const query = JSON.parse(event.data.query);

// Establishing a pubSub connection if FCA receives an intent in the navigateTo event with the following parameters.
if (query.params && query.params.appId && query.params.testtoken && query.params.macaddress) {
if (query.params && query.params.appId && query.params.macaddress) {
// PUBSUB_CONNECTION environment variable has a pubsub client instance and calls the isConnected function to check the Websocket status.
if (!process.env.PUBSUB_CONNECTION || (process.env.PUBSUB_CONNECTION && !process.env.PUBSUB_CONNECTION.isConnected())) {
process.env.APP_TYPE = query.params.appType ? query.params.appType.toLowerCase() : CONSTANTS.FIREBOLT_CONST;
process.env.CURRENT_APPID = query.params.appId;
process.env.MACADDRESS = query.params.macaddress;
process.env.TEST_TOKEN = query.params.testtoken;
process.env.PUB_SUB_TOKEN = query.params.pubSubToken;
const pubSubListenerCreation = new PubSubCommunication();
const webSocketConnection = await pubSubListenerCreation.startWebSocket();
}
Expand Down
2 changes: 1 addition & 1 deletion src/MenuBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export default class MenuBuilder {
function (sdkObject) {
const sdkObjectCopy = { ...sdkObject };
// dynamically construct menu items using additionalSDKs config
const menuObject = this.createSubMenuObject(sdkObjectCopy.name, ValidationView, sdkObjectCopy.name, CONSTANTS.SDK);
const menuObject = this.createSubMenuObject(sdkObjectCopy.name, ValidationView, sdkObjectCopy.name, CONSTANTS.TRANSPORT);
transportMenuArray.push(menuObject);
}.bind(this)
);
Expand Down
5 changes: 4 additions & 1 deletion src/MethodFilters.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ export default class MethodFilters {

isRpcMethod(method, invokedSdk, communicationMode = 'sdk') {
let isRpc = false;
if ((invokedSdk == CONSTANTS.CORE.toLowerCase() || invokedSdk == CONSTANTS.MANAGE.toLowerCase()) && communicationMode == CONSTANTS.TRANSPORT) {

const mergedSDKs = CONSTANTS.defaultSDKs.concat(CONSTANTS.additionalSDKs);
const sdkNames = mergedSDKs.map((sdkObjectCopy) => sdkObjectCopy.name.toLowerCase());
if (sdkNames.includes(invokedSdk.toLowerCase()) && communicationMode == CONSTANTS.TRANSPORT) {
return isRpc;
} else if (invokedSdk == CONSTANTS.MANAGE.toLowerCase() && method.name.split('.')[1].startsWith('set')) {
return isRpc;
Expand Down
2 changes: 2 additions & 0 deletions src/constant.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ export const CONSTANTS = {
EXCLUDED_METHODS_FOR_SDK: [],
EXCLUDED_METHODS_FOR_TRANSPORT: [],
REGISTERPROVIDER: 'registerprovider',
INVOKEPROVIDER: 'invokeProvider',
INVOKEMANAGER: 'invokeManager',
defaultSDKs: [
{
name: 'Core',
Expand Down
4 changes: 2 additions & 2 deletions src/pubSubClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ class PubSubClient {
constructor() {
this.ws = null;
this.url = process.env.PUB_SUB_URL ? process.env.PUB_SUB_URL : 'ws://localhost:8080';
this.PUBSUB_SUBSCRIBE_TOPIC_SUFFIX = '_FCS';
this.PUBSUB_PUBLISH_TOPIC_SUFFIX = '_FCA';
this.PUBSUB_SUBSCRIBE_TOPIC_SUFFIX = process.env.PUBSUB_SUBSCRIBE_TOPIC_SUFFIX ? process.env.PUBSUB_SUBSCRIBE_TOPIC_SUFFIX : '_FCS';
this.PUBSUB_PUBLISH_TOPIC_SUFFIX = process.env.PUBSUB_PUBLISH_TOPIC_SUFFIX ? process.env.PUBSUB_PUBLISH_TOPIC_SUFFIX : '_FCA';
}

// Initializes a WS connection
Expand Down
8 changes: 8 additions & 0 deletions src/pubsub/handlers/clearEventHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ export default class clearEventHandler extends BaseHandler {

async handle(message) {
const eventInvokerInfo = new EventInvocation();
let sdkType;
if (message.params && message.params.event && message.params.event.includes('_')) {
sdkType = message.params.event.split('_')[0].toLowerCase();
}
if (message.action != null && message.action != 'NA') {
sdkType = message.action;
process.env.SDK_TYPE = sdkType;
}
try {
const validationReport = eventInvokerInfo.clearEventListeners(message.params.event);
return JSON.stringify({ report: validationReport });
Expand Down
4 changes: 2 additions & 2 deletions src/utils/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ function removeSetInMethodName(apiName) {
* @description get the current appid with Advertising.appBundleId
*/
async function getCurrentAppID() {
if (!process.env.CURRENT_APPID || !process.env.APPID) {
if (!process.env.CURRENT_APPID) {
try {
let res = await FireboltExampleInvoker.get().invoke(CONSTANTS.CORE.toLowerCase(), 'Advertising.appBundleId', []);
const lastIndex = res.lastIndexOf('.');
Expand Down Expand Up @@ -396,7 +396,7 @@ async function overrideParamsFromTestData(methodObj) {
try {
const paramsJson = testDataHandler('overrideParams');
if (paramsJson && typeof paramsJson == 'object' && Object.keys(paramsJson).length) {
const appID = process.env.APPID;
const appID = process.env.CURRENT_APPID;
// Checking if any data present for the passed appId
const parsedMethod = paramsJson[appID];
// Fetching the examples from the parsedMethod
Expand Down
Loading