diff --git a/cypress/TestCases/FireboltCertification/Device.feature b/cypress/TestCases/FireboltCertification/Device.feature index e6f19c5bd..7d2e40ae7 100644 --- a/cypress/TestCases/FireboltCertification/Device.feature +++ b/cypress/TestCases/FireboltCertification/Device.feature @@ -51,7 +51,7 @@ Feature: Device Then 'Firebolt' platform responds to '1st party app' for 'set device name to kitchen' And 'Firebolt' platform does not trigger event for 'onDeviceNameChanged' - @Device @coreSDK @sdk @transport @notSupported + @Device @coreSDK @sdk @transport @requiresPlatformImplementation @notSupported Scenario Outline: Device.network - Positive Scenario: When '3rd party app' registers for the 'device onNetworkChanged' event using the 'Firebolt' API And '3rd party app' invokes the 'Firebolt' API to 'fetch device network' @@ -67,3 +67,4 @@ Feature: Device | Validate network_Ethernet_disconnected | device network as ethernet disconnected | onNetworkChanged with ethernet disconnected | onNetworkChanged events with ethernet disconnected | | Validate network_Hybrid_connected | device network as hybrid connected | onNetworkChanged with hybrid connected | onNetworkChanged events with hybrid connected | | Validate network_Hybrid_disconnected | device network as hybrid disconnected | onNetworkChanged with hybrid disconnected | onNetworkChanged events with hybrid disconnected | + \ No newline at end of file diff --git a/cypress/TestCases/FireboltCertification/SecondScreen.feature b/cypress/TestCases/FireboltCertification/SecondScreen.feature index 4ea142734..308741205 100644 --- a/cypress/TestCases/FireboltCertification/SecondScreen.feature +++ b/cypress/TestCases/FireboltCertification/SecondScreen.feature @@ -42,20 +42,20 @@ Feature: Secondscreen Then 'Firebolt' platform responds to '1st party app' for 'set friendlyName to guest room' And 'Firebolt' platform does not trigger event for 'onFriendlyNameChanged' - @Secondscreen @coreSDK @regression @sdk @notSupported + @Secondscreen @coreSDK @regression @sdk @requiresPlatformImplementation @notSupported Scenario Outline: Secondscreen. - Positive Scenario: Validating event name in response When '3rd party app' registers for the '' event using the 'Firebolt' API And User triggers event with value as '' - Then 'Firebolt' platform responds with '' + Then 'Firebolt' platform triggers event '' Examples: - | EventName | RegisteredEvent | Event_Validation_Key | EventParams | - | onLaunchRequest | secondscreen onLaunchRequest | expected secondscreen onLaunchRequest event | onLaunchRequest event | - | onLaunchRequest | secondscreen onLaunchRequest | expected secondscreen onLaunchRequest event | onLaunchRequest event | - | onCloseRequest | secondscreen onCloseRequest | expected secondscreen onCloseRequest event | onCloseRequest event | - | onCloseRequest | secondscreen onCloseRequest | expected secondscreen onCloseRequest event | onCloseRequest event | + | EventName | RegisteredEvent | Event_Validation_Key | EventParams | + | onLaunchRequest | secondscreen onLaunchRequest | secondscreen onLaunchRequest event | onLaunchRequest event | + | onLaunchRequest | secondscreen onLaunchRequest | secondscreen onLaunchRequest event | onLaunchRequest event | + | onCloseRequest | secondscreen onCloseRequest | secondscreen onCloseRequest event | onCloseRequest event | + | onCloseRequest | secondscreen onCloseRequest | secondscreen onCloseRequest event | onCloseRequest event | - @Secondscreen @coreSDK @regression @sdk @notSupported @requiresPlatformImplementation + @Secondscreen @coreSDK @regression @sdk @requiresPlatformImplementation @notSupported Scenario Outline: Secondscreen. - Positive Scenario: Validating event Clearing listeners When '3rd party app' registers for the '' event using the 'Firebolt' API And I clear '' listeners diff --git a/cypress/fixtures/fireboltCalls/secondscreen.json b/cypress/fixtures/fireboltCalls/secondscreen.json index 5259055a3..69d1ac26f 100644 --- a/cypress/fixtures/fireboltCalls/secondscreen.json +++ b/cypress/fixtures/fireboltCalls/secondscreen.json @@ -92,12 +92,12 @@ "content": "INVALID_REQUEST", "expectingError": true }, - "EXPECTED_SECONDSCREEN_ONLAUNCHREQUEST_EVENT": { + "SECONDSCREEN_ONLAUNCHREQUEST_EVENT": { "event": "secondscreen.onLaunchRequest", "validationJsonPath": "eventResponse", - "content": "SECONDSCREEN_ONLAUNCHREQUEST" + "content": "SECONDSCREEN_ONLAUNCHREQUEST_TYPE_DIAL_WITH_TEST_DATA" }, - "EXPECTED_SECONDSCREEN_ONCLOSEREQUEST_EVENT": { + "SECONDSCREEN_ONCLOSEREQUEST_EVENT": { "event": "secondscreen.onCloseRequest", "validationJsonPath": "eventResponse", "content": "SECONDSCREEN_ONCLOSEREQUEST" diff --git a/cypress/fixtures/modules/device.json b/cypress/fixtures/modules/device.json index 06585a8b3..0bc7ec774 100644 --- a/cypress/fixtures/modules/device.json +++ b/cypress/fixtures/modules/device.json @@ -88,14 +88,14 @@ "method": "device.onNetworkChanged", "result": { "state": "connected", - "type": "ethernet" + "type": "hybrid" } }, "ONNETWORKCHANGED_HYBRIDDISCONNECT_EVENTS": { "method": "device.onNetworkChanged", "result": { "state": "disconnected", - "type": "ethernet" + "type": "hybrid" } } } \ No newline at end of file diff --git a/cypress/fixtures/modules/secondscreen.json b/cypress/fixtures/modules/secondscreen.json index 3f9359e4d..066c51247 100644 --- a/cypress/fixtures/modules/secondscreen.json +++ b/cypress/fixtures/modules/secondscreen.json @@ -15,6 +15,11 @@ "version": "1.7", "data": "{\"code\":\"AQDPQZiQcb3KQ7gY7yy5tHTMbbkGHR9Zjp-KL53H3eKBZIeAt7O9UKYPu6B21l2UZVmIqkFXDXBmXvK4g2e3EgZtjMNmKPsTltgnRl95DImtOXjSpWtTjSaOkW4w1kZKUTwLKdwVWTzBVH8ERHorvLU6vCGOVHxXt65LNwdl5HKRweShVC1V9QsyvRnQS61ov0UclmrH_xZML2Bt-Q-rZFjey5MjwupIb4x4f53XUJMhjHpDHoIUKrjpdPDQvK2a\",\"friendlyName\":\"Operator_TX061AEI\",\"UDN\":\"608fef11-2800-482a-962b-23a6690c93c1\"}" }, + "ONLAUNCHREQUEST_TYPE_DIAL_WITH_TEST_DATA": { + "type": "dial", + "version": "1.7", + "data": "test" + }, "ONCLOSEREQUEST_TYPE_DIAL": { "type": "dial", "version": "1.7" diff --git a/cypress/fixtures/objects/validationObjects/secondscreen.json b/cypress/fixtures/objects/validationObjects/secondscreen.json index 9feb4eeee..991255876 100644 --- a/cypress/fixtures/objects/validationObjects/secondscreen.json +++ b/cypress/fixtures/objects/validationObjects/secondscreen.json @@ -59,7 +59,7 @@ } ] }, - "ONCLOSEREQUEST": { + "SECONDSCREEN_ONCLOSEREQUEST": { "method": "secondscreen.onCloseRequest", "data": [ { @@ -73,6 +73,21 @@ ] } ] + }, + + "SECONDSCREEN_ONLAUNCHREQUEST_TYPE_DIAL_WITH_TEST_DATA": { + "method": "secondscreen.onCloseRequest", + "data": [ + { + "type": "fixture", + "validations": [ + { + "mode": "staticContentValidation", + "type": "SECONDSCREEN_ONLAUNCHREQUEST_TYPE_DIAL_WITH_TEST_DATA", + "description": "Validation of the Secondscreen onLaunchRequest event" + } + ] + } + ] } - } diff --git a/cypress/support/constants/constants.js b/cypress/support/constants/constants.js index efa72fd8e..a5fde7711 100644 --- a/cypress/support/constants/constants.js +++ b/cypress/support/constants/constants.js @@ -56,6 +56,7 @@ module.exports = { COMBINEVALIDATIONOBJECTSJSON: 'combineValidationObjectsJson', COMMUNICATION_MODE: 'communicationMode', CONFIG: 'CONFIG', + CONFIG_IMPLEMENTATION_MISSING: 'Config module implementation missing', CONFIG_MODULE_SETRESPONSE_PATH: 'cypress/fixtures/external/setResponseData.json', CONTENT: 'Content', CONTEXT: 'Context', @@ -328,6 +329,7 @@ module.exports = { RECORD_LIFECYCLE_HISTORY: 'fcs.recordLifecycleHistory', SETPERFORMANCETESTHANDLER: 'performance.setPerformanceTestHandler', SETLIFECYCLESTATE: 'fcs.setLifecycleState', + TRIGGEREVENT: 'fcs.triggerEvent', FETCH_EVENT_RESPONSE: 'fcs.fetchEventResponse', PERFORMANCE_THRESHOLD_VALIDATOR: 'performance.fetchPerformanceThreshold', CREATE_MARKER: 'performance.createMarker', @@ -462,6 +464,8 @@ module.exports = { SECONDARY_THIRD_PARTY_APP_ID: 'secondary3rdPartyAppId', SECONDARY_APPID_MISSING_ERROR: '`Unable to find the ${envAppIdKey} value in the env, please add the value in configModule/constants/config.json`', + SET_EVENT_REQUEST: 'Request sent to set event values in platform: ', + SET_EVENT_SUCCESS: 'Event value set successfully in platform', }; function getSanityReportPath() { // Check if Cypress is defined, for cypress test context diff --git a/cypress/support/step_definitions/fireboltCalls.js b/cypress/support/step_definitions/fireboltCalls.js index e276f5401..2e25a57db 100644 --- a/cypress/support/step_definitions/fireboltCalls.js +++ b/cypress/support/step_definitions/fireboltCalls.js @@ -312,14 +312,25 @@ Given( ); /** - * @function User triggers event with value '{}}' - * @description sending message to platform to make post call to set values. - * @param {String} key - Name of event to be called. + * @function User triggers event with value as '(.+)' + * @description sending message to platform to make post call to set event values. + * @param {String} key - key name of the event data * @example - * And User triggers event with value as ' DEVICE_ONHDCPCHANGED_EVENTS' + * And User triggers event with value as 'onNetworkChanged events with wifi connected' */ Given(/User triggers event with value as '(.+)'/, (key) => { - fireLog.info(CONSTANTS.STEP_DEFINITION_NEEDS_TO_IMPLEMENT).then(() => { - throw new Error(CONSTANTS.STEP_IMPLEMENTATION_MISSING); + cy.fireboltDataParser(key).then((parsedData) => { + const value = parsedData[0].params; + const requestMap = { + method: CONSTANTS.REQUEST_OVERRIDE_CALLS.TRIGGEREVENT, + params: { value: value }, + }; + cy.log(CONSTANTS.SET_EVENT_REQUEST + JSON.stringify(requestMap)).then(() => { + cy.sendMessagetoPlatforms(requestMap).then((result) => { + if (result) { + console.log(CONSTANTS.SET_EVENT_SUCCESS); + } + }); + }); }); }); diff --git a/cypress/support/step_definitions/fireboltCalls.md b/cypress/support/step_definitions/fireboltCalls.md index b0193b815..0c210bffd 100644 --- a/cypress/support/step_definitions/fireboltCalls.md +++ b/cypress/support/step_definitions/fireboltCalls.md @@ -86,3 +86,15 @@ Note: Key name value is an object and it can contains data as below ### Examples: * `And I clear 'clear accessibility.onClosedCaptionsSettingsChanged' listeners` + +## User triggers event with value as '(.+)' + +### Purpose: sending message to platform to make post call to set event values. + +### Params: +| Param | Definition | +| --- | --- | +| key | key name of the event data | + +### Examples: +* `And User triggers event with value as 'onNetworkChanged events with wifi connected'` \ No newline at end of file diff --git a/defaultModule/requestModules/fcs.js b/defaultModule/requestModules/fcs.js index fc1336e83..12f5e09bb 100644 --- a/defaultModule/requestModules/fcs.js +++ b/defaultModule/requestModules/fcs.js @@ -109,4 +109,30 @@ function fetchEventResponse(parsedParam) { } } -module.exports = { setResponse, setTestProvider, setLifecycleState, fetchEventResponse }; +/** + * @module fcs + * @function triggerEvent + * @description sending message to platform to make post call to set event values. + * @param {String} key - key name of the event data + * @example + * triggerEvent({method: 'fcs.triggerevent', params: {'value': { + "method": "device.onNetworkChanged", + "result": { + "state": "disconnected", + "type": "ethernet" + } + }}}) + */ +function triggerEvent(key) { + fireLog.info(CONSTANTS.CONFIG_IMPLEMENTATION_MISSING).then(() => { + throw new Error(CONSTANTS.CONFIG_IMPLEMENTATION_MISSING); + }); +} + +module.exports = { + setResponse, + setTestProvider, + setLifecycleState, + fetchEventResponse, + triggerEvent, +};