From 8f4810e60957a1aec87d1969efd23763874c9e36 Mon Sep 17 00:00:00 2001 From: Dmitriy Boltovskiy Date: Wed, 30 Dec 2020 12:32:54 -0500 Subject: [PATCH] Add script(s) for issue 2353 --- test_scripts/Defects/7_1/2353_1_Request.lua | 85 +++++++++++++++++++ test_scripts/Defects/7_1/2353_2_Response.lua | 74 ++++++++++++++++ .../Defects/7_1/2353_3_Notification.lua | 63 ++++++++++++++ test_sets/Defects/Defects_release_7_1.txt | 5 +- 4 files changed, 226 insertions(+), 1 deletion(-) create mode 100644 test_scripts/Defects/7_1/2353_1_Request.lua create mode 100644 test_scripts/Defects/7_1/2353_2_Response.lua create mode 100644 test_scripts/Defects/7_1/2353_3_Notification.lua diff --git a/test_scripts/Defects/7_1/2353_1_Request.lua b/test_scripts/Defects/7_1/2353_1_Request.lua new file mode 100644 index 0000000000..0317875541 --- /dev/null +++ b/test_scripts/Defects/7_1/2353_1_Request.lua @@ -0,0 +1,85 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/SmartDeviceLink/sdl_core/issues/2353 +--------------------------------------------------------------------------------------------------- +-- Description: Check SDL is able to proceed with request from HMI after cut off of fake parameters +-- Scenario: request that SDL should transfer to mobile app +-- +-- Steps: +-- 1. HMI sends request with fake parameter +-- SDL does: +-- - cut off fake parameters +-- - check whether request is valid +-- - proceed with request in case if it's valid and transfer it to App +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local manifest = { + serviceName = common.getConfigAppParams().appName, + serviceType = "MEDIA", + allowAppConsumers = true, + rpcSpecVersion = common.getConfigAppParams().syncMsgVersion, + mediaServiceManifest = {} +} + +--[[ Local Functions ]] +local function ptUpdate(tbl) + tbl.policy_table.app_policies[common.getConfigAppParams().fullAppID] = common.getAppServiceProducerConfig(1); +end + +local function sendPerformAppServiceInteraction() + local hmiReq = { + serviceUri = "mobile:sample.service.uri", + serviceID = common.getAppServiceID(), + fakeParam = "123" + } + local mobReq = { + originApp = common.sdl.getSDLIniParameter("HMIOriginID"), + serviceID = hmiReq.serviceID, + serviceUri = hmiReq.serviceUri + } + local mobRes = { + serviceSpecificResult = "SPECIFIC_RESULT", + success = true, + resultCode = "SUCCESS" + } + local hmiRes = { + result = { + code = 0, -- SUCCESS + method = "AppService.PerformAppServiceInteraction", + serviceSpecificResult = mobRes.serviceSpecificResult + } + } + local cid = common.getHMIConnection():SendRequest("AppService.PerformAppServiceInteraction", hmiReq) + common.getMobileSession():ExpectRequest("PerformAppServiceInteraction", mobReq) + :Do(function(_, data) + common.getMobileSession():SendResponse(data.rpcFunctionId, data.rpcCorrelationId, mobRes) + end) + :ValidIf(function(_, data) + if data.payload.fakeParam then + return false, "Unexpected 'fakeParam' is received" + end + return true + end) + common.getHMIConnection():ExpectResponse(cid, hmiRes) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect regular mobile, start Session", common.start) +runner.Step("Register App", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { ptUpdate }) +runner.Step("Activate App", common.activateApp) +runner.Step("Publish App Service", common.publishMobileAppService, { manifest }) + +runner.Title("Test") +runner.Step("HMI sends PerformAppServiceInteraction", sendPerformAppServiceInteraction) + +runner.Title("Postconditions") +runner.Step("Stop SDL, restore SDL settings and PPT", common.postconditions) diff --git a/test_scripts/Defects/7_1/2353_2_Response.lua b/test_scripts/Defects/7_1/2353_2_Response.lua new file mode 100644 index 0000000000..42f4a8f481 --- /dev/null +++ b/test_scripts/Defects/7_1/2353_2_Response.lua @@ -0,0 +1,74 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/SmartDeviceLink/sdl_core/issues/2353 +--------------------------------------------------------------------------------------------------- +-- Description: Check SDL is able to proceed with response from HMI after cut off of fake parameters +-- Scenario: response that SDL should transfer to mobile app +-- +-- Steps: +-- 1. App sends request to SDL +-- SDL does: +-- - transfer this request to HMI +-- 2. HMI responds with fake parameter +-- SDL does: +-- - cut off fake parameters +-- - check whether response is valid +-- - proceed with response in case if it's valid and transfer it to App +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require("user_modules/sequences/actions") +local utils = require("user_modules/utils") + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Functions ]] +local function ptUpdate(pTbl) + pTbl.policy_table.app_policies[common.app.getParams().fullAppID].groups = { "Base-4", "PropriataryData-1" } +end + +local function sendReadDID() + local params = { + ecuName = 2000, + didLocation = { + 56832 + } + } + local exp = { + didResult = { + { + resultCode = "SUCCESS", + didLocation = params.didLocation[1], + data = "some_data" + } + } + } + local dataFromHMI = utils.cloneTable(exp) + dataFromHMI.didResult[1].fakeParam = "123" + local cid = common.getMobileSession():SendRPC("ReadDID", params) + common.getHMIConnection():ExpectRequest("VehicleInfo.ReadDID") + :Do(function(_, data) + common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", dataFromHMI) + end) + common.getMobileSession():ExpectResponse(cid, { success = true, resultCode = "SUCCESS", didResult = exp.didResult }) + :ValidIf(function(_, data) + if data.payload.didResult[1].fakeParam then + return false, "Unexpected 'fakeParam' is received" + end + return true + end) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect regular mobile, start Session", common.start) +runner.Step("Register App", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { ptUpdate }) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("App sends ReadDID", sendReadDID) + +runner.Title("Postconditions") +runner.Step("Stop SDL, restore SDL settings and PPT", common.postconditions) diff --git a/test_scripts/Defects/7_1/2353_3_Notification.lua b/test_scripts/Defects/7_1/2353_3_Notification.lua new file mode 100644 index 0000000000..855306c7eb --- /dev/null +++ b/test_scripts/Defects/7_1/2353_3_Notification.lua @@ -0,0 +1,63 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/SmartDeviceLink/sdl_core/issues/2353 +--------------------------------------------------------------------------------------------------- +-- Description: Check SDL is able to proceed with notification from HMI after cut off of fake parameters +-- Scenario: notification that SDL should transfer to mobile app +-- +-- Steps: +-- 1. HMI sends notification with fake parameter +-- SDL does: +-- - cut off fake parameters +-- - check whether notification is valid +-- - proceed with notification in case if it's valid and transfer it to App +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require("user_modules/sequences/actions") +local utils = require("user_modules/utils") + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Functions ]] +local function sendOnSCU() + local expDataToMobile = { + systemCapability = { + systemCapabilityType = "DISPLAYS", + displayCapabilities = { + { + displayName = "MainDisplayName", + windowCapabilities = { + { + windowID = 0, + templatesAvailable = { "Tmpl1", "Tmpl2" } + } + } + } + } + } + } + local dataFromHMI = utils.cloneTable(expDataToMobile) + dataFromHMI.appID = common.getHMIAppId() + dataFromHMI.systemCapability.fakeParam = "123" + common.getHMIConnection():SendNotification("BasicCommunication.OnSystemCapabilityUpdated", dataFromHMI) + common.getMobileSession():ExpectNotification("OnSystemCapabilityUpdated", expDataToMobile) + :ValidIf(function(_, data) + if data.payload.systemCapability.fakeParam then + return false, "Unexpected 'fakeParam' is received" + end + return true + end) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect regular mobile, start Session", common.start) +runner.Step("Register App", common.registerAppWOPTU) + +runner.Title("Test") +runner.Step("HMI sends OnSystemCapabilityUpdated", sendOnSCU) + +runner.Title("Postconditions") +runner.Step("Stop SDL, restore SDL settings and PPT", common.postconditions) diff --git a/test_sets/Defects/Defects_release_7_1.txt b/test_sets/Defects/Defects_release_7_1.txt index 57f1af2c57..0620507881 100644 --- a/test_sets/Defects/Defects_release_7_1.txt +++ b/test_sets/Defects/Defects_release_7_1.txt @@ -4,4 +4,7 @@ ./test_scripts/Defects/7_1/1597_1_Alert_Unsupported_Speech_Type.lua ./test_scripts/Defects/7_1/1597_2_SubtleAlert_Unsupported_Speech_Type.lua ./test_scripts/Defects/7_1/1597_3_AlertManeuver_Unsupported_Speech_Type.lua -./test_scripts/Defects/7_1/1597_4_PerformAudioPassThru_Unsupported_Speech_Type.lua \ No newline at end of file +./test_scripts/Defects/7_1/1597_4_PerformAudioPassThru_Unsupported_Speech_Type.lua +./test_scripts/Defects/7_1/2353_1_Request.lua +./test_scripts/Defects/7_1/2353_2_Response.lua +./test_scripts/Defects/7_1/2353_3_Notification.lua