From d55fd82e5a7c19cb072bb7f0fb7a8d966b5843af Mon Sep 17 00:00:00 2001 From: Joe Meier Date: Thu, 17 Oct 2024 15:14:34 -0400 Subject: [PATCH 1/3] update winston --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9f1222ef..d9a84523 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "perf_hooks": "^0.0.1", "rxjs": "7.2.0", "uuid": "^9.0.0", - "winston": "3.13.1", + "winston": "^3.15.0", "xml2js": "^0.5.0" }, "scripts": { From 398d806250f8ad6d7f8bdd9e57f859fc035921ed Mon Sep 17 00:00:00 2001 From: Joe Meier Date: Thu, 17 Oct 2024 15:22:27 -0400 Subject: [PATCH 2/3] Update package --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index d9a84523..e07fc766 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,8 @@ "perf_hooks": "^0.0.1", "rxjs": "7.2.0", "uuid": "^9.0.0", - "winston": "^3.15.0", + "winston": "3.15.0", + "winston-transport": "4.7.1", "xml2js": "^0.5.0" }, "scripts": { From efa81bab004ed4270590cf36539841f3b130bcb8 Mon Sep 17 00:00:00 2001 From: anjali <47880722+anjalimukundan@users.noreply.github.com> Date: Mon, 28 Oct 2024 13:17:05 +0530 Subject: [PATCH 3/3] Streamline dependencies on pubsub (#230) * Streamline dependencies on pub sub * fixed lint issues * fixed lint issues * updated default_mac logic * fixed lint issues * pubsub suffix changes * lint errors * remove console logs * minor correction * addig console logs * fix lint error * remove logs * remove default mac from app.js * updated mac address env * fix lint error * update readme with supported intent params * update readme * minor correction * updated mac address env * update url params * Updating readme --------- Co-authored-by: neeradanelxsi <148241508+neeradanelxsi@users.noreply.github.com> Co-authored-by: preethi.m Co-authored-by: neeradanelxsi --- README.md | 62 ++++++++++++++++++++++++++++++++------------- src/App.js | 12 ++++++++- src/constant.js | 2 ++ src/pubSubClient.js | 4 +-- src/utils/Utils.js | 10 +++++--- 5 files changed, 67 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 50bed960..35e7c28e 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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` used to launch the app. +- Mac Address: macAddress=`` + - `macAddress` of the device running the tests. +- appType: appType=`` + - `appType` is the type of app being launched. +- Pub Sub Subscribe suffix : pubSubSubscribeSuffix=`` + - `pubSubSubscribeSuffix` is the subscribe suffix value used for Pub Sub communication. +- Pub Sub Publish suffix : 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 diff --git a/src/App.js b/src/App.js index c0f5ba24..47709083 100644 --- a/src/App.js +++ b/src/App.js @@ -121,6 +121,11 @@ export default class App extends Base { // Set the pubSub URL if present process.env.PUB_SUB_URL = new URLSearchParams(window.location.search).get('pubSubUrl'); + 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'); if (platform) { process.env.PLATFORM = platform; @@ -159,7 +164,6 @@ export default class App extends Base { this.pubSubListener(); } getCurrentAppID().then((res) => { - process.env.APPID = res; this._setState('LoadingState'); }); } @@ -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 { diff --git a/src/constant.js b/src/constant.js index dbc62c97..61c32889 100644 --- a/src/constant.js +++ b/src/constant.js @@ -174,4 +174,6 @@ export const CONSTANTS = { VERSIONS: 'Versions', NO_RESULT_OR_ERROR_MESSAGE: 'No result or error in response. eg: {jsonrpc: "2.0", id: x }', SCHEMA_VALIDATION: 'Schema Validation', + DEFAULT_APP_ID: 'DEFAULT_APP_ID', + DEFAULT_MAC: 'DEFAULT_MAC', }; diff --git a/src/pubSubClient.js b/src/pubSubClient.js index 1a65c668..c5dd2469 100644 --- a/src/pubSubClient.js +++ b/src/pubSubClient.js @@ -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 diff --git a/src/utils/Utils.js b/src/utils/Utils.js index 4ac82dca..950b5c2d 100644 --- a/src/utils/Utils.js +++ b/src/utils/Utils.js @@ -173,6 +173,9 @@ function pushReportToS3(report) { } }); }); + } else { + process.env.MACADDRESS = CONSTANTS.DEFAULT_MAC; + macAddress = process.env.MACADDRESS; } } else { macAddress = process.env.MACADDRESS; @@ -327,7 +330,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('.'); @@ -336,7 +339,8 @@ async function getCurrentAppID() { return res; } catch (error) { logger.error('Error while calling Advertising.appBundleId : ' + error, 'App getAppId'); - return error; + process.env.CURRENT_APPID = CONSTANTS.DEFAULT_APP_ID; + return process.env.CURRENT_APPID; } } } @@ -396,7 +400,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