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/package.json b/package.json index 9f1222ef..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.13.1", + "winston": "3.15.0", + "winston-transport": "4.7.1", "xml2js": "^0.5.0" }, "scripts": { 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 396cd0ee..9422107e 100644 --- a/src/constant.js +++ b/src/constant.js @@ -176,4 +176,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