diff --git a/README.md b/README.md index 98ba215517..6dd04b33c3 100644 --- a/README.md +++ b/README.md @@ -23,34 +23,64 @@ This repository contains ATF scripts and data to run it. ## Manual usage: * [Setup SDL](https://github.com/smartdevicelink/sdl_core). - * Later the SDL sources destination directory is referenced as `` -* [Setup ATF](https://github.com/smartdevicelink/sdl_atf) - * Later the ATF sources destination directory is referenced as `` + * Later the SDL sources destination directory is referenced as `` +* [Setup ATF](https://github.com/smartdevicelink/sdl_atf). + * Later the ATF sources destination directory is referenced as `` + * Later the ATF build destination directory is referenced as `` * Clone [sdl_atf_test_scripts](https://github.com/smartdevicelink/sdl_atf) - * Later the atf test scripts destination directory is referenced as `` + * Later the atf test scripts destination directory is referenced as `` -``` git clone https://github.com/smartdevicelink/sdl_atf_test_scripts ``` -* Copy all files from `` to `` : + ```bash + git clone https://github.com/smartdevicelink/sdl_atf_test_scripts + ``` + +* Create symlinks in the build `bin` directory to certain directories in ``: + + ```bash + cd /bin + ln -s /files + ln -s /test_sets + ln -s /test_scripts + ln -s /user_modules + ``` + +* In your `/modules/configuration/base_config.lua` + * Include the path to your local SDL Core binary (ex. `/bin/`): + ```lua + --- Define path to SDL binary + -- Example: "/home/user/sdl_build/bin" + config.pathToSDL = "/home/user/sdl_build/bin" + ``` + + * Include the path to your local SDL Core Source directory (ex. `/`): + ```lua + --- Define path to SDL source + -- Example: "/home/user/sdl_core" + config.pathToSDLSource = "" + ``` + ATF will use the provided path to derive the location of the MOBILE_API.xml and HMI_API.xml files within the directory. + + * Instead of including the path to your local SDL Core Source directory, you can alternatively include the paths to your local directories containing the HMI_API and MOBILE_API files: + + ```lua + --- Define path to SDL MOBILE interface + -- Example: "/home/user/sdl_core/tools/rpc_spec" + config.pathToSDLMobileInterface = "/home/user/sdl_core/tools/rpc_spec" + --- Define path to SDL HMI interface + -- Example: "/home/user/sdl_core/src/components/interfaces" + config.pathToSDLHMIInterface = "/home/user/sdl_core/src/components/interfaces" + ``` + **NOTE:** If both `pathToSDLSource` and `pathToSDLMobileInterface`/`pathToSDLHMIInterface` are defined in the config file, the paths provided in `pathToSDLMobileInterface`/`pathToSDLHMIInterface` will override the paths derived from `pathToSDLSource`. -``` cp -r /* / ``` -* Include the path to your local HMI_API.xml, MOBILE_API.xml (ex. `/src/components/interfaces/`) and the path to your local SDL Core binary (ex. `/bin/`) in your `/modules/config.lua` : -``` ---- Define path to SDL binary --- Example: "/home/user/sdl_build/bin" -config.pathToSDL = "/home/user/sdl_build/bin" ---- Define path to SDL interfaces --- Example: "/home/user/sdl_panasonic/src/components/interfaces" -config.pathToSDLInterfaces = "/home/user/sdl_core/src/components/interfaces" -``` * Run ATF. _Mandatory options:_ * Pass path to test script as first command line parameter -``` -cd / -./start.sh ./test_scripts/Smoke/API/021_Speak_PositiveCase_SUCCESS.lua -``` + ``` + cd /bin + ./start.sh ./test_scripts/Smoke/API/021_Speak_PositiveCase_SUCCESS.lua + ``` You can get additional help of usage ATF: ``` diff --git a/files/jsons/JSON_Language_parameter/JSONWithTtsNameVrSynonymsInSeparatedStructs.json b/files/jsons/JSON_Language_parameter/JSONWithTtsNameVrSynonymsInSeparatedStructs.json index b3aa27c29e..cfc79d2696 100644 --- a/files/jsons/JSON_Language_parameter/JSONWithTtsNameVrSynonymsInSeparatedStructs.json +++ b/files/jsons/JSON_Language_parameter/JSONWithTtsNameVrSynonymsInSeparatedStructs.json @@ -33,7 +33,7 @@ } ] }, - "appId": "553426", + "appId": "553425", "development": false, "iconUrl": "http://i.imgur.com/R3a11YFAk3.png", "name": "Rap music App" @@ -72,4 +72,4 @@ "iconUrl": "http://i.imgur.com/R3a11YFAk3.png" } ] -} \ No newline at end of file +} diff --git a/files/jsons/Policies/PTU_ValidationRules/preloaded_memory_kb_exist.json b/files/jsons/Policies/PTU_ValidationRules/preloaded_memory_kb_exist.json index b81406da78..6a7dc88b2e 100644 --- a/files/jsons/Policies/PTU_ValidationRules/preloaded_memory_kb_exist.json +++ b/files/jsons/Policies/PTU_ValidationRules/preloaded_memory_kb_exist.json @@ -2127,7 +2127,6 @@ }, "app_policies": { "default": { - "memory_kb":1500, "keep_context": false, "steal_focus": false, "priority": "NONE", @@ -2143,7 +2142,6 @@ "groups": ["DataConsent-2"] }, "pre_DataConsent": { - "memory_kb":200, "keep_context": false, "steal_focus": false, "priority": "NORMAL", diff --git a/files/jsons/Policies/Policy_Table_Update/ptu_18190.json b/files/jsons/Policies/Policy_Table_Update/ptu_18190.json index 8de20d2a53..f35c93a9e5 100644 --- a/files/jsons/Policies/Policy_Table_Update/ptu_18190.json +++ b/files/jsons/Policies/Policy_Table_Update/ptu_18190.json @@ -8,7 +8,6 @@ "default_hmi": "NONE", "groups": ["Base-4", "Base-6"], "heart_beat_timeout_ms": 0, - "memory_kb": 0, "nicknames": ["Test Application"], "RequestType": [] }, diff --git a/files/jsons/Policies/Policy_Table_Update/ptu_file_with_full_app_id_supported.json b/files/jsons/Policies/Policy_Table_Update/ptu_file_with_full_app_id_supported.json index 674150823f..f7d0dcff02 100644 --- a/files/jsons/Policies/Policy_Table_Update/ptu_file_with_full_app_id_supported.json +++ b/files/jsons/Policies/Policy_Table_Update/ptu_file_with_full_app_id_supported.json @@ -8,7 +8,6 @@ "default_hmi": "NONE", "groups": ["Base-4", "Base-6"], "heart_beat_timeout_ms": 0, - "memory_kb": 0, "nicknames": ["Test Application"], "RequestType": [] }, diff --git a/files/ptu_heart_beat_timeout_ms_app_1234567.json b/files/ptu_heart_beat_timeout_ms_app_1234567.json index 725f733422..2667ee5546 100644 --- a/files/ptu_heart_beat_timeout_ms_app_1234567.json +++ b/files/ptu_heart_beat_timeout_ms_app_1234567.json @@ -2209,7 +2209,6 @@ "groups": [ "Base-4" ], - "memory_kb":1000, "RequestType":[ "TRAFFIC_MESSAGE_CHANNEL", "PROPRIETARY", diff --git a/files/ptu_memory_kb_app_1234567.json b/files/ptu_memory_kb_app_1234567.json index d37cafcf3b..eb1fffa94a 100644 --- a/files/ptu_memory_kb_app_1234567.json +++ b/files/ptu_memory_kb_app_1234567.json @@ -2211,7 +2211,6 @@ "groups": [ "Base-4" ], - "memory_kb":300, "RequestType":[ "TRAFFIC_MESSAGE_CHANNEL", "PROPRIETARY", diff --git a/test_scripts/API/ATF_OnAppInterfaceUnregistered.lua b/test_scripts/API/ATF_OnAppInterfaceUnregistered.lua index abe334a152..b6c6545e26 100644 --- a/test_scripts/API/ATF_OnAppInterfaceUnregistered.lua +++ b/test_scripts/API/ATF_OnAppInterfaceUnregistered.lua @@ -1738,7 +1738,7 @@ local function TC_APPLINK_18428_AppPermissionIsNull() EXPECT_HMINOTIFICATION("SDL.OnAppPermissionChanged", {appID = self.applications["AppNullPermission"], appRevoked = true, priority = "EMERGENCY"}) :Do(function(_,data) --hmi side: sending SDL.GetUserFriendlyMessage request to SDL - local RequestIdGetUserFriendlyMessage = self.hmiConnection:SendRequest("SDL.GetUserFriendlyMessage", {language = "EN-US", messageCodes = {"AppUnsupported"}}) + local RequestIdGetUserFriendlyMessage = self.hmiConnection:SendRequest("SDL.GetUserFriendlyMessage", {language = "EN-US", messageCodes = {"AppUnauthorized"}}) --hmi side: expect BC.ActivateApp EXPECT_HMICALL("BasicCommunication.ActivateApp",{appID=self.applications["AppNullPermission"],level="NONE",priority="NONE"}) @@ -1752,10 +1752,10 @@ local function TC_APPLINK_18428_AppPermissionIsNull() self.hmiConnection:SendResponse(data.id,data.method, "SUCCESS",{}) end) EXPECT_HMIRESPONSE(RequestIdGetUserFriendlyMessage,{result = {code = 0, method = "SDL.GetUserFriendlyMessage", messages = {{ - line1 = "Not Supported", - messageCode = "AppUnsupported", - textBody = "Your version of %appName% is not supported by SYNC.", - ttsString = "This version of %appName% is not supported by SYNC."}}}}) + line1 = "Not Authorized", + messageCode = "AppUnauthorized", + textBody = "This version of %appName% is no longer authorized to work with AppLink. Please update to the latest version of %appName%.", + ttsString = "This version of %appName% is not authorized and will not work with SYNC."}}}}) end) --mobile side: expect notification EXPECT_NOTIFICATION("OnHMIStatus", {hmiLevel = "NONE", systemContext = "MAIN"}) @@ -1774,4 +1774,4 @@ commonFunctions:newTestCasesGroup("****************************** END TEST BLOCK -----------------------------------------TEST BLOCK VII--------------------------------------- --------------------------------------Different HMIStatus------------------------------------- ---------------------------------------------------------------------------------------------- ---All HMILevel is checked on TCs on TEST BLOCK VI \ No newline at end of file +--All HMILevel is checked on TCs on TEST BLOCK VI diff --git a/test_scripts/API/ButtonSubscription/commonButtonSubscription.lua b/test_scripts/API/ButtonSubscription/commonButtonSubscription.lua index 25f6721c91..732011b684 100644 --- a/test_scripts/API/ButtonSubscription/commonButtonSubscription.lua +++ b/test_scripts/API/ButtonSubscription/commonButtonSubscription.lua @@ -343,6 +343,7 @@ function m.reRegisterAppSuccess(pAppId, pCheckResumptionData, pExpTime) local params = m.cloneTable(m.getConfigAppParams(pAppId)) params.hashID = m.hashId[pAppId] local corId = mobSession:SendRPC("RegisterAppInterface", params) + mobSession:ExpectNotification("OnHMIStatus", { hmiLevel = "NONE" }, { hmiLevel = "FULL" }):Times(2) m.getHMIConnection():ExpectNotification("BasicCommunication.OnAppRegistered", { application = { appName = m.getConfigAppParams(pAppId).appName } }) mobSession:ExpectResponse(corId, { success = true, resultCode = "SUCCESS" }) diff --git a/test_scripts/API/Expanded_proprietary_data_exchange/004_requestSubType_with_requestType_HTTP.lua b/test_scripts/API/Expanded_proprietary_data_exchange/004_requestSubType_with_requestType_HTTP.lua index f150280c4d..6d982f9e70 100644 --- a/test_scripts/API/Expanded_proprietary_data_exchange/004_requestSubType_with_requestType_HTTP.lua +++ b/test_scripts/API/Expanded_proprietary_data_exchange/004_requestSubType_with_requestType_HTTP.lua @@ -33,7 +33,8 @@ local function systemRequest(pParams, pFile) if pParams.fileName then pParams.fileName = "/tmp/fs/mp/images/ivsu_cache/" .. pParams.fileName end EXPECT_HMICALL("BasicCommunication.SystemRequest",pParams) :Times(0) - mobSession:ExpectResponse(cid, { success = true, resultCode = "SUCCESS" }) + -- will be rejected because not UPDATING + mobSession:ExpectResponse(cid, { success = false, resultCode = "REJECTED" }) end --[[ Scenario ]] diff --git a/test_scripts/API/Expanded_proprietary_data_exchange/015_System_onSystemRequest_requestType_without_parameter_in_pt.lua b/test_scripts/API/Expanded_proprietary_data_exchange/015_System_onSystemRequest_requestType_without_parameter_in_pt.lua index e605799eb8..2230561ca8 100644 --- a/test_scripts/API/Expanded_proprietary_data_exchange/015_System_onSystemRequest_requestType_without_parameter_in_pt.lua +++ b/test_scripts/API/Expanded_proprietary_data_exchange/015_System_onSystemRequest_requestType_without_parameter_in_pt.lua @@ -28,10 +28,6 @@ local params = { fileName = "action.png" } -local paramsProprietary = { - requestType = "PROPRIETARY", - fileName = "action.png" -} --[[ Local Functions ]] local function ptuFuncRPC(tbl) tbl.policy_table.app_policies[config.application1.registerAppInterfaceParams.fullAppID].RequestType = nil @@ -61,12 +57,8 @@ runner.Title("Test") runner.Step("Policy table update", policyUpdate) runner.Step("SystemRequest with request type OEM_SPECIFIC", common.systemRequest, {params, usedFile}) -runner.Step("SystemRequest with request type PROPRIETARY", common.systemRequest, - {paramsProprietary, usedFile}) runner.Step("onSystemRequest with request type OEM_SPECIFIC", common.onSystemRequest, {params}) -runner.Step("onSystemRequest with request type PROPRIETARY", common.onSystemRequest, - {paramsProprietary}) runner.Title("Postconditions") runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/SDL_Passenger_Mode/007_OnDD_hmiLevel_NONE_to_FULL_DD_OFF.lua b/test_scripts/API/SDL_Passenger_Mode/007_OnDD_hmiLevel_NONE_to_FULL_DD_OFF.lua index 1a3098ecaf..65f8442222 100644 --- a/test_scripts/API/SDL_Passenger_Mode/007_OnDD_hmiLevel_NONE_to_FULL_DD_OFF.lua +++ b/test_scripts/API/SDL_Passenger_Mode/007_OnDD_hmiLevel_NONE_to_FULL_DD_OFF.lua @@ -42,13 +42,13 @@ local function registerApp() end local function onDriverDistractionUnsuccess() - common.getHMIConnection():SendNotification("UI.OnDriverDistraction", { state = "DD_OFF" }) + common.getHMIConnection():SendNotification("UI.OnDriverDistraction", { state = "DD_OFF", lockScreenDismissalEnabled = lockScreenDismissalEnabled }) common.getMobileSession():ExpectNotification("OnDriverDistraction") :Times(0) end local function activateApp() - common.expOnDriverDistraction("DD_OFF", nil) + common.expOnDriverDistraction("DD_OFF", lockScreenDismissalEnabled) common.activateApp() end @@ -62,7 +62,7 @@ runner.Step("App registration HMI level NONE", registerApp) runner.Title("Test") runner.Step("OnDriverDistraction OFF not transfered", onDriverDistractionUnsuccess) runner.Step("App activation HMI level FULL", activateApp) -runner.Step("OnDriverDistraction OFF missing", common.onDriverDistraction, { "DD_OFF", nil }) +runner.Step("OnDriverDistraction OFF missing", common.onDriverDistraction, { "DD_OFF", lockScreenDismissalEnabled }) runner.Title("Postconditions") runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/SDL_Passenger_Mode/009_OnDD_PTU_several_apps.lua b/test_scripts/API/SDL_Passenger_Mode/009_OnDD_PTU_several_apps.lua index 92371c2fc6..18f08dc93d 100644 --- a/test_scripts/API/SDL_Passenger_Mode/009_OnDD_PTU_several_apps.lua +++ b/test_scripts/API/SDL_Passenger_Mode/009_OnDD_PTU_several_apps.lua @@ -68,16 +68,10 @@ local function onDriverDistractionTwoApps(pLockScreenDismissalEnabled) common.getHMIConnection():SendNotification("UI.OnDriverDistraction", { state = "DD_OFF" }) common.getHMIConnection():SendNotification("UI.OnDriverDistraction", { state = "DD_ON" }) common.getMobileSession():ExpectNotification("OnDriverDistraction", - { state = "DD_OFF" }, + { state = "DD_OFF", lockScreenDismissalEnabled = pLockScreenDismissalEnabled }, { state = "DD_ON", lockScreenDismissalEnabled = pLockScreenDismissalEnabled }) :ValidIf(function(e, d) - if e.occurences == 1 and d.payload.lockScreenDismissalEnabled ~= nil then - return false, d.payload.state .. ": " .. msg(d.payload.lockScreenDismissalEnabled) - end - return true - end) - :ValidIf(function(e, d) - if e.occurences == 2 and pLockScreenDismissalEnabled == nil and d.payload.lockScreenDismissalEnabled ~= nil then + if pLockScreenDismissalEnabled == nil and d.payload.lockScreenDismissalEnabled ~= nil then return false, d.payload.state .. ": " .. msg(d.payload.lockScreenDismissalEnabled) end return true @@ -85,16 +79,10 @@ local function onDriverDistractionTwoApps(pLockScreenDismissalEnabled) :Times(2) common.getMobileSession(2):ExpectNotification("OnDriverDistraction", - { state = "DD_OFF" }, + { state = "DD_OFF", lockScreenDismissalEnabled = pLockScreenDismissalEnabled }, { state = "DD_ON", lockScreenDismissalEnabled = pLockScreenDismissalEnabled }) :ValidIf(function(e, d) - if e.occurences == 1 and d.payload.lockScreenDismissalEnabled ~= nil then - return false, d.payload.state .. ": " .. msg(d.payload.lockScreenDismissalEnabled) - end - return true - end) - :ValidIf(function(e, d) - if e.occurences == 2 and pLockScreenDismissalEnabled == nil and d.payload.lockScreenDismissalEnabled ~= nil then + if pLockScreenDismissalEnabled == nil and d.payload.lockScreenDismissalEnabled ~= nil then return false, d.payload.state .. ": " .. msg(d.payload.lockScreenDismissalEnabled) end return true diff --git a/test_scripts/API/SDL_Passenger_Mode/commonPassengerMode.lua b/test_scripts/API/SDL_Passenger_Mode/commonPassengerMode.lua index 56e9d29217..0aaf1a5342 100644 --- a/test_scripts/API/SDL_Passenger_Mode/commonPassengerMode.lua +++ b/test_scripts/API/SDL_Passenger_Mode/commonPassengerMode.lua @@ -29,16 +29,11 @@ end function c.expOnDriverDistraction(pState, pLockScreenDismissalEnabled, pAppId) c.getMobileSession(pAppId):ExpectNotification("OnDriverDistraction", { state = pState }) :ValidIf(function(_, d) - if d.payload.state == "DD_OFF" and d.payload.lockScreenDismissalEnabled ~= nil then + if pLockScreenDismissalEnabled == nil and d.payload.lockScreenDismissalEnabled ~= nil then return false, d.payload.state .. ": Parameter `lockScreenDismissalEnabled` is not expected" end - if d.payload.state == "DD_ON" then - if pLockScreenDismissalEnabled == nil and d.payload.lockScreenDismissalEnabled ~= nil then - return false, d.payload.state .. ": Parameter `lockScreenDismissalEnabled` is not expected" - end - if pLockScreenDismissalEnabled ~= d.payload.lockScreenDismissalEnabled then - return false, d.payload.state .. ": Parameter `lockScreenDismissalEnabled` is not the same as expected" - end + if pLockScreenDismissalEnabled ~= d.payload.lockScreenDismissalEnabled then + return false, d.payload.state .. ": Parameter `lockScreenDismissalEnabled` is not the same as expected" end return true end) diff --git a/test_scripts/API/VehicleData/GetVehicleData/011_GetVD_allowed_and_disallowed_after_PTU.lua b/test_scripts/API/VehicleData/GetVehicleData/011_GetVD_allowed_and_disallowed_after_PTU.lua new file mode 100644 index 0000000000..84c7c5fdca --- /dev/null +++ b/test_scripts/API/VehicleData/GetVehicleData/011_GetVD_allowed_and_disallowed_after_PTU.lua @@ -0,0 +1,77 @@ +--------------------------------------------------------------------------------------------------- +-- Description: Check that SDL cuts off param from GetVehicleData request/response +-- in case parameter is not allowed by policy after PTU +-- +-- Preconditions: +-- 1) SDL and HMI are started +-- 2) GetVehicleData RPC and parameter is disallowed by policies +-- 3) App is registered +-- +-- In case: +-- 1) App sends valid GetVehicleData request to SDL (with all VD params incl. ) +-- SDL does: +-- - a) cut off +-- - b) transfer request to HMI +-- 2) HMI sends VI.GetVehicleData response data to SDL (with all VD params incl. ) +-- SDL does: +-- - a) cut off +-- - b) transfer response to App: +-- (success = true, resultCode = "SUCCESS", = ) +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local common = require('test_scripts/API/VehicleData/common') + +--[[ Conditions to skip test ]] +if #common.restrictedVDParams == 1 then + common.runner.skipTest("Test is not applicable for one restricted VD parameter") +end + +--[[ Local Variables ]] +local all_params = {} +for param in pairs(common.getVDParams(true)) do + table.insert(all_params, param) +end +if #all_params == 0 then all_params = common.json.EMPTY_ARRAY end + +--[[ Local Functions ]] +local function getVDGroup(pDisallowedParam) + local params = {} + for param in pairs(common.getVDParams()) do + if param ~= pDisallowedParam then table.insert(params, param) end + end + if #params == 0 then params = common.json.EMPTY_ARRAY end + return { + rpcs = { + [common.rpc.get] = { + hmi_levels = { "NONE", "BACKGROUND", "LIMITED", "FULL" }, + parameters = params + } + } + } +end + +local function policyTableUpdate(pDisallowedParam) + local function ptUpdate(pt) + pt.policy_table.functional_groupings["NewTestCaseGroup"] = getVDGroup(pDisallowedParam) + pt.policy_table.app_policies[common.getAppParams().fullAppID].groups = { "Base-4", "NewTestCaseGroup" } + end + common.policyTableUpdate(ptUpdate) +end + +--[[ Scenario ]] +for param in common.spairs(common.getVDParams()) do + common.runner.Title("VD parameter: " .. param) + common.runner.Title("Preconditions") + common.runner.Step("Clean environment and update preloaded_pt file", common.preconditions) + common.runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) + common.runner.Step("Register App", common.registerApp) + common.runner.Step("RPC GetVehicleData, SUCCESS", common.getVehicleDataMultipleParams, { all_params }) + + common.runner.Title("Test") + common.runner.Step("PTU with disabling permissions for VD parameter", policyTableUpdate, { param }) + common.runner.Step("RPC " .. common.rpc.get .. " filtered after PTU", common.getVehicleDataMultipleParams, + { all_params, nil, param }) + + common.runner.Title("Postconditions") + common.runner.Step("Stop SDL", common.postconditions) +end diff --git a/test_scripts/API/VehicleData/OnVehicleData/009_OnVD_allowed_for_omitted_parameters_field.lua b/test_scripts/API/VehicleData/OnVehicleData/009_OnVD_allowed_for_omitted_parameters_field.lua new file mode 100644 index 0000000000..253bf684d0 --- /dev/null +++ b/test_scripts/API/VehicleData/OnVehicleData/009_OnVD_allowed_for_omitted_parameters_field.lua @@ -0,0 +1,74 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_core/issues/2380 +-- +-- Description: +-- PoliciesManager must allow all requested parameters in case "parameters" field is omitted +-- +-- Preconditions: +-- 1) SDL and HMI are started +-- 2) SubscribeVehicleData, UnsubscribeVehicleData, OnVehicleData RPCs are allowed by policies +-- 3) "parameters" field is omitted at PolicyTable for all RPCs +-- 4) App is registered +-- +-- In case: +-- 1) App sends valid SubscribeVehicleData(=true) request to SDL +-- SDL does: +-- - a) transfer this request to HMI +-- 2) HMI sends SubscribeVehicleData response with data to SDL +-- SDL does: +-- - a) send SubscribeVehicleData response with (success = true, resultCode = "SUCCESS", +-- = ) to App +-- 3) HMI sends valid OnVehicleData notification with parameter data to SDL +-- SDL does: +-- - a) transfer this notification to App +-- Exception: Notification for unsubscribable VD parameter is not transfered +-- 4) App sends valid UnsubscribeVehicleData(=true) request to SDL +-- SDL does: +-- - a) transfer this request to HMI +-- 5) HMI sends VI.UnsubscribeVehicleData response with parameter to SDL +-- SDL does: +-- - a) send UnsubscribeVehicleData response with (success = true, resultCode = "SUCCESS", +-- = ) to App +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local common = require('test_scripts/API/VehicleData/common') + +--[[ Local Function ]] +local function pTUpdateFunc(pt) + local VDgroup = { + rpcs = { + [common.rpc.sub] = { + parameters = nil, + hmi_levels = { "NONE", "BACKGROUND", "FULL", "LIMITED" }, + }, + [common.rpc.on] = { + parameters = nil, + hmi_levels = { "NONE", "BACKGROUND", "FULL", "LIMITED" }, + }, + [common.rpc.unsub] = { + parameters = nil, + hmi_levels = { "NONE", "BACKGROUND", "FULL", "LIMITED" }, + } + } + } + pt.policy_table.functional_groupings["NewTestCaseGroup"] = VDgroup + pt.policy_table.app_policies[common.getAppParams().fullAppID].groups = {"Base-4", "NewTestCaseGroup"} +end + +--[[ Scenario ]] +common.runner.Title("Preconditions") +common.runner.Step("Clean environment and update preloaded_pt file", common.preconditions) +common.runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +common.runner.Step("Register App", common.registerApp) +common.runner.Step("PTU without 'parameters' field", common.policyTableUpdate, { pTUpdateFunc }) + +common.runner.Title("Test") +for param in common.spairs(common.getVDParams(true)) do + common.runner.Title("VD parameter: " .. param) + common.runner.Step("RPC " .. common.rpc.sub, common.processSubscriptionRPC, { common.rpc.sub, param }) + common.runner.Step("RPC " .. common.rpc.on, common.sendOnVehicleData, { param, common.isExpected }) + common.runner.Step("RPC " .. common.rpc.unsub, common.processSubscriptionRPC, { common.rpc.unsub, param }) +end + +common.runner.Title("Postconditions") +common.runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/VehicleData/OnVehicleData/010_OnVD_allowed_and_disallowed_after_PTU.lua b/test_scripts/API/VehicleData/OnVehicleData/010_OnVD_allowed_and_disallowed_after_PTU.lua new file mode 100644 index 0000000000..0c1c8ca419 --- /dev/null +++ b/test_scripts/API/VehicleData/OnVehicleData/010_OnVD_allowed_and_disallowed_after_PTU.lua @@ -0,0 +1,80 @@ +--------------------------------------------------------------------------------------------------- +-- Description: Check that SDL cuts off param from OnVehicleData notification transferred to App +-- in case parameter is not allowed by policy after PTU +-- +-- Preconditions: +-- 1) SDL and HMI are started +-- 2) OnVehicleData RPCs and parameter is disallowed by policies +-- 3) App is registered and subscribed to all VD params incl. +-- +-- In case: +-- 1) HMI sends OnVehicleData notification to SDL (with all VD params incl. ) +-- SDL does: +-- - a) cut off +-- - b) transfer this notification to App +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local common = require('test_scripts/API/VehicleData/common') + +--[[ Conditions to skip test ]] +if #common.restrictedVDParams == 1 then + common.runner.skipTest("Test is not applicable for one restricted VD parameter") +end + +--[[ Local Variables ]] +local odometer = 1 +local all_params = {} +for param in pairs(common.getVDParams(true)) do + table.insert(all_params, param) +end +if #all_params == 0 then all_params = common.json.EMPTY_ARRAY end + +--[[ Local Functions ]] +local function getVDGroup(pDisallowedParam) + local params = {} + for param in pairs(common.getVDParams(true)) do + if param ~= pDisallowedParam then table.insert(params, param) end + end + if #params == 0 then params = common.json.EMPTY_ARRAY end + return { + rpcs = { + [common.rpc.sub] = { + hmi_levels = { "NONE", "BACKGROUND", "LIMITED", "FULL" }, + parameters = all_params + }, + [common.rpc.on] = { + hmi_levels = { "NONE", "BACKGROUND", "LIMITED", "FULL" }, + parameters = params + } + } + } +end + +local function policyTableUpdate(pDisallowedParam) + local function ptUpdate(pt) + pt.policy_table.functional_groupings["NewTestCaseGroup"] = getVDGroup(pDisallowedParam) + pt.policy_table.app_policies[common.getAppParams().fullAppID].groups = { "Base-4", "NewTestCaseGroup" } + end + common.policyTableUpdate(ptUpdate) +end + +--[[ Scenario ]] +for param in common.spairs(common.getVDParams(true)) do + common.runner.Title("VD parameter: " .. param) + common.runner.Title("Preconditions") + common.runner.Step("Clean environment and update preloaded_pt file", common.preconditions) + common.runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) + common.runner.Step("Register App", common.registerApp) + common.runner.Step("RPC " .. common.rpc.sub .. " SUCCESS", common.processSubscriptionRPCMultipleParams, + { common.rpc.sub, all_params }) + common.runner.Step("RPC " .. common.rpc.on .. " transferred", common.sendOnVehicleDataMultipleParams, + { all_params, common.isExpected, {["odometer"] = odometer} }) + + common.runner.Title("Test") + common.runner.Step("PTU with disabling permissions for VD parameter", policyTableUpdate, { param }) + common.runner.Step("RPC " .. common.rpc.on .. " filtered", common.sendOnVehicleDataMultipleParams, + { all_params, common.isExpected, {["odometer"] = odometer}, param }) + + common.runner.Title("Postconditions") + common.runner.Step("Stop SDL", common.postconditions) +end diff --git a/test_scripts/API/VehicleData/SubscribeVehicleData/008_SubscribeVD_HMI_responds_with_not_success_codes.lua b/test_scripts/API/VehicleData/SubscribeVehicleData/008_SubscribeVD_HMI_responds_with_not_success_codes.lua index 94744e5fcf..fa3acbe815 100644 --- a/test_scripts/API/VehicleData/SubscribeVehicleData/008_SubscribeVD_HMI_responds_with_not_success_codes.lua +++ b/test_scripts/API/VehicleData/SubscribeVehicleData/008_SubscribeVD_HMI_responds_with_not_success_codes.lua @@ -36,11 +36,13 @@ local resultCodes = { local function subscribeToVDwithUnsuccessCodeForVD(pParam, pCode) local response = { dataType = common.vd[pParam], resultCode = pCode} local cid = common.getMobileSession():SendRPC("SubscribeVehicleData", { [pParam] = true }) + local responseParam = pParam + if pParam == "clusterModeStatus" then responseParam = "clusterModes" end common.getHMIConnection():ExpectRequest("VehicleInfo.SubscribeVehicleData", { [pParam] = true }) :Do(function(_,data) - common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", { [pParam] = response }) + common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", { [responseParam] = response }) end) - common.getMobileSession():ExpectResponse(cid, { success = true, resultCode = "SUCCESS", [pParam] = response }) + common.getMobileSession():ExpectResponse(cid, { success = true, resultCode = "SUCCESS", [responseParam] = response }) end --[[ Scenario ]] diff --git a/test_scripts/API/VehicleData/SubscribeVehicleData/015_SubscribeVD_allowed_and_disallowed_after_PTU.lua b/test_scripts/API/VehicleData/SubscribeVehicleData/015_SubscribeVD_allowed_and_disallowed_after_PTU.lua new file mode 100644 index 0000000000..0b1ef564ff --- /dev/null +++ b/test_scripts/API/VehicleData/SubscribeVehicleData/015_SubscribeVD_allowed_and_disallowed_after_PTU.lua @@ -0,0 +1,80 @@ +--------------------------------------------------------------------------------------------------- +-- Description: Check that SDL cuts off out param from SubscribeVehicleData request/response +-- in case parameter is not allowed by policy after PTU +-- +-- Preconditions: +-- 1) SDL and HMI are started +-- 2) SubscribeVehicleData RPC and parameter is disallowed by policies +-- 3) App is registered +-- +-- In case: +-- 1) App sends valid SubscribeVehicleData request to SDL (with all VD params incl. ) +-- SDL does: +-- - a) cut off +-- - b) transfer this request to HMI +-- 2) HMI sends SubscribeVehicleData response to SDL (with all VD params incl. ) +-- SDL does: +-- - a) cut off +-- - b) transfer SubscribeVehicleData response to App: +-- (success = true, resultCode = SUCCESS", = ) +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local common = require('test_scripts/API/VehicleData/common') + +--[[ Conditions to skip test ]] +if #common.restrictedVDParams == 1 then + common.runner.skipTest("Test is not applicable for one restricted VD parameter") +end + +--[[ Local Variables ]] +local all_params = {} +for param in pairs(common.getVDParams(true)) do + table.insert(all_params, param) +end +if #all_params == 0 then all_params = common.json.EMPTY_ARRAY end + +--[[ Local Functions ]] +local function getVDGroup(pDisallowedParam) + local params = {} + for param in pairs(common.getVDParams(true)) do + if param ~= pDisallowedParam then table.insert(params, param) end + end + if #params == 0 then params = common.json.EMPTY_ARRAY end + return { + rpcs = { + [common.rpc.sub] = { + hmi_levels = { "NONE", "BACKGROUND", "LIMITED", "FULL" }, + parameters = params + } + } + } +end + +local function policyTableUpdate(pDisallowedParam) + local function ptUpdate(pt) + pt.policy_table.functional_groupings["NewTestCaseGroup"] = getVDGroup(pDisallowedParam) + pt.policy_table.app_policies[common.getAppParams().fullAppID].groups = { "Base-4", "NewTestCaseGroup" } + end + common.policyTableUpdate(ptUpdate) +end + +--[[ Scenario ]] +for param in common.spairs(common.getVDParams(true)) do + common.runner.Title("VD parameter: " .. param) + common.runner.Title("Preconditions") + common.runner.Step("Clean environment and update preloaded_pt file", common.preconditions) + common.runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) + common.runner.Step("Register App", common.registerApp) + common.runner.Step("RPC " .. common.rpc.sub, common.processSubscriptionRPCMultipleParams, + { common.rpc.sub, all_params }) + common.runner.Step("RPC " .. common.rpc.unsub, common.processSubscriptionRPCMultipleParams, + { common.rpc.unsub, all_params }) + + common.runner.Title("Test") + common.runner.Step("PTU with disabling permissions for VD parameter", policyTableUpdate, { param }) + common.runner.Step("RPC " .. common.rpc.sub .. " filtered after PTU", common.processSubscriptionRPCMultipleParams, + { common.rpc.sub, all_params, nil, nil, param }) + + common.runner.Title("Postconditions") + common.runner.Step("Stop SDL", common.postconditions) +end diff --git a/test_scripts/API/VehicleData/UnsubscribeVehicleData/008_UnsubscribeVD_HMI_responds_with_not_success_codes.lua b/test_scripts/API/VehicleData/UnsubscribeVehicleData/008_UnsubscribeVD_HMI_responds_with_not_success_codes.lua index ea4caf8f38..6e47db42c1 100644 --- a/test_scripts/API/VehicleData/UnsubscribeVehicleData/008_UnsubscribeVD_HMI_responds_with_not_success_codes.lua +++ b/test_scripts/API/VehicleData/UnsubscribeVehicleData/008_UnsubscribeVD_HMI_responds_with_not_success_codes.lua @@ -37,11 +37,14 @@ local resultCodes = { local function unsubscribeVDwithUnsuccessCodeForVD(pParam, pCode) local response = { dataType = common.vd[pParam], resultCode = pCode} local cid = common.getMobileSession():SendRPC("UnsubscribeVehicleData", { [pParam] = true }) + local responseParam = pParam + if pParam == "clusterModeStatus" then responseParam = "clusterModes" end common.getHMIConnection():ExpectRequest("VehicleInfo.UnsubscribeVehicleData", { [pParam] = true }) :Do(function(_,data) - common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", { [pParam] = response }) + common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", { [responseParam] = response }) end) - common.getMobileSession():ExpectResponse(cid, { success = false, resultCode = "GENERIC_ERROR", [pParam] = response }) + common.getMobileSession():ExpectResponse(cid, { success = false, resultCode = "GENERIC_ERROR", + [responseParam] = response }) end --[[ Scenario ]] diff --git a/test_scripts/API/VehicleData/UnsubscribeVehicleData/012_UnsubscribeVD_allowed_and_disallowed_after_PTU.lua b/test_scripts/API/VehicleData/UnsubscribeVehicleData/012_UnsubscribeVD_allowed_and_disallowed_after_PTU.lua new file mode 100644 index 0000000000..d0867fa581 --- /dev/null +++ b/test_scripts/API/VehicleData/UnsubscribeVehicleData/012_UnsubscribeVD_allowed_and_disallowed_after_PTU.lua @@ -0,0 +1,86 @@ +--------------------------------------------------------------------------------------------------- +-- Description: Check that SDL filters out param from UnsubscribeVehicleData request/response +-- in case parameter is not allowed by policy after PTU +-- +-- Preconditions: +-- 1) SDL and HMI are started +-- 2) UnsubscribeVehicleData RPCs and parameter is disallowed by policies +-- 3) App is registered and subscribed to data +-- +-- In case: +-- 1) App sends valid UnsubscribeVehicleData request to SDL (with all VD params incl. ) +-- SDL does: +-- - a) cut off +-- - b) transfer this request to HMI +-- 2) HMI sends VI.UnsubscribeVehicleData response to SDL (with all VD params incl. ) +-- SDL does: +-- - a) cut off +-- - b) transfer UnsubscribeVehicleData response to App: +-- (success = true, resultCode = "SUCCESS", = ) +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local common = require('test_scripts/API/VehicleData/common') + +--[[ Conditions to skip test ]] +if #common.restrictedVDParams == 1 then + common.runner.skipTest("Test is not applicable for one restricted VD parameter") +end + +--[[ Local Variables ]] +local all_params = {} +for param in pairs(common.getVDParams(true)) do + table.insert(all_params, param) +end +if #all_params == 0 then all_params = common.json.EMPTY_ARRAY end + +--[[ Local Functions ]] +local function getVDGroup(pDisallowedParam) + local params = {} + for param in pairs(common.getVDParams(true)) do + if param ~= pDisallowedParam then table.insert(params, param) end + end + if #params == 0 then params = common.json.EMPTY_ARRAY end + return { + rpcs = { + [common.rpc.sub] = { + hmi_levels = { "NONE", "BACKGROUND", "LIMITED", "FULL" }, + parameters = all_params + }, + [common.rpc.unsub] = { + hmi_levels = { "NONE", "BACKGROUND", "LIMITED", "FULL" }, + parameters = params + }, + } + } +end + +local function policyTableUpdate(pDisallowedParam) + local function ptUpdate(pt) + pt.policy_table.functional_groupings["NewTestCaseGroup"] = getVDGroup(pDisallowedParam) + pt.policy_table.app_policies[common.getAppParams().fullAppID].groups = { "Base-4", "NewTestCaseGroup" } + end + common.policyTableUpdate(ptUpdate) +end + +--[[ Scenario ]] +for param in common.spairs(common.getVDParams(true)) do + common.runner.Title("VD parameter: " .. param) + common.runner.Title("Preconditions") + common.runner.Step("Clean environment and update preloaded_pt file", common.preconditions) + common.runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) + common.runner.Step("Register App", common.registerApp) + common.runner.Step("RPC " .. common.rpc.sub .. " SUCCESS", common.processSubscriptionRPCMultipleParams, + { common.rpc.sub, all_params }) + common.runner.Step("RPC " .. common.rpc.unsub .. " SUCCESS", common.processSubscriptionRPCMultipleParams, + { common.rpc.unsub, all_params }) + + common.runner.Title("Test") + common.runner.Step("PTU with disabling permissions for VD parameter", policyTableUpdate, { param }) + common.runner.Step("RPC " .. common.rpc.sub .. " SUCCESS", common.processSubscriptionRPCMultipleParams, + { common.rpc.sub, all_params }) + common.runner.Step("RPC " .. common.rpc.unsub .. " filtered after PTU", common.processSubscriptionRPCMultipleParams, + { common.rpc.unsub, all_params, nil, nil, param }) + + common.runner.Title("Postconditions") + common.runner.Step("Stop SDL", common.postconditions) +end diff --git a/test_scripts/API/VehicleData/common.lua b/test_scripts/API/VehicleData/common.lua index 62ad5cec41..b19c47026a 100644 --- a/test_scripts/API/VehicleData/common.lua +++ b/test_scripts/API/VehicleData/common.lua @@ -75,7 +75,7 @@ m.vd = { eCallInfo = "VEHICLEDATA_ECALLINFO", airbagStatus = "VEHICLEDATA_AIRBAGSTATUS", emergencyEvent = "VEHICLEDATA_EMERGENCYEVENT", - -- clusterModeStatus = "VEHICLEDATA_CLUSTERMODESTATUS", -- disabled due to issue: https://github.com/smartdevicelink/sdl_core/issues/3460 + clusterModeStatus = "VEHICLEDATA_CLUSTERMODESTATUS", myKey = "VEHICLEDATA_MYKEY", driverBraking = "VEHICLEDATA_BRAKING", wiperStatus = "VEHICLEDATA_WIPERSTATUS", @@ -272,6 +272,18 @@ local function updatePreloadedPTFile(pGroup) actions.sdl.setPreloadedPT(pt) end +--[[ @getResponseParamName: Handle 'clusterModeStatus' VD parameter name +--! @parameters: +--! pParam: name of the parameter in request +--! @return: name of the parameter in response +--]] +local function getResponseParamName(pParam) + if pParam == "clusterModeStatus" then + return "clusterModes" + end + return pParam +end + --[[ @preconditions: Clean environment, optional backup and update of sdl_preloaded_pt.json file --! @parameters: --! pGroup: data for updating sdl_preloaded_pt.json file @@ -356,13 +368,52 @@ end --]] function m.getVehicleData(pParam, pValue) if pValue == nil then pValue = m.vdValues[pParam] end - local cid = m.getMobileSession():SendRPC("GetVehicleData", { [pParam] = true }) - m.getHMIConnection():ExpectRequest("VehicleInfo.GetVehicleData", { [pParam] = true }) + m.getVehicleDataMultipleParams({ pParam }, { pParam = pValue }) +end + +--[[ @getVehicleDataMultipleParams: Successful processing of GetVehicleData RPC for multiple params +--! @parameters: +--! pParamsArray: array of VD parameters +--! pValueOverrides: table with data to override default test values +--! pDisallowedParam: param which SDL is expected to exclude +--! @return: none +--]] +function m.getVehicleDataMultipleParams(pParamsArray, pValueOverrides, pDisallowedParam) + if pValueOverrides == nil then pValueOverrides = {} end + local mobileRequestData = {} + local SDLRequestData = {} + local HMIResponseData = {} + local SDLResponseData = { success = true, resultCode = "SUCCESS" } + for _, param in pairs(pParamsArray) do + mobileRequestData[param] = true + if pValueOverrides[param] == nil then + HMIResponseData[param] = m.vdValues[param] + else + HMIResponseData[param] = pValueOverrides[param] + end + if param ~= pDisallowedParam then + SDLRequestData[param] = true + SDLResponseData[param] = HMIResponseData[param] + end + end + local cid = m.getMobileSession():SendRPC("GetVehicleData", mobileRequestData) + m.getHMIConnection():ExpectRequest("VehicleInfo.GetVehicleData", SDLRequestData) + :ValidIf(function(_, data) + if data.params[pDisallowedParam] ~= nil then + return false, "Disallowed param '" .. pDisallowedParam .. "' is received by HMI" + end + return true + end) :Do(function(_, data) - m.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", { [pParam] = pValue }) + m.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", HMIResponseData) + end) + m.getMobileSession():ExpectResponse(cid, SDLResponseData) + :ValidIf(function(_, data) + if data.payload[pDisallowedParam] ~= nil then + return false, "Disallowed param '" .. pDisallowedParam .. "' is received by App" + end + return true end) - m.getMobileSession():ExpectResponse(cid, - { success = true, resultCode = "SUCCESS", [pParam] = pValue }) end --[[ @processRPCFailure: Processing VehicleData RPC with ERROR resultCode @@ -375,7 +426,28 @@ end --]] function m.processRPCFailure(pRPC, pParam, pResult, pRequestValue) if pRequestValue == nil then pRequestValue = true end - local cid = m.getMobileSession():SendRPC(pRPC, { [pParam] = pRequestValue }) + m.processRPCFailureMultipleParams(pRPC, { pParam }, pResult, { [pParam] = pRequestValue }) +end + +--[[ @processRPCFailureMultipleParams: Processing VehicleData RPC with ERROR resultCode for multiple params +--! @parameters: +--! pRPC: RPC for mobile request +--! pParamsArray: array of names of VD parameters +--! pResult: expected result code +--! pRequestValueOverrides: table with data for App request to override default test value +--! @return: none +--]] +function m.processRPCFailureMultipleParams(pRPC, pParamsArray, pResult, pRequestValueOverrides) + if pRequestValueOverrides == nil then pRequestValueOverrides = {} end + local HMIRequestData = {} + for _, param in pairs(pParamsArray) do + if pRequestValueOverrides[param] == nil then + HMIRequestData[param] = true + else + HMIRequestData[param] = pRequestValueOverrides[param] + end + end + local cid = m.getMobileSession():SendRPC(pRPC, HMIRequestData) m.getHMIConnection():ExpectRequest("VehicleInfo." .. pRPC):Times(0) m.getMobileSession():ExpectResponse(cid, { success = false, resultCode = pResult }) end @@ -406,25 +478,66 @@ end --! @return: none --]] function m.processSubscriptionRPC(pRPC, pParam, pAppId, isRequestOnHMIExpected) + return m.processSubscriptionRPCMultipleParams(pRPC, { pParam }, pAppId, isRequestOnHMIExpected) +end + +--[[ @processSubscriptionRPCMultipleParams: Processing SubscribeVehicleData for multiple VD params +--! @parameters: +--! pRPC: RPC for mobile request +--! pParamsArray: array of names of VD parameters +--! pAppId: application number (1, 2, etc.) +--! isRequestOnHMIExpected: if true or omitted VI.Sub/UnsubscribeVehicleData request is expected on HMI, +--! otherwise - not expected +--! pDisallowedParam: param which SDL is expected to exclude +--! @return: none +--]] +function m.processSubscriptionRPCMultipleParams(pRPC, pParamsArray, pAppId, isRequestOnHMIExpected, pDisallowedParam) if pAppId == nil then pAppId = 1 end if isRequestOnHMIExpected == nil then isRequestOnHMIExpected = true end - local response = { - dataType = m.vd[pParam], - resultCode = "SUCCESS" - } - local responseParam = pParam - if pParam == "clusterModeStatus" then responseParam = "clusterModes" end - local cid = m.getMobileSession(pAppId):SendRPC(pRPC, { [pParam] = true }) + local mobileRequestData = {} + local SDLRequestData = {} + local HMIResponseData = {} + local SDLResponseData = { success = true, resultCode = "SUCCESS" } + for _, param in pairs(pParamsArray) do + mobileRequestData[param] = true + local response_param = getResponseParamName(param) + HMIResponseData[response_param] = { + dataType = m.vd[param], + resultCode = "SUCCESS" + } + if param ~= pDisallowedParam then + SDLRequestData[param] = true + SDLResponseData[response_param] = HMIResponseData[response_param] + end + end + local cid = m.getMobileSession(pAppId):SendRPC(pRPC, mobileRequestData) if isRequestOnHMIExpected == true then - m.getHMIConnection():ExpectRequest("VehicleInfo." .. pRPC, { [pParam] = true }) + m.getHMIConnection():ExpectRequest("VehicleInfo." .. pRPC, SDLRequestData) + :ValidIf(function(_, data) + if data.params[pDisallowedParam] ~= nil then + return false, "Disallowed param '" .. pDisallowedParam .. "' is received by HMI" + end + return true + end) :Do(function(_,data) - m.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", { [responseParam] = response }) + m.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", HMIResponseData) end) else m.getHMIConnection():ExpectRequest("VehicleInfo." .. pRPC):Times(0) end - m.getMobileSession(pAppId):ExpectResponse(cid, - { success = true, resultCode = "SUCCESS", [responseParam] = response }) + m.getMobileSession(pAppId):ExpectResponse(cid, SDLResponseData) + :ValidIf(function(_, data) + local disallowedResponseParam = getResponseParamName(pDisallowedParam) + if disallowedResponseParam ~= nil then + local msg = "Disallowed param '" .. disallowedResponseParam .. "'" + if data.payload[disallowedResponseParam] == nil then + return false, msg .. " is not received by App" + elseif data.payload[disallowedResponseParam].resultCode ~= "DISALLOWED" then + return false, msg .. " is received by App with unexpected resultCode" + end + end + return true + end) local ret = m.getMobileSession(pAppId):ExpectNotification("OnHashChange") :Do(function(_, data) m.setHashId(data.payload.hashID, pAppId) @@ -440,11 +553,41 @@ end --! @return: none --]] function m.sendOnVehicleData(pParam, pExpTime, pValue) - if pExpTime == nil then pExpTime = 1 end - if pValue == nil then pValue = m.vdValues[pParam] end - m.getHMIConnection():SendNotification("VehicleInfo.OnVehicleData", { [pParam] = pValue }) - m.getMobileSession():ExpectNotification("OnVehicleData", { [pParam] = pValue }) - :Times(pExpTime) + return m.sendOnVehicleDataMultipleParams({ pParam }, pExpTime, { [pParam] = pValue }) +end + +--[[ @sendOnVehicleDataMultipleParams: Processing OnVehicleData RPC for multiple params +--! @parameters: +--! pParamsArray: array of names of VD parameters +--! pExpTimes: number of notifications (0, 1 or more) +--! pValueOverrides: table with values of parameters to override default test values +--! pDisallowedParam: param which SDL is expected to exclude when passing the notification to the app +--! @return: none +--]] +function m.sendOnVehicleDataMultipleParams(pParamsArray, pExpTimes, pValueOverrides, pDisallowedParam) + if pExpTimes == nil then pExpTimes = 1 end + if pValueOverrides == nil then pValueOverrides = {} end + local HMINotificationData = {} + local SDLNotificationData = {} + for _, param in pairs(pParamsArray) do + if pValueOverrides[param] == nil then + HMINotificationData[param] = m.vdValues[param] + else + HMINotificationData[param] = pValueOverrides[param] + end + if param ~= pDisallowedParam then + SDLNotificationData[param] = HMINotificationData[param] + end + end + m.getHMIConnection():SendNotification("VehicleInfo.OnVehicleData", HMINotificationData) + m.getMobileSession():ExpectNotification("OnVehicleData", SDLNotificationData) + :Times(pExpTimes) + :ValidIf(function(_, data) + if data.payload[pDisallowedParam] ~= nil then + return false, "Disallowed param '" .. pDisallowedParam .. "' is received by App" + end + return true + end) end --[[ @sendOnVehicleDataTwoApps: Processing OnVehicleData RPC for two apps @@ -501,8 +644,7 @@ function m.unregisterAppWithUnsubscription(pParam, pAppId, isRequestOnHMIExpecte dataType = m.vd[pParam], resultCode = "SUCCESS" } - local responseParam = pParam - if pParam == "clusterModeStatus" then responseParam = "clusterModes" end + local responseParam = getResponseParamName(pParam) if isRequestOnHMIExpected == true then m.getHMIConnection():ExpectRequest("VehicleInfo.UnsubscribeVehicleData", { [pParam] = true }) :Do(function(_,data) @@ -572,8 +714,7 @@ function m.registerAppWithResumption(pParam, pAppId, isRequestOnHMIExpected) dataType = m.vd[pParam], resultCode = "SUCCESS" } - local responseParam = pParam - if pParam == "clusterModeStatus" then responseParam = "clusterModes" end + local responseParam = getResponseParamName(pParam) m.getMobileSession(pAppId):StartService(7) :Do(function() local appParams = utils.cloneTable(actions.app.getParams(pAppId)) diff --git a/test_scripts/Defects/4_6/842_App_does_not_activate_when_policies_are_disabled.lua b/test_scripts/Defects/4_6/842_App_does_not_activate_when_policies_are_disabled.lua index 4f579e7f09..ecf90ce877 100644 --- a/test_scripts/Defects/4_6/842_App_does_not_activate_when_policies_are_disabled.lua +++ b/test_scripts/Defects/4_6/842_App_does_not_activate_when_policies_are_disabled.lua @@ -36,6 +36,10 @@ local function registerApp() hmiAppId = d1.params.application.appID end) common.getMobileSession():ExpectResponse(corId, { success = true, resultCode = "SUCCESS" }) + :Do(function() + common.getMobileSession():ExpectNotification("OnHMIStatus", + { hmiLevel = "NONE", audioStreamingState = "NOT_AUDIBLE", systemContext = "MAIN" }) + end) end) end diff --git a/test_scripts/Defects/5_0/2664_SDL_cut_off_parameters_related_to_RADIO_from_request_SetInteriorVD_CLIMATE.lua b/test_scripts/Defects/5_0/2664_SDL_cut_off_parameters_related_to_RADIO_from_request_SetInteriorVD_CLIMATE.lua new file mode 100644 index 0000000000..2854f50c9a --- /dev/null +++ b/test_scripts/Defects/5_0/2664_SDL_cut_off_parameters_related_to_RADIO_from_request_SetInteriorVD_CLIMATE.lua @@ -0,0 +1,63 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/smartdevicelink/sdl_core/issues/2664 +--------------------------------------------------------------------------------------------------- +-- Description: Check that SDL transfer request to HMI without parameters related to RADIO in case +-- app sends SetInteriorVehicleData(CLIMATE) request +-- +-- Precondition: +-- 1) SDL, HMI, Mobile session are started +-- 2) App is registered and activated +-- In case: +-- 1) RC app sends SetInteriorVehicleData(CLIMATE) request with parameters are related to RADIO module +-- SDL does: +-- - transfer request to HMI without data related to RADIO module +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local commonRC = require('test_scripts/RC/commonRC') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local moduleType = "CLIMATE" + +--[[ Local Functions ]] +local function cutOffParamsForAnotherModule() + local moduleData = commonRC.getSettableModuleControlData(moduleType) + moduleData.climateControlData.frequencyInteger = 10 -- frequencyInteger parameter is related to RADIO module + moduleData.radioControlData = { } + moduleData.radioControlData.frequencyInteger = 10 + + local cid = commonRC.getMobileSession():SendRPC("SetInteriorVehicleData", { moduleData = moduleData }) + commonRC.getHMIConnection():ExpectRequest("RC.SetInteriorVehicleData", { + appID = commonRC.getHMIAppId(), + moduleData = commonRC.getSettableModuleControlData(moduleType) + }) + :Do(function(_, data) + commonRC.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", { + moduleData = commonRC.getSettableModuleControlData(moduleType) + }) + end) + :ValidIf(function(_, data) + if data.params.moduleData.climateControlData.frequencyInteger or data.params.moduleData.radioControlData then + return false, "SDL transfers to HMI parameters not related to module" + end + return true + end) + + commonRC.getMobileSession():ExpectResponse(cid, { success = true, resultCode = "SUCCESS" }) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", commonRC.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", commonRC.start) +runner.Step("Register App", commonRC.registerAppWOPTU) +runner.Step("Activate App", commonRC.activateApp) + +runner.Title("Test") +runner.Step("SetInteriorVehicleData with params for another module in moduleData", cutOffParamsForAnotherModule) + +runner.Title("Postconditions") +runner.Step("Stop SDL", commonRC.postconditions) diff --git a/test_scripts/Defects/5_1/1393_ListFiles_from_enumerating_through_the_file_system.lua b/test_scripts/Defects/5_1/1393_ListFiles_from_enumerating_through_the_file_system.lua new file mode 100644 index 0000000000..fb26fb90fd --- /dev/null +++ b/test_scripts/Defects/5_1/1393_ListFiles_from_enumerating_through_the_file_system.lua @@ -0,0 +1,72 @@ +--------------------------------------------------------------------------------------------- +-- Issue: https://github.com/smartdevicelink/sdl_core/issues/1393 +-- +-- Description: Check that SDL responds to ListFiles request from enumerating through the file system +-- +-- Precondition: +-- 1) Core and HMI are started. +-- 2) Application is registered +-- 3) Upload the icon.png file +-- 4) App sends the ListFiles request to the SDL and receives a response with the icon.png file from the SDL +-- 5) System deletes icon.png file +-- Step: +-- 1) App sends the ListFiles request to the SDL +-- SDL does: +-- - send ListFiles response with an empty list to the App +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local common = require('user_modules/sequences/actions') +local runner = require('user_modules/script_runner') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local requestParams = { + syncFileName = "icon.png", + fileType = "GRAPHIC_PNG", + persistentFile = false, + systemFile = false +} + +--[[ Local Functions ]] +local function putFile() + local cid = common.getMobileSession():SendRPC("PutFile", requestParams ,"files/icon.png" ) + common.getMobileSession():ExpectResponse(cid, { success = true, resultCode = "SUCCESS" }) +end + +local function listFiles(pResult) + local cid = common.getMobileSession():SendRPC("ListFiles", {} ) + if pResult then + common.getMobileSession():ExpectResponse(cid, + { success = true, resultCode = "SUCCESS", filenames = { "icon.png" } }) + else + common.getMobileSession():ExpectResponse(cid, { success = true, resultCode = "SUCCESS" }) + :ValidIf (function(_,data) + if data.payload.filenames then + return false, "ListFiles response contains unexpected parameter 'filenames' \n" + end + return true + end) + end +end + +local function deleteFile() + os.remove(common.sdl.getPathToFileInStorage("icon.png")) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("Activate App", common.activateApp) +runner.Step("Upload icon.png file", putFile) + +runner.Title("Test") +runner.Step("ListFiles with the icon.png file", listFiles, { true }) +runner.Step("DeleteFile with the icon.png file", deleteFile) +runner.Step("ListFiles with an empty list", listFiles, { false }) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/Defects/6_1/1409_SDL_does_not_send_EndService_for_Video_Audio_Service_upon_IGNITION_OFF.lua b/test_scripts/Defects/6_1/1409_SDL_does_not_send_EndService_for_Video_Audio_Service_upon_IGNITION_OFF.lua index f97f71ebe1..ece91da575 100644 --- a/test_scripts/Defects/6_1/1409_SDL_does_not_send_EndService_for_Video_Audio_Service_upon_IGNITION_OFF.lua +++ b/test_scripts/Defects/6_1/1409_SDL_does_not_send_EndService_for_Video_Audio_Service_upon_IGNITION_OFF.lua @@ -16,6 +16,7 @@ local runner = require('user_modules/script_runner') local common = require('user_modules/sequences/actions') local constants = require("protocol_handler/ford_protocol_constants") local events = require('events') +local SDL = require('SDL') --[[ Test Configuration ]] runner.testSettings.isSelfIncluded = false @@ -90,6 +91,9 @@ local function ignitionOffwithEndServices() common.getHMIConnection():ExpectNotification("BasicCommunication.OnAppUnregistered", { unexpectedDisconnect = false }) common.getHMIConnection():ExpectNotification("BasicCommunication.OnSDLClose") + :Do(function() + SDL.DeleteFile() + end) common.getHMIConnection():SendNotification("BasicCommunication.OnExitAllApplications", { reason = "SUSPEND" }) end diff --git a/test_scripts/Defects/7_0/1903_Media_app_is_not_activated_during_active_embedded_navigation.lua b/test_scripts/Defects/7_0/1903_Media_app_is_not_activated_during_active_embedded_navigation.lua index 564e4ced76..a95d512449 100644 --- a/test_scripts/Defects/7_0/1903_Media_app_is_not_activated_during_active_embedded_navigation.lua +++ b/test_scripts/Defects/7_0/1903_Media_app_is_not_activated_during_active_embedded_navigation.lua @@ -33,13 +33,16 @@ local function embeddedNavigation() end local function activateMediaApp() + common.getMobileSession():ExpectNotification("OnHMIStatus", + { hmiLevel = "FULL", audioStreamingState = "AUDIBLE" }, + { hmiLevel = "LIMITED", audioStreamingState = "AUDIBLE" }) + :Times(2) local requestId = common.getHMIConnection():SendRequest("SDL.ActivateApp", { appID = common.getHMIAppId() }) common.getHMIConnection():ExpectResponse(requestId) :Do(function() common.getHMIConnection():SendNotification("BasicCommunication.OnEventChanged", { eventName = "EMBEDDED_NAVI", isActive = true }) end) - common.getMobileSession():ExpectNotification("OnHMIStatus", { hmiLevel = "FULL", audioStreamingState = "AUDIBLE" }) end --[[ Scenario ]] diff --git a/test_scripts/Defects/7_1/1585_AlertManeuver_UNSUPPORTED_RESOURCE_response_success.lua b/test_scripts/Defects/7_1/1585_AlertManeuver_UNSUPPORTED_RESOURCE_response_success.lua new file mode 100644 index 0000000000..42281c9185 --- /dev/null +++ b/test_scripts/Defects/7_1/1585_AlertManeuver_UNSUPPORTED_RESOURCE_response_success.lua @@ -0,0 +1,88 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/SmartDeviceLink/sdl_core/issues/1585 +--------------------------------------------------------------------------------------------------- +-- Description: HMI responds with UNSUPPORTED_RESOURCE resultCode to Navigation.AlertManeuver component +-- +-- Preconditions: +-- 1) Clean environment +-- 2) SDL, HMI, Mobile session are started +-- 3) App is registered +-- 4) App is activated +-- +-- Steps: +-- 1) Send AlertManeuver mobile RPC from app with parameter imageType = "STATIC" +-- 2) HMI responds with UNSUPPORTED_RESOURCE to Navigation.AlertManeuver request +-- +-- SDL does: +-- 1) Respond with 'AlertManeuver'(success = true, resultCode = "UNSUPPORTED_RESOURCE") to App +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require("user_modules/sequences/actions") + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local params = { + ttsChunks = { + { + type = "TEXT", + text = "Text to Speak" + } + }, + softButtons = { + { + systemAction = "DEFAULT_ACTION", + isHighlighted = true, + softButtonID = 5517, + type = "BOTH", + image = { + value = "icon.png", + imageType = "STATIC" + }, + text = "Close" + } + } +} + +--[[ Local Functions ]] +local function sendAlertManeuver() + local mobileSession = common.mobile.getSession() + local hmi = common.hmi.getConnection() + local dataToHMI = { + softButtons = params["softButtons"], + appID = common.app.getHMIId() + } + + local cid = mobileSession:SendRPC("AlertManeuver", params) + hmi:ExpectRequest("Navigation.AlertManeuver", dataToHMI) + :Do(function(_, data) + hmi:SendError(data.id, data.method, "UNSUPPORTED_RESOURCE", "Error message") + end) + + hmi:ExpectRequest("TTS.Speak", { speakType = "ALERT_MANEUVER" }) + :Do(function(_, data) + hmi:SendResponse(data.id, data.method, "SUCCESS", {}) + end) + mobileSession:ExpectResponse(cid, { success = true, resultCode = "UNSUPPORTED_RESOURCE" }) +end + +local function pTUpdateFunc(tbl) + tbl.policy_table.app_policies[common.app.getParams().fullAppID].groups = { "Base-4", "Navigation-1" } +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("Register App", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { pTUpdateFunc }) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("App sends AlertManeuver", sendAlertManeuver) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/Defects/7_1/1619_AlertManeuer_empty_SoftButtons_missing_Info.lua b/test_scripts/Defects/7_1/1619_AlertManeuer_empty_SoftButtons_missing_Info.lua new file mode 100644 index 0000000000..0a114414ba --- /dev/null +++ b/test_scripts/Defects/7_1/1619_AlertManeuer_empty_SoftButtons_missing_Info.lua @@ -0,0 +1,75 @@ +-------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/SmartDeviceLink/sdl_core/issues/1619 +--------------------------------------------------------------------------------------------------- +-- Description: HMI responds with valid AlertManeuver response (empty parameter "info") +-- to the request RPC AlertManeuer with empty softbuttons +-- +-- Preconditions: +-- 1) Clean environment +-- 2) SDL, HMI, Mobile session are started +-- 3) App is registered +-- 4) PTU has been performed +-- 5) App is activated +-- +-- Steps: +-- 1) Send AlertManeuver mobile RPC from app with parameter softButtons = [] +-- 2) HMI responds with SUCCESS to Navigation.AlertManeuver request +-- +-- SDL does: +-- 1) respond with AlertManeuver(success = true, resultCode = "SUCCESS") +-- and missing parameter "info" to App +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require("user_modules/sequences/actions") + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local params = { + softButtons = common.json.EMPTY_ARRAY +} + +--[[ Local Functions ]] +local function sendAlertManeuver() + local mobileSession = common.mobile.getSession() + local hmi = common.hmi.getConnection() + local dataToHMI = { + softButtons = nil, + appID = common.app.getHMIId() + } + + local cid = mobileSession:SendRPC("AlertManeuver", params) + hmi:ExpectRequest("Navigation.AlertManeuver", dataToHMI) + :Do(function(_, data) + hmi:SendResponse(data.id, data.method, "SUCCESS", {}) + end) + + mobileSession:ExpectResponse(cid, { success = true, resultCode = "SUCCESS" }) + :ValidIf(function(_,data) + if data.payload.info then + return false, "Mobile response contains not expected info param" + end + return true + end) +end + +local function pTUpdateFunc(tbl) + tbl.policy_table.app_policies[common.app.getParams().fullAppID].groups = { "Base-4", "Navigation-1" } +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("Register App", common.registerApp) +runner.Step("PTU", common.policyTableUpdate, { pTUpdateFunc }) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("App sends AlertManeuver", sendAlertManeuver) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/Defects/7_1/3580_Revoked_app_activated_via_device_consent.lua b/test_scripts/Defects/7_1/3580_Revoked_app_activated_via_device_consent.lua index 232c3a17f2..547654f0ce 100644 --- a/test_scripts/Defects/7_1/3580_Revoked_app_activated_via_device_consent.lua +++ b/test_scripts/Defects/7_1/3580_Revoked_app_activated_via_device_consent.lua @@ -49,7 +49,7 @@ local function activateApp(pAppId) }}) :Do(function(_,_) local RequestId1 = common.getHMIConnection():SendRequest("SDL.GetUserFriendlyMessage", {language = "EN-US", messageCodes = {"DataConsent"}}) - local RequestId2 = common.getHMIConnection():SendRequest("SDL.GetUserFriendlyMessage", {language = "EN-US", messageCodes = {"AppUnsupported"}}) + local RequestId2 = common.getHMIConnection():SendRequest("SDL.GetUserFriendlyMessage", {language = "EN-US", messageCodes = {"AppUnauthorized"}}) common.getHMIConnection():ExpectResponse(RequestId1, {result = {code = 0, method = "SDL.GetUserFriendlyMessage"}}) :Do(function(_,_) diff --git a/test_scripts/Defects/7_1/885_ShowConstantTBT.lua b/test_scripts/Defects/7_1/885_ShowConstantTBT.lua index 41a6d06b75..1851cf26f4 100644 --- a/test_scripts/Defects/7_1/885_ShowConstantTBT.lua +++ b/test_scripts/Defects/7_1/885_ShowConstantTBT.lua @@ -1,7 +1,8 @@ --------------------------------------------------------------------------------------------------- --- Issue: https://github.com/SmartDeviceLink/sdl_core/issues/885 +-- Issue: https://github.com/SmartDeviceLink/sdl_core/issues/885, +-- https://github.com/smartdevicelink/sdl_core/issues/3829 --------------------------------------------------------------------------------------------------- --- Description: Check that SDL stops processing softButton events once a response is received for the RPC. +-- Description: Check that SDL does not stop processing softButton events once a response is received for the RPC. -- 'ShowConstantTBT' scenario. -- -- Steps: @@ -17,7 +18,7 @@ -- - transfer response to the App -- 5. HMI sends 'OnButtonEvent' and 'OnButtonPress' notifications -- SDL does: --- - not transfer notifications to the App +-- - transfer notifications to the App --------------------------------------------------------------------------------------------------- --[[ Required Shared libraries ]] local runner = require('user_modules/script_runner') @@ -27,9 +28,6 @@ local common = require('user_modules/sequences/actions') runner.testSettings.isSelfIncluded = false --[[ Local Variables ]] -local expected = true -local not_expected = false - local btn = { id = 4, name = "CUSTOM_BUTTON" @@ -42,26 +40,25 @@ local params = { } --[[ Local Functions ]] -local function sendOnButtonEvents(pIsExp) - local times = pIsExp == true and 1 or 0 +local function sendOnButtonEvents() common.getHMIConnection():SendNotification("Buttons.OnButtonEvent", { name = btn.name, mode = "BUTTONDOWN", customButtonID = btn.id, appID = common.getHMIAppId() }) common.getHMIConnection():SendNotification("Buttons.OnButtonPress", { name = btn.name, mode = "SHORT", customButtonID = btn.id, appID = common.getHMIAppId() }) - common.getMobileSession():ExpectNotification("OnButtonEvent", - { buttonName = btn.name, buttonEventMode = "BUTTONDOWN", customButtonID = btn.id }) - :Times(times) - common.getMobileSession():ExpectNotification("OnButtonPress", - { buttonName = btn.name, buttonPressMode = "SHORT", customButtonID = btn.id } ) - :Times(times) end local function showConstantTBT() local cid = common.getMobileSession():SendRPC("ShowConstantTBT", params) + common.getMobileSession():ExpectNotification("OnButtonEvent", + { buttonName = btn.name, buttonEventMode = "BUTTONDOWN", customButtonID = btn.id }) + :Times(2) + common.getMobileSession():ExpectNotification("OnButtonPress", + { buttonName = btn.name, buttonPressMode = "SHORT", customButtonID = btn.id }) + :Times(2) common.getHMIConnection():ExpectRequest("Navigation.ShowConstantTBT") :Do(function(_, data) common.run.runAfter(function() - sendOnButtonEvents(expected) + sendOnButtonEvents() end, 500) common.run.runAfter(function() common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", {}) @@ -69,7 +66,7 @@ local function showConstantTBT() end) common.getMobileSession():ExpectResponse(cid, { success = true, resultCode = "SUCCESS" }) :Do(function() - sendOnButtonEvents(not_expected) + sendOnButtonEvents() end) end diff --git a/test_scripts/Defects/7_1/885_UpdateTurnList.lua b/test_scripts/Defects/7_1/885_UpdateTurnList.lua index b1c2732177..510631e4e3 100644 --- a/test_scripts/Defects/7_1/885_UpdateTurnList.lua +++ b/test_scripts/Defects/7_1/885_UpdateTurnList.lua @@ -1,7 +1,8 @@ --------------------------------------------------------------------------------------------------- --- Issue: https://github.com/SmartDeviceLink/sdl_core/issues/885 +-- Issue: https://github.com/SmartDeviceLink/sdl_core/issues/885, +-- https://github.com/smartdevicelink/sdl_core/issues/3829 --------------------------------------------------------------------------------------------------- --- Description: Check that SDL stops processing softButton events once a response is received for the RPC. +-- Description: Check that SDL does not stop processing softButton events once a response is received for the RPC. -- 'UpdateTurnList' scenario. -- -- Steps: @@ -17,7 +18,7 @@ -- - transfer response to the App -- 5. HMI sends 'OnButtonEvent' and 'OnButtonPress' notifications -- SDL does: --- - not transfer notifications to the App +-- - transfer notifications to the App --------------------------------------------------------------------------------------------------- --[[ Required Shared libraries ]] local runner = require('user_modules/script_runner') @@ -27,9 +28,6 @@ local common = require('user_modules/sequences/actions') runner.testSettings.isSelfIncluded = false --[[ Local Variables ]] -local expected = true -local not_expected = false - local btn = { id = 4, name = "CUSTOM_BUTTON" @@ -41,26 +39,25 @@ local params = { } --[[ Local Functions ]] -local function sendOnButtonEvents(pIsExp) - local times = pIsExp == true and 1 or 0 +local function sendOnButtonEvents() common.getHMIConnection():SendNotification("Buttons.OnButtonEvent", { name = btn.name, mode = "BUTTONDOWN", customButtonID = btn.id, appID = common.getHMIAppId() }) common.getHMIConnection():SendNotification("Buttons.OnButtonPress", { name = btn.name, mode = "SHORT", customButtonID = btn.id, appID = common.getHMIAppId() }) - common.getMobileSession():ExpectNotification("OnButtonEvent", - { buttonName = btn.name, buttonEventMode = "BUTTONDOWN", customButtonID = btn.id }) - :Times(times) - common.getMobileSession():ExpectNotification("OnButtonPress", - { buttonName = btn.name, buttonPressMode = "SHORT", customButtonID = btn.id } ) - :Times(times) end local function updateTurnList() local cid = common.getMobileSession():SendRPC("UpdateTurnList", params) + common.getMobileSession():ExpectNotification("OnButtonEvent", + { buttonName = btn.name, buttonEventMode = "BUTTONDOWN", customButtonID = btn.id }) + :Times(2) + common.getMobileSession():ExpectNotification("OnButtonPress", + { buttonName = btn.name, buttonPressMode = "SHORT", customButtonID = btn.id }) + :Times(2) common.getHMIConnection():ExpectRequest("Navigation.UpdateTurnList") :Do(function(_, data) common.run.runAfter(function() - sendOnButtonEvents(expected) + sendOnButtonEvents() end, 500) common.run.runAfter(function() common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", {}) @@ -68,7 +65,7 @@ local function updateTurnList() end) common.getMobileSession():ExpectResponse(cid, { success = true, resultCode = "SUCCESS" }) :Do(function() - sendOnButtonEvents(not_expected) + sendOnButtonEvents() end) end diff --git a/test_scripts/Defects/8_0/2810_1_unexpected_disconnect_during_audio_streaming.lua b/test_scripts/Defects/8_0/2810_1_unexpected_disconnect_during_audio_streaming.lua new file mode 100644 index 0000000000..976230948c --- /dev/null +++ b/test_scripts/Defects/8_0/2810_1_unexpected_disconnect_during_audio_streaming.lua @@ -0,0 +1,44 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/smartdevicelink/sdl_core/issues/2810 +--------------------------------------------------------------------------------------------------- +-- Description: Check that SDL sends required messages for a streaming stop during unexpected app unregistration +-- +-- Steps: +-- 1. Core and HMI are started +-- 2. Mobile app is registered and activated +-- 3. Mobile app starts audio service and streaming +-- 4. Connection is closed +-- SDL does: +-- 1. send Navigation.OnAudioDataStreaming(available=false) and Navigation.StopAudioStream to HMI to stop streaming +-- 2. send BasicCommunication.OnAppUnregistered to HMI +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/Defects/8_0/common_3479_2810') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local serviceType = common.services.audio + +--[[ Local Functions ]] +local function appStartStreaming() + common.run.wait(5000) + common.startStreaming(serviceType) +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("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("App starts audio streaming", appStartStreaming) +runner.Step("Unexpected disconnect", common.unexpectedDisconnect, { serviceType }) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/Defects/8_0/2810_2_unexpected_disconnect_during_video_streaming.lua b/test_scripts/Defects/8_0/2810_2_unexpected_disconnect_during_video_streaming.lua new file mode 100644 index 0000000000..0a7118f284 --- /dev/null +++ b/test_scripts/Defects/8_0/2810_2_unexpected_disconnect_during_video_streaming.lua @@ -0,0 +1,44 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/smartdevicelink/sdl_core/issues/2810 +--------------------------------------------------------------------------------------------------- +-- Description: Check that SDL sends required messages for a streaming stop during unexpected app unregistration +-- +-- Steps: +-- 1. Core and HMI are started +-- 2. Mobile app is registered and activated +-- 3. Mobile app starts video service and streaming +-- 4. Connection is closed +-- SDL does: +-- 1. send Navigation.OnVideoDataStreaming(available=false) and Navigation.StopStream to HMI to stop streaming +-- 2. send BasicCommunication.OnAppUnregistered to HMI +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/Defects/8_0/common_3479_2810') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local serviceType = common.services.video + +--[[ Local Functions ]] +local function appStartStreaming() + common.run.wait(5000) + common.startStreaming(serviceType) +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("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("App starts video streaming", appStartStreaming) +runner.Step("Unexpected disconnect", common.unexpectedDisconnect, { serviceType }) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/Defects/8_0/2810_3_unexpected_disconnect_during_video_and_audio_streaming.lua b/test_scripts/Defects/8_0/2810_3_unexpected_disconnect_during_video_and_audio_streaming.lua new file mode 100644 index 0000000000..32eb9c8a26 --- /dev/null +++ b/test_scripts/Defects/8_0/2810_3_unexpected_disconnect_during_video_and_audio_streaming.lua @@ -0,0 +1,71 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/smartdevicelink/sdl_core/issues/2810 +--------------------------------------------------------------------------------------------------- +-- Description: Check that SDL sends required messages for a streaming stop during unexpected app unregistration +-- +-- Steps: +-- 1. Core and HMI are started +-- 2. Mobile app is registered and activated +-- 3. Mobile app starts video and audio services and streamings +-- 4. Connection is closed +-- SDL does: +-- 1. send Navigation.OnVideoDataStreaming(available=false) and Navigation.StopStream to HMI to stop video streaming +-- 2. send Navigation.OnAudioDataStreaming(available=false) and Navigation.StopAudioStream to HMI +-- to stop audio streaming +-- 3. send BasicCommunication.OnAppUnregistered to HMI +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/Defects/8_0/common_3479_2810') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local videoService = common.services.video +local audioService = common.services.audio + +--[[ Local Functions ]] +local function appStartStreaming() + common.run.wait(5000) + common.startStreaming(videoService) + common.startStreaming(audioService) +end + +local function unexpectedDisconnect() + common.disconnect() + common.getHMIConnection():ExpectNotification(videoService.notif, { available = false }) + :Do(function(_, data) common.log(common.ld[2], data.method, data.params.available) end) + common.getHMIConnection():ExpectNotification(audioService.notif, { available = false }) + :Do(function(_, data) common.log(common.ld[2], data.method, data.params.available) end) + common.getHMIConnection():ExpectRequest(videoService.stopRpc, { appID = common.getHMIId() }) + :Do(function(_, data) + common.log(common.ld[2], data.method) + common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", { }) + common.log(common.ld[3], "SUCCESS:", data.method) + end) + common.getHMIConnection():ExpectRequest(audioService.stopRpc, { appID = common.getHMIId() }) + :Do(function(_, data) + common.log(common.ld[2], data.method) + common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", { }) + common.log(common.ld[3], "SUCCESS:", data.method) + end) + common.getHMIConnection():ExpectNotification("BasicCommunication.OnAppUnregistered", + { appID = common.getHMIId(), unexpectedDisconnect = true }) + :Do(function() common.log(common.ld[2], "OnAppUnregistered") 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("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("App starts video and audio streaming", appStartStreaming) +runner.Step("Unexpected disconnect", unexpectedDisconnect) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/Defects/8_0/2957_Consent_func_group.lua b/test_scripts/Defects/8_0/2957_Consent_func_group.lua new file mode 100644 index 0000000000..fcbc0daeb9 --- /dev/null +++ b/test_scripts/Defects/8_0/2957_Consent_func_group.lua @@ -0,0 +1,142 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/smartdevicelink/sdl_core/issues/2957 +--------------------------------------------------------------------------------------------------- +-- Description: SDL has to proceed with 'OnAppPermissionConsent' notification from HMI in case: +-- - it sends with or without AppId +-- - regardless of preceding 'GetListOfPermissions' request/response +-- +-- Preconditions: +-- 1) SDL and HMI are started +-- 2) Mobile is connected to SDL and is consented +-- 3) RPC Show exists only in 'Group001' according policies and requires user consent +-- 4) Application App1 is registered +-- Application App2 is registered +-- +-- Steps: +-- 1) User allows 'Group001' for all applications (HMI sends SDL.OnAppPermissionConsent without 'appID') +-- 2) Each of 2 apps sends valid Show RPC request +-- SDL does: +-- - proceed with Show request successfully for both apps +--------------------------------------------------------------------------------------------------- +--[[ 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 +runner.testSettings.restrictions.sdlBuildOptions = {{ extendedPolicy = {"EXTERNAL_PROPRIETARY" }}} + +--[[ Local Variables ]] +local testCases = { + [01] = { getLOP = nil, onAPC = nil, appExpRpc = { [1] = "DISALLOWED", [2] = "DISALLOWED" }}, + + [02] = { getLOP = { appId = nil }, onAPC = nil, appExpRpc = { [1] = "DISALLOWED", [2] = "DISALLOWED" }}, + [03] = { getLOP = { appId = 1 }, onAPC = nil, appExpRpc = { [1] = "DISALLOWED", [2] = "DISALLOWED" }}, + [04] = { getLOP = { appId = 2 }, onAPC = nil, appExpRpc = { [1] = "DISALLOWED", [2] = "DISALLOWED" }}, + + [05] = { getLOP = nil, onAPC = { appId = nil }, appExpRpc = { [1] = "SUCCESS", [2] = "SUCCESS" }}, + [06] = { getLOP = nil, onAPC = { appId = 1 }, appExpRpc = { [1] = "SUCCESS", [2] = "DISALLOWED" }}, + [07] = { getLOP = nil, onAPC = { appId = 2 }, appExpRpc = { [1] = "DISALLOWED", [2] = "SUCCESS" }}, + + [08] = { getLOP = { appId = nil }, onAPC = { appId = nil }, appExpRpc = { [1] = "SUCCESS", [2] = "SUCCESS" }}, + [09] = { getLOP = { appId = nil }, onAPC = { appId = 1 }, appExpRpc = { [1] = "SUCCESS", [2] = "DISALLOWED" }}, + [10] = { getLOP = { appId = nil }, onAPC = { appId = 2 }, appExpRpc = { [1] = "DISALLOWED", [2] = "SUCCESS" }}, + + [11] = { getLOP = { appId = 1 }, onAPC = { appId = nil }, appExpRpc = { [1] = "SUCCESS", [2] = "SUCCESS" }}, + [12] = { getLOP = { appId = 1 }, onAPC = { appId = 1 }, appExpRpc = { [1] = "SUCCESS", [2] = "DISALLOWED" }}, + [13] = { getLOP = { appId = 1 }, onAPC = { appId = 2 }, appExpRpc = { [1] = "DISALLOWED", [2] = "SUCCESS" }}, + + [14] = { getLOP = { appId = 2 }, onAPC = { appId = nil }, appExpRpc = { [1] = "SUCCESS", [2] = "SUCCESS" }}, + [15] = { getLOP = { appId = 2 }, onAPC = { appId = 1 }, appExpRpc = { [1] = "SUCCESS", [2] = "DISALLOWED" }}, + [16] = { getLOP = { appId = 2 }, onAPC = { appId = 2 }, appExpRpc = { [1] = "DISALLOWED", [2] = "SUCCESS" }} +} + +--[[ Local Functions ]] +local function updatePreloadedPT() + local preloadedTable = common.sdl.getPreloadedPT() + local pt = preloadedTable.policy_table + pt.functional_groupings["DataConsent-2"].rpcs = common.json.null + local ptFuncGroup = { + Group001 = { + user_consent_prompt = "ConsentGroup001", + rpcs = { + Show = { + hmi_levels = { "BACKGROUND", "FULL", "LIMITED", "NONE" } + } + } + } + } + for funcGroupName in pairs(pt.functional_groupings) do + if type(pt.functional_groupings[funcGroupName].rpcs) == "table" then + pt.functional_groupings[funcGroupName].rpcs["Show"] = nil + end + end + pt.functional_groupings["DataConsent-2"].rpcs = common.json.null + pt.functional_groupings["Group001"] = ptFuncGroup.Group001 + local appPolicies = utils.cloneTable(pt.app_policies["default"]) + appPolicies.groups = { "Base-4", "Group001" } + pt.app_policies[common.app.getParams(1).fullAppID] = appPolicies + pt.app_policies[common.app.getParams(2).fullAppID] = utils.cloneTable(appPolicies) + common.sdl.setPreloadedPT(preloadedTable) +end + +local function sendGetListOfPermissions(pAppId) + local hmiAppID = nil + if pAppId then hmiAppID = common.app.getHMIId(pAppId) end + local corId = common.hmi.getConnection():SendRequest("SDL.GetListOfPermissions", { appID = hmiAppID}) + common.hmi.getConnection():ExpectResponse(corId) +end + +local function sendOnAppPermissionConsent(pAppId) + local hmiAppID = nil + if pAppId then hmiAppID = common.app.getHMIId(pAppId) end + common.hmi.getConnection():SendNotification("SDL.OnAppPermissionConsent", { + appID = hmiAppID, + source = "GUI", + consentedFunctions = { { allowed = true, id = 1423208483, name = "ConsentGroup001"} } + }) + common.mobile.getSession(pAppId):ExpectNotification("OnPermissionsChange") +end + +local function show(pAppId, pResultCode) + local isSuccess = false + if pResultCode == "SUCCESS" then + isSuccess = true + end + + local mobileSession = common.mobile.getSession(pAppId) + local corId = mobileSession:SendRPC("Show", { mediaClock = "00:00:01", mainField1 = "Show1" }) + if pResultCode == "SUCCESS" then + common.hmi.getConnection():ExpectRequest("UI.Show") + :Do(function(_,data) + common.hmi.getConnection():SendResponse(data.id, "UI.Show", "SUCCESS", {}) + end) + end + mobileSession:ExpectResponse(corId, { success = isSuccess, resultCode = pResultCode}) +end + +--[[ Scenario ]] + +for i, tc in utils.spairs(testCases) do + runner.Title("Test case "..i) + runner.Title("Preconditions") + runner.Step("Clean environment", common.preconditions) + runner.Step("Prepare preloaded PT", updatePreloadedPT) + runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) + runner.Step("Register App1", common.app.registerNoPTU, { 1 }) + runner.Step("Register App2", common.app.registerNoPTU, { 2 }) + + runner.Title("Test") + if tc.getLOP then + runner.Step("GetListOfPermissions", sendGetListOfPermissions, { tc.getLOP.appId }) + end + if tc.onAPC then + runner.Step("Allow group Group001 for all Apps", sendOnAppPermissionConsent, { tc.onAPC.appId }) + end + runner.Step("Successful Show from App1", show, { 1, tc.appExpRpc[1] }) + runner.Step("Successful Show from App2", show, { 2, tc.appExpRpc[2] }) + + runner.Title("Postconditions") + runner.Step("Stop SDL", common.postconditions) +end diff --git a/test_scripts/Defects/8_0/3479_1_Audio-Video_streaming_same_time_no_response_from_HMI_for_Audio.lua b/test_scripts/Defects/8_0/3479_1_Audio-Video_streaming_same_time_no_response_from_HMI_for_Audio.lua index 2135a94f1b..625741edb2 100644 --- a/test_scripts/Defects/8_0/3479_1_Audio-Video_streaming_same_time_no_response_from_HMI_for_Audio.lua +++ b/test_scripts/Defects/8_0/3479_1_Audio-Video_streaming_same_time_no_response_from_HMI_for_Audio.lua @@ -21,7 +21,7 @@ --------------------------------------------------------------------------------------------------- --[[ Required Shared libraries ]] local runner = require('user_modules/script_runner') -local common = require('test_scripts/Defects/8_0/common_3479') +local common = require('test_scripts/Defects/8_0/common_3479_2810') --[[ Test Configuration ]] runner.testSettings.isSelfIncluded = false diff --git a/test_scripts/Defects/8_0/3479_2_Audio-Video_streaming_same_time_no_response_from_HMI_for_Video.lua b/test_scripts/Defects/8_0/3479_2_Audio-Video_streaming_same_time_no_response_from_HMI_for_Video.lua index dc89199b9a..1c2a9cfad4 100644 --- a/test_scripts/Defects/8_0/3479_2_Audio-Video_streaming_same_time_no_response_from_HMI_for_Video.lua +++ b/test_scripts/Defects/8_0/3479_2_Audio-Video_streaming_same_time_no_response_from_HMI_for_Video.lua @@ -21,7 +21,7 @@ --------------------------------------------------------------------------------------------------- --[[ Required Shared libraries ]] local runner = require('user_modules/script_runner') -local common = require('test_scripts/Defects/8_0/common_3479') +local common = require('test_scripts/Defects/8_0/common_3479_2810') --[[ Test Configuration ]] runner.testSettings.isSelfIncluded = false diff --git a/test_scripts/Defects/8_0/3479_3_Audio-Video_streaming_delayed_no_response_from_HMI_for_Audio.lua b/test_scripts/Defects/8_0/3479_3_Audio-Video_streaming_delayed_no_response_from_HMI_for_Audio.lua index 49795ffe27..fbaeb2cf5c 100644 --- a/test_scripts/Defects/8_0/3479_3_Audio-Video_streaming_delayed_no_response_from_HMI_for_Audio.lua +++ b/test_scripts/Defects/8_0/3479_3_Audio-Video_streaming_delayed_no_response_from_HMI_for_Audio.lua @@ -24,7 +24,7 @@ --------------------------------------------------------------------------------------------------- --[[ Required Shared libraries ]] local runner = require('user_modules/script_runner') -local common = require('test_scripts/Defects/8_0/common_3479') +local common = require('test_scripts/Defects/8_0/common_3479_2810') --[[ Test Configuration ]] runner.testSettings.isSelfIncluded = false diff --git a/test_scripts/Defects/8_0/3479_4_Audio-Video_streaming_delayed_no_response_from_HMI_for_Video.lua b/test_scripts/Defects/8_0/3479_4_Audio-Video_streaming_delayed_no_response_from_HMI_for_Video.lua index d3157f2ee4..15bf64bf11 100644 --- a/test_scripts/Defects/8_0/3479_4_Audio-Video_streaming_delayed_no_response_from_HMI_for_Video.lua +++ b/test_scripts/Defects/8_0/3479_4_Audio-Video_streaming_delayed_no_response_from_HMI_for_Video.lua @@ -24,7 +24,7 @@ --------------------------------------------------------------------------------------------------- --[[ Required Shared libraries ]] local runner = require('user_modules/script_runner') -local common = require('test_scripts/Defects/8_0/common_3479') +local common = require('test_scripts/Defects/8_0/common_3479_2810') --[[ Test Configuration ]] runner.testSettings.isSelfIncluded = false diff --git a/test_scripts/Defects/8_0/3674_2_HMI_starts_PTU_before_UpdateAppList.lua b/test_scripts/Defects/8_0/3674_2_HMI_starts_PTU_before_UpdateAppList.lua index 5d586f8ce4..482b7aee25 100644 --- a/test_scripts/Defects/8_0/3674_2_HMI_starts_PTU_before_UpdateAppList.lua +++ b/test_scripts/Defects/8_0/3674_2_HMI_starts_PTU_before_UpdateAppList.lua @@ -29,6 +29,8 @@ local policyModes = { H = "HTTP" } +local propEvent = common.run.createEvent() + --[[ Local Functions ]] local function getPTUFromPTS() local pTbl = common.sdl.getPTS() @@ -68,27 +70,18 @@ local function policyTableUpdateProprietary() for i, _ in pairs(common.mobile.getApps()) do ptuTable.policy_table.app_policies[common.app.getPolicyAppId(i)] = common.ptu.getAppData(i) end - if pPTUpdateFunc then - pPTUpdateFunc(ptuTable) - end utils.tableToJsonFile(ptuTable, ptuFileName) end) - - local lsEvent = common.run.createEvent() - common.getHMIConnection():ExpectEvent(lsEvent, "Lock Screen URL event") local ptuEvent = common.run.createEvent() common.getHMIConnection():ExpectEvent(ptuEvent, "PTU event") for id, _ in pairs(common.mobile.getApps()) do - common.getMobileSession(id):ExpectNotification("OnSystemRequest") - :Do(function(_, d2) - if d2.payload.requestType == "PROPRIETARY" then + common.getHMIConnection():ExpectEvent(propEvent, "PROPRIETARY") + :Do(function() common.getHMIConnection():ExpectRequest("BasicCommunication.SystemRequest", { requestType = "PROPRIETARY" }) :Do(function(_, d3) - if not pExpNotificationFunc then - common.getHMIConnection():ExpectRequest("VehicleInfo.GetVehicleData", { odometer = true }) - common.getHMIConnection():ExpectNotification("SDL.OnStatusUpdate", { status = "UP_TO_DATE" }) - end + common.getHMIConnection():ExpectRequest("VehicleInfo.GetVehicleData", { odometer = true }) + common.getHMIConnection():ExpectNotification("SDL.OnStatusUpdate", { status = "UP_TO_DATE" }) common.getHMIConnection():SendResponse(d3.id, "BasicCommunication.SystemRequest", "SUCCESS", { }) common.getHMIConnection():SendNotification("SDL.OnReceivedPolicyUpdate", { policyfile = d3.params.fileName }) end) @@ -98,11 +91,7 @@ local function policyTableUpdateProprietary() requestType = "PROPRIETARY" }, ptuFileName) common.getMobileSession(id):ExpectResponse(corIdSystemRequest, { success = true, resultCode = "SUCCESS" }) :Do(function() os.remove(ptuFileName) end) - elseif d2.payload.requestType == "LOCK_SCREEN_ICON_URL" then - common.getHMIConnection():RaiseEvent(lsEvent, "Lock Screen URL event") - end end) - :Times(AtMost(2)) end end @@ -113,32 +102,36 @@ local function policyTableUpdateHttp() ptuTable.policy_table.app_policies[common.app.getPolicyAppId(i)] = common.ptu.getAppData(i) end utils.tableToJsonFile(ptuTable, ptuFileName) - if not pExpNotificationFunc then - common.getHMIConnection():ExpectRequest("VehicleInfo.GetVehicleData", { odometer = true }) - common.getHMIConnection():ExpectNotification("SDL.OnStatusUpdate", - { status = "UPDATE_NEEDED" }, { status = "UPDATING" }, { status = "UP_TO_DATE" }):Times(3) - end - local cid = common.getMobileSession(ptuAppNum):SendRPC("SystemRequest", - { requestType = "HTTP", fileName = "PolicyTableUpdate" }, ptuFileName) - common.getMobileSession(ptuAppNum):ExpectResponse(cid, { success = true, resultCode = "SUCCESS" }) - :Do(function() os.remove(ptuFileName) end) + + common.getHMIConnection():ExpectRequest("VehicleInfo.GetVehicleData", { odometer = true }) + common.getHMIConnection():ExpectNotification("SDL.OnStatusUpdate", + { status = "UPDATE_NEEDED" }, { status = "UPDATING" }, { status = "UP_TO_DATE" }):Times(3) + + common.getMobileSession():ExpectNotification("OnSystemRequest") + :Do(function(_, d) + if d.payload.requestType == "HTTP" then + local cid = common.getMobileSession():SendRPC("SystemRequest", + { requestType = "HTTP", fileName = "PolicyTableUpdate" }, ptuFileName) + common.getMobileSession():ExpectResponse(cid, { success = true, resultCode = "SUCCESS" }) + :Do(function() os.remove(ptuFileName) end) + end + end) + :Times(AtMost(2)) end local function policyTableUpdate() - if pExpNotificationFunc then - pExpNotificationFunc() - end local policyMode = SDL.buildOptions.extendedPolicy if policyMode == policyModes.P or policyMode == policyModes.EP then - policyTableUpdateProprietary(pPTUpdateFunc, pExpNotificationFunc) + policyTableUpdateProprietary() elseif policyMode == policyModes.H then - policyTableUpdateHttp(pPTUpdateFunc, pExpNotificationFunc) + policyTableUpdateHttp() end end local function registerAppWithPTU(pAppId, pMobConnId) if not pAppId then pAppId = 1 end if not pMobConnId then pMobConnId = 1 end + local session = common.mobile.createSession(pAppId, pMobConnId) session:StartService(7) :Do(function() @@ -155,6 +148,20 @@ local function registerAppWithPTU(pAppId, pMobConnId) { hmiLevel = "NONE", audioStreamingState = "NOT_AUDIBLE", systemContext = "MAIN" }) session:ExpectNotification("OnPermissionsChange") :Times(AnyNumber()) + local policyMode = SDL.buildOptions.extendedPolicy + if policyMode == policyModes.P or policyMode == policyModes.EP then + local lsEvent = common.run.createEvent() + common.getHMIConnection():ExpectEvent(lsEvent, "Lock Screen URL event") + session:ExpectNotification("OnSystemRequest") + :Do(function(_, d2) + if d2.payload.requestType == "LOCK_SCREEN_ICON_URL" then + common.getHMIConnection():RaiseEvent(lsEvent, "Lock Screen URL event") + elseif d2.payload.requestType == "PROPRIETARY" then + common.getHMIConnection():RaiseEvent(propEvent, "PROPRIETARY") + end + end) + :Times(2) + end end) end) end diff --git a/test_scripts/Defects/8_0/3783_crash_during_vr_langchange.lua b/test_scripts/Defects/8_0/3783_crash_during_vr_langchange.lua new file mode 100644 index 0000000000..1e7a9f38fe --- /dev/null +++ b/test_scripts/Defects/8_0/3783_crash_during_vr_langchange.lua @@ -0,0 +1,80 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/SmartDeviceLink/sdl_core/issues/3783 +--------------------------------------------------------------------------------------------------- +-- Description: A crash occurs during registration (occurance: about 1%) +-- +-- Steps: +-- 1. Change VR language to FR-CA +-- 2. Connect EN-US apps +-- 4. Quickly register 5 apps and then unregister them +-- 3. Change VR language to FR-CA +-- 4. Quickly register 5 apps and then unregister them +-- SDL does: +-- - not crash +--------------------------------------------------------------------------------------------------- +--[[ 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 Variables ]] + +--[[ Local Functions ]] +local function registerApp(pAppId) + local session = common.getMobileSession(pAppId, 1) + session:StartService(7) + :Do(function() + local corId = session:SendRPC("RegisterAppInterface", common.app.getParams(pAppId)) + common.hmi.getConnection():ExpectNotification("BasicCommunication.OnAppRegistered", + { application = { appName = common.app.getParams(pAppId).appName } }) + :Do(function(_, d1) + common.app.setHMIId(d1.params.application.appID, pAppId) + end) + session:ExpectResponse(corId, { success = true }) + :Do(function() + session:ExpectNotification("OnHMIStatus", + { hmiLevel = "NONE", audioStreamingState = "NOT_AUDIBLE", systemContext = "MAIN" }) + session:ExpectNotification("OnPermissionsChange") + :Times(AnyNumber()) + end) + end) + end + +local function changeHMILanguage(iface, lang) + local hmi = common.hmi.getConnection() + hmi:SendNotification(iface .. ".OnLanguageChange", { language = lang }) + utils.wait(500) +end + +local function registerAllApps() + for i = 1,5 do + common.getMobileSession(i, 1):SendRPC("RegisterAppInterface", common.app.getParams(i)) + end + utils.wait(250) +end + +local function checkCrashed() + if not common.sdl.isRunning() then common.run.fail("SDL crashed") end +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, init HMI", common.start) +runner.Step("Change UI Language to FR-CA", changeHMILanguage, { "UI", "FR-CA" }) +runner.Step("Register App 1", registerApp, { 1 }) +runner.Step("Register App 2", registerApp, { 2 }) +runner.Step("Register App 3", registerApp, { 3 }) +runner.Step("Register App 4", registerApp, { 4 }) +runner.Step("Register App 5", registerApp, { 5 }) + +runner.Title("Test") +runner.Step("Change VR Language to FR-CA", changeHMILanguage, { "VR", "FR-CA" }) +runner.Step("Re-register all apps", registerAllApps) +runner.Step("Check SDL Core status", checkCrashed) + +runner.Title("Postconditions") +runner.Step("Stop SDL, restore SDL settings", common.postconditions) diff --git a/test_scripts/Defects/8_0/3797_3798_HMI_sends_SetAppProperties_and_tries_to_ActivateApp.lua b/test_scripts/Defects/8_0/3797_3798_HMI_sends_SetAppProperties_and_tries_to_ActivateApp.lua index 4fff31c361..c06edf185b 100644 --- a/test_scripts/Defects/8_0/3797_3798_HMI_sends_SetAppProperties_and_tries_to_ActivateApp.lua +++ b/test_scripts/Defects/8_0/3797_3798_HMI_sends_SetAppProperties_and_tries_to_ActivateApp.lua @@ -19,6 +19,7 @@ local runner = require('user_modules/script_runner') local common = require('user_modules/sequences/actions') local utils = require("user_modules/utils") +local SDL = require('SDL') --[[ Test Configuration ]] runner.testSettings.isSelfIncluded = false @@ -34,6 +35,9 @@ local appProperties = { transportType = "WS", hybridAppPreference = "CLOUD", } +-- normal policies should specify there are NO_APPS_REGISTERED, +-- external policies does not check for other apps and replies APPLICATION_NOT_REGISTERED +local activateResult = SDL.buildOptions.extendedPolicy == "EXTERNAL_PROPRIETARY" and 15 or 19 local hmiAppId --[[ Local Functions ]] @@ -82,7 +86,7 @@ end local function activateApp() local corId = common.hmi.getConnection():SendRequest("SDL.ActivateApp", { appID = hmiAppId }) - common.hmi.getConnection():ExpectResponse(corId, { error = { code = 19 }}) + common.hmi.getConnection():ExpectResponse(corId, { error = { code = activateResult }}) end --[[ Scenario ]] diff --git a/test_scripts/Defects/8_0/common_3479.lua b/test_scripts/Defects/8_0/common_3479_2810.lua similarity index 89% rename from test_scripts/Defects/8_0/common_3479.lua rename to test_scripts/Defects/8_0/common_3479_2810.lua index ffc817e7e2..7aa4c6cf1a 100644 --- a/test_scripts/Defects/8_0/common_3479.lua +++ b/test_scripts/Defects/8_0/common_3479_2810.lua @@ -59,6 +59,8 @@ m.getHMIConnection = actions.getHMIConnection m.registerApp = actions.registerApp m.activateApp = actions.activateApp m.runAfter = actions.run.runAfter +m.disconnect = actions.mobile.disconnect +m.getHMIId = actions.app.getHMIId --[[ Common Functions ]] function m.log(...) @@ -187,4 +189,19 @@ function m.startStreamingNoAnswer(pServiceType, pStartStreamingDelay, pStopStrea return ret end +function m.unexpectedDisconnect(pServiceType) + m.disconnect() + m.getHMIConnection():ExpectNotification(pServiceType.notif, { available = false }) + :Do(function(_, data) m.log(m.ld[2], data.method, data.params.available) end) + m.getHMIConnection():ExpectRequest(pServiceType.stopRpc, { appID = m.getHMIId() }) + :Do(function(_, data) + m.log(m.ld[2], data.method) + m.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", { }) + m.log(m.ld[3], "SUCCESS:", data.method) + end) + m.getHMIConnection():ExpectNotification("BasicCommunication.OnAppUnregistered", + { appID = m.getHMIId(), unexpectedDisconnect = true }) + :Do(function() m.log(m.ld[2], "OnAppUnregistered") end) +end + return m diff --git a/test_scripts/Defects/8_1/1883_1_PerformInteraction_REJECTED_for_being_deleted_InteractionChoceSet.lua b/test_scripts/Defects/8_1/1883_1_PerformInteraction_REJECTED_for_being_deleted_InteractionChoceSet.lua new file mode 100644 index 0000000000..7bc29149fe --- /dev/null +++ b/test_scripts/Defects/8_1/1883_1_PerformInteraction_REJECTED_for_being_deleted_InteractionChoceSet.lua @@ -0,0 +1,108 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/SmartDeviceLink/sdl_core/issues/1883 +--------------------------------------------------------------------------------------------------- +-- Description: Check SDL rejects PerfromInteraction request if it's being sent during deleting of InteractionChoiceSet +--------------------------------------------------------------------------------------------------- +-- Preconditions: +-- 1. SDL and HMI are started +-- 2. Mobile app is registered and activated +-- In case: +-- 1. App is created InteractionChoiseSet(choiceSetID_1) +-- 2. App sends DeleteInteractionChoiceSet(choiceSetID_1) request +-- SDL does: +-- - transfer request to HMI +-- 3. App sends PerformInteraction(choiceSetID_1) request +-- SDL does: +-- - not transfer request to HMI +-- - respond with REJECTED to the App +-- 4. HMI responds to DeleteInteractionChoiceSet +-- SDL does: +-- - respond DeleteInteractionChoiceSet(SUCCESS) to App +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require("user_modules/script_runner") +local common = require("user_modules/sequences/actions") + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local requestVrAddCommand = { + cmdID = 111, + type = "Choice", + vrCommands = { "Choice111" } +} + +local requestChoiceParams = { + interactionChoiceSetID = 1, + choiceSet = { + { + choiceID = 111, + menuName = "Choice111", + vrCommands = { "Choice111" } + } + } +} + +local deleteChoiceSetID = { + interactionChoiceSetID = requestChoiceParams.interactionChoiceSetID +} + +local deleteResponseVrParams = { + cmdID = requestChoiceParams.choiceID, + type = "Choice" +} + +local performParams = { + initialText = "TextInitial", + interactionMode = "MANUAL_ONLY", + interactionChoiceSetIDList = { requestChoiceParams.interactionChoiceSetID }, + initialPrompt = { + { type = "TEXT", text = "pathToFile1" } + } +} + +--[[ Local Functions ]] +local function createInteractionChoiceSet(pChoiceParams) + local cid = common.mobile.getSession():SendRPC("CreateInteractionChoiceSet", pChoiceParams) + + common.hmi.getConnection():ExpectRequest("VR.AddCommand", requestVrAddCommand) + :Do(function(_, data) + common.hmi.getConnection():SendResponse(data.id, data.method, "SUCCESS", {}) + end) + + common.mobile.getSession():ExpectResponse(cid, { success = true, resultCode = "SUCCESS" }) +end + +local function sendPerformInteraction_REJECTED() + local cid = common.mobile.getSession():SendRPC("PerformInteraction", performParams) + common.mobile.getSession():ExpectResponse(cid, { success = false, resultCode = "REJECTED" }) +end + +local function deleteInteractionChoiceSet(pDeleteChoiceParams, pDeleteVrCommandParams) + local cid = common.mobile.getSession():SendRPC("DeleteInteractionChoiceSet", pDeleteChoiceParams) + common.hmi.getConnection():ExpectRequest("VR.DeleteCommand", pDeleteVrCommandParams) + :Do(function(_, data) + sendPerformInteraction_REJECTED() + local function deleteCommandResp() + common.hmi.getConnection():SendResponse(data.id, data.method, "SUCCESS", {}) + end + common.run.runAfter(deleteCommandResp, 1000) + end) + common.mobile.getSession():ExpectResponse(cid, { success = true, resultCode = "SUCCESS" }) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("Register App", common.registerApp) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("Create InteractionChoiceSet", createInteractionChoiceSet, { requestChoiceParams }) +runner.Step("Perform choiceSetID_1 during deleting choiceSetID_1", deleteInteractionChoiceSet, + { deleteChoiceSetID, deleteResponseVrParams }) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/Defects/8_1/1883_2_PerformInteraction_REJECTED_for_being_deleted_InteractionChoceSet_after_resumption.lua b/test_scripts/Defects/8_1/1883_2_PerformInteraction_REJECTED_for_being_deleted_InteractionChoceSet_after_resumption.lua new file mode 100644 index 0000000000..b22baf2ec7 --- /dev/null +++ b/test_scripts/Defects/8_1/1883_2_PerformInteraction_REJECTED_for_being_deleted_InteractionChoceSet_after_resumption.lua @@ -0,0 +1,137 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/SmartDeviceLink/sdl_core/issues/1883 +--------------------------------------------------------------------------------------------------- +-- Description: Check SDL rejects PerfromInteraction request if it's being sent during deleting of InteractionChoiceSet +-- in case deleting starts after successful resumption +--------------------------------------------------------------------------------------------------- +-- Preconditions: +-- 1. SDL and HMI are started +-- 2. Mobile app is registered and activated +-- In case: +-- 1. App is created InteractionChoiseSet(choiceSetID_1) +-- 2. Unexpected disconnect and reconnect are performed +-- 3. App re-registered with actual hashId +-- 4. App sends DeleteInteractionChoiceSet(choiceSetID_1) request +-- SDL does: +-- - transfer request to HMI +-- 5. App sends PerformInteraction(choiceSetID_1) request +-- SDL does: +-- - not transfer request to HMI +-- - respond with REJECTED to the App +-- 6. HMI responds to DeleteInteractionChoiceSet +-- SDL does: +-- - respond DeleteInteractionChoiceSet(SUCCESS) to app +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require("user_modules/script_runner") +local common = require("user_modules/sequences/actions") + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local requestVrAddCommand = { + cmdID = 111, + type = "Choice", + vrCommands = { "Choice111" } +} + +local requestChoiceParams = { + interactionChoiceSetID = 1, + choiceSet = { + { + choiceID = 111, + menuName = "Choice111", + vrCommands = { "Choice111" } + } + } +} + +local deleteChoiceSetID = { + interactionChoiceSetID = requestChoiceParams.interactionChoiceSetID +} + +local deleteResponseVrParams = { + cmdID = requestChoiceParams.choiceID, + type = "Choice" +} + +local performParams = { + initialText = "TextInitial", + interactionMode = "MANUAL_ONLY", + interactionChoiceSetIDList = { requestChoiceParams.interactionChoiceSetID }, + initialPrompt = { + { type = "TEXT", text = "pathToFile1" } + } +} + +local hashId = "" + +--[[ Local Functions ]] +local function createInteractionChoiceSet(pChoiceParams) + local cid = common.mobile.getSession():SendRPC("CreateInteractionChoiceSet", pChoiceParams) + + common.hmi.getConnection():ExpectRequest("VR.AddCommand", requestVrAddCommand) + :Do(function(_, data) + common.hmi.getConnection():SendResponse(data.id, data.method, "SUCCESS", {}) + end) + + common.mobile.getSession():ExpectResponse(cid, { success = true, resultCode = "SUCCESS" }) + common.mobile.getSession():ExpectNotification("OnHashChange") + :Do(function(_, data) + hashId = data.payload.hashID + end) +end + +local function sendPerformInteraction_REJECTED() + local cid = common.mobile.getSession():SendRPC("PerformInteraction", performParams) + common.mobile.getSession():ExpectResponse(cid, { success = false, resultCode = "REJECTED" }) +end + +local function deleteInteractionChoiceSet(pDeleteChoiceParams, pDeleteVrCommandParams) + local cid = common.mobile.getSession():SendRPC("DeleteInteractionChoiceSet", pDeleteChoiceParams) + common.hmi.getConnection():ExpectRequest("VR.DeleteCommand", pDeleteVrCommandParams) + :Do(function(_, data) + sendPerformInteraction_REJECTED() + local function deleteCommandResp() + common.hmi.getConnection():SendResponse(data.id, data.method, "SUCCESS", {}) + end + common.run.runAfter(deleteCommandResp, 1000) + end) + common.mobile.getSession():ExpectResponse(cid, { success = true, resultCode = "SUCCESS" }) +end + +local function reRegisterApp() + common.app.getParams().hashID = hashId + common.app.registerNoPTU() + common.getHMIConnection():ExpectRequest("VR.AddCommand", requestVrAddCommand) + :Do(function(_, data) + common.hmi.getConnection():SendResponse(data.id, data.method, "SUCCESS", {}) + end) +end + +local function unexpectedDisconnect() + common.getHMIConnection():ExpectNotification("BasicCommunication.OnAppUnregistered", { unexpectedDisconnect = true }) + :Times(common.mobile.getAppsCount()) + common.mobile.disconnect() + common.run.wait(1000) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("Register App", common.registerApp) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("Create InteractionChoiceSet", createInteractionChoiceSet, { requestChoiceParams }) +runner.Step("Unexpected disconnect", unexpectedDisconnect) +runner.Step("Connect mobile", common.mobile.connect) +runner.Step("Re-register App", reRegisterApp) +runner.Step("Activate App", common.activateApp) +runner.Step("Perform choiceSetID_1 during deleting choiceSetID_1", deleteInteractionChoiceSet, + { deleteChoiceSetID, deleteResponseVrParams }) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/Defects/8_1/2448_Master_Reset_Removes_AppInfo_Dat.lua b/test_scripts/Defects/8_1/2448_Master_Reset_Removes_AppInfo_Dat.lua new file mode 100644 index 0000000000..fbe429ded7 --- /dev/null +++ b/test_scripts/Defects/8_1/2448_Master_Reset_Removes_AppInfo_Dat.lua @@ -0,0 +1,46 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/smartdevicelink/sdl_core/issues/2448 +-- +-- Description: Check that SDL deletes application info (resumption data) file during MASTER_RESET` +-- +-- Preconditions: +-- 1. Core and HMI are started and initialized +-- 2. Mobile app is registered and activated +-- 3. HMI sends OnExitAllApplications with reason MASTER_RESET +-- Sequence: +-- 1. Core shuts down and removes the application info storage +-- a. SDL deletes AppInfoStorage file in AppStorageFolder +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require("user_modules/script_runner") +local common = require("test_scripts/Smoke/commonSmoke") + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false +config.defaultProtocolVersion = 5 + +--[[ Local Functions ]] +local function checkAppInfoWasCleared() + local appInfoPath = config.pathToSDL .. common.sdl.getSDLIniParameter("AppStorageFolder") + .. "/" .. common.sdl.getSDLIniParameter("AppInfoStorage") + + local f=io.open(name,"r") + if f ~= nil then + io.close(f) + common.run.fail("App Info file was not cleared after MASTER_RESET") + end +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI provides HMI capabilities", common.start) +runner.Step("Register App", common.registerApp) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("Shutdown by MASTER_RESET", common.masterReset) +runner.Step("Check that SDL deletes app_info.dat resumption file", checkAppInfoWasCleared) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/Defects/8_1/2989_RC_RPCs_and_disabled_policies.lua b/test_scripts/Defects/8_1/2989_RC_RPCs_and_disabled_policies.lua new file mode 100644 index 0000000000..6839dea5cf --- /dev/null +++ b/test_scripts/Defects/8_1/2989_RC_RPCs_and_disabled_policies.lua @@ -0,0 +1,85 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/smartdevicelink/sdl_core/issues/2989 +--------------------------------------------------------------------------------------------------- +-- Description: Check that SDL allows all RemoteControl RPCs in case if policies are disabled in SDL .ini +-- +-- Preconditions: +-- 1. Make sure 'EnablePolicy=false' in SDL .ini +-- 2. SDL, HMI, Mobile session are started +-- 3. HMI defines RC access mode to 'ASK_DRIVER' +-- 4. App1 and App2 are registered +-- Steps: +-- 1. App1 sends 'GetInteriorVehicleData', 'SetInteriorVehicleData' requests +-- SDL does: +-- - proceed with requests successfully +-- 2. App1 subscribed for RC module +-- 3. HMI sends 'OnInteriorVehicleData' notification for RC module +-- SDL does: +-- - transfer notification to the App1 +-- 4. App2 tries to subscribe for RC module +-- SDL does: +-- - ask for the user consent within 'GetInteriorVehicleDataConsent' request +-- - proceed with 'SetInteriorVehicleData' request once consent is provided +-- 5. App2 sends 'ReleaseInteriorVehicleDataModule' request +-- SDL does: +-- - release RC module successfully +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local actions = require("user_modules/sequences/actions") +local common = require('test_scripts/RC/commonRC') +local hmi_table = require('user_modules/hmi_values').getDefaultHMITable() + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +local modules = { "RADIO" } +local moduleIds = { + RADIO = hmi_table.RC.GetCapabilities.params.remoteControlCapability.radioControlCapabilities[1].moduleId +} + +--[[ Override Common Functions ]] +local createSession_Orig = actions.mobile.createSession +function actions.mobile.createSession(...) + local session = createSession_Orig(...) + local ExpectNotification_Orig = session.ExpectNotification + function session:ExpectNotification(funcName, ...) + local params = table.pack(...) + if funcName == "OnSystemRequest" and params[1] and params[1].requestType == "LOCK_SCREEN_ICON_URL" then + return -- skip expectation on notification + end + return ExpectNotification_Orig(self, funcName, ...) + end + return session +end + +local function releaseRCModule(pModuleType, pAppId) + local cid = common.getMobileSession(pAppId):SendRPC("ReleaseInteriorVehicleDataModule", + { moduleType = pModuleType, moduleId = moduleIds[pModuleType] }) + common.getMobileSession(pAppId):ExpectResponse(cid, { success = true, resultCode = "SUCCESS" }) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Disable policies", common.setSDLIniParameter, { "EnablePolicy", "false" }) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerAppWOPTU) +runner.Step("Activate App1", common.activateApp) +runner.Step("RAI2", common.registerAppWOPTU, { 2 }) +runner.Step("Activate App2", common.activateApp, { 2 }) +runner.Step("Set RA mode: ASK_DRIVER", common.defineRAMode, { true, "ASK_DRIVER" }) + +runner.Title("Test") + +for _, mod in pairs(modules) do + runner.Step("App 1 GetInteriorVehicleData " .. mod, common.subscribeToModule, { mod }) + runner.Step("App 1 OnInteriorVehicleData " .. mod, common.isSubscribed, { mod }) + runner.Step("App 1 SetInteriorVehicleData " .. mod, common.rpcAllowed, { mod, 1, "SetInteriorVehicleData" }) + runner.Step("App 2 SetInteriorVehicleData with consent " .. mod, common.rpcAllowedWithConsent, + { mod, 2, "SetInteriorVehicleData" }) + runner.Step("App 2 ReleaseInteriorVehicleDataModule " .. mod, releaseRCModule, { mod, 2 }) +end + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/Defects/8_1/3346_Core_sends_redundant_UpdateAppList_and_UpdateDeviceList.lua b/test_scripts/Defects/8_1/3346_Core_sends_redundant_UpdateAppList_and_UpdateDeviceList.lua new file mode 100644 index 0000000000..f0e10f1d70 --- /dev/null +++ b/test_scripts/Defects/8_1/3346_Core_sends_redundant_UpdateAppList_and_UpdateDeviceList.lua @@ -0,0 +1,81 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/smartdevicelink/sdl_core/issues/3346 +--------------------------------------------------------------------------------------------------- +-- Description: SDL Core sends redundant UpdateAppList and UpdateDeviceList +-- +-- Steps: +-- 1. Connect TCP app while bluetooth transport is available +-- +-- SDL does: +-- - Send UpdateAppList only when a new app is connected +--------------------------------------------------------------------------------------------------- + +require('atf.util') + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require("user_modules/sequences/actions") +local commonTestCases = require('user_modules/shared_testcases/commonTestCases') +local utils = require("user_modules/utils") + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Functions ]] +local function checkAppListUpdates() + utils.cprint(35, "Watching for app/device list updates...") + + local previousAppList = nil + local duplicateAppUpdates = 0 + common.getHMIConnection():ExpectRequest("BasicCommunication.UpdateAppList"):Times(AnyNumber()) + :ValidIf(function(_, data) + local appList = data.params.applications + + local isDifferent = true + if previousAppList ~= nil then + isDifferent = not compareValues(appList, previousAppList, "applications") + end + + if isDifferent then duplicateAppUpdates = duplicateAppUpdates + 1 else duplicateAppUpdates = 0 end + previousAppList = appList + + --Workaround, sometimes a single duplicate app list update can happen when a new app connects + if duplicateAppUpdates > 1 then + return false, "Duplicate app list updates were received" + else + return true + end + end) + + local previousDeviceList = nil + common.getHMIConnection():ExpectRequest("BasicCommunication.UpdateDeviceList"):Times(AnyNumber()) + :ValidIf(function(_, data) + local deviceList = data.params.deviceList + + local isDifferent = true + if previousDeviceList ~= nil then + isDifferent = not compareValues(deviceList, previousDeviceList, "deviceList") + end + previousDeviceList = deviceList + + if isDifferent then + return true + else + return false, "Duplicate device list updates were received" + end + end) + + commonTestCases:DelayedExp(60000) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("Register App", common.registerAppWOPTU) + +runner.Title("Test") +runner.Step("Check for redundant app or device list updates", checkAppListUpdates) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/Defects/8_1/3800_Send_GetSystemCapability_during_OnSystemCapabilityUpdated.lua b/test_scripts/Defects/8_1/3800_Send_GetSystemCapability_during_OnSystemCapabilityUpdated.lua new file mode 100644 index 0000000000..8efb8493a8 --- /dev/null +++ b/test_scripts/Defects/8_1/3800_Send_GetSystemCapability_during_OnSystemCapabilityUpdated.lua @@ -0,0 +1,270 @@ +--------------------------------------------------------------------------------------------------- +-- https://github.com/smartdevicelink/sdl_core/issues/3800 +--------------------------------------------------------------------------------------------------- +-- Description: +-- Attempt to get display capabilities for app while capabilities are being updated +-- +-- Precondition: +-- 1) Media, Non-media, and Navigation apps are registered (with heartbeat functionality disabled) +-- Steps: +-- 1. HMI sends OnSystemCapabilityUpdated(DISPLAYS) with a large amount of data for apps 1, 2, and 3 +-- 2. Apps 1, 2, and 3 repeatedly request GetSystemCapability(DISPLAYS) while SDL processes previous message +-- SDL does: +-- - Process messages normally (responding to GetSystemCapability with the proper capabilities or +-- DATA_NOT_AVAILABLE, where appropriate), no crash +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('user_modules/sequences/actions') +local SDL = require('SDL') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false +config.application1.registerAppInterfaceParams.isMediaApplication = true +config.application1.registerAppInterfaceParams.appHMIType = { "MEDIA" } +config.application2.registerAppInterfaceParams.isMediaApplication = false +config.application2.registerAppInterfaceParams.appHMIType = { "DEFAULT" } +config.application3.registerAppInterfaceParams.isMediaApplication = false +config.application3.registerAppInterfaceParams.appHMIType = { "NAVIGATION" } + +--[[ Local Variables ]] +local policyModes = { + P = "PROPRIETARY", + EP = "EXTERNAL_PROPRIETARY", + H = "HTTP" +} + +local mobSessionConfig = { + activateHeartbeat = false, + sendHeartbeatToSDL = false, + answerHeartbeatFromSDL = false, + ignoreSDLHeartBeatACK = false +} + +--[[ Local Functions ]] +local function registerApp(pAppId) + if not pAppId then pAppId = 1 end + local session = common.mobile.createSession(pAppId, 1, mobSessionConfig) + session:StartService(7) + :Do(function() + local corId = session:SendRPC("RegisterAppInterface", common.app.getParams(pAppId)) + common.hmi.getConnection():ExpectNotification("BasicCommunication.OnAppRegistered", + { application = { appName = common.app.getParams(pAppId).appName } }) + :Do(function(_, d1) + common.app.setHMIId(d1.params.application.appID, pAppId) + end) + session:ExpectResponse(corId, { success = true, resultCode = "SUCCESS" }) + :Do(function() + session:ExpectNotification("OnHMIStatus", + { hmiLevel = "NONE", audioStreamingState = "NOT_AUDIBLE", systemContext = "MAIN" }) + session:ExpectNotification("OnPermissionsChange") + :Times(AnyNumber()) + local policyMode = SDL.buildOptions.extendedPolicy + if policyMode == policyModes.P or policyMode == policyModes.EP then + session:ExpectNotification("OnSystemRequest", { requestType = "LOCK_SCREEN_ICON_URL" }) + end + end) + end) +end + +local function getSoftButCapValues() + return { + { + shortPressAvailable = true, + longPressAvailable = true, + upDownAvailable = true, + imageSupported = true + } + } +end + +local function getButCapValues() + local names = { + "PRESET_0", + "PRESET_1", + "PRESET_2", + "PRESET_3", + "PRESET_4", + "PRESET_5", + "PRESET_6", + "PRESET_7", + "PRESET_8", + "PRESET_9", + "OK", + "SEEKLEFT", + "SEEKRIGHT", + "TUNEUP", + "TUNEDOWN" + } + local values = { } + for _, v in pairs(names) do + local item = { + name = v, + shortPressAvailable = true, + longPressAvailable = true, + upDownAvailable = true + } + table.insert(values, item) + end + return values +end + +local function getDisplayCapImageFieldsValues() + local names = { + "softButtonImage", + "choiceImage", + "choiceSecondaryImage", + "vrHelpItem", + "turnIcon", + "menuIcon", + "cmdIcon", + "graphic", + "secondaryGraphic", + "showConstantTBTIcon", + "showConstantTBTNextTurnIcon" + } + local values = { } + for _, v in pairs(names) do + local item = { + imageResolution = { + resolutionHeight = 64, + resolutionWidth = 64 + }, + imageTypeSupported = { + "GRAPHIC_BMP", + "GRAPHIC_JPEG", + "GRAPHIC_PNG" + }, + name = v + } + table.insert(values, item) + end + return values +end + +local function getDisplayCapTextFieldsValues() + -- some text fields are excluded due to SDL issue + local names = { + "alertText1", + "alertText2", + "alertText3", + "audioPassThruDisplayText1", + "audioPassThruDisplayText2", + "ETA", + "initialInteractionText", + "phoneNumber", + "mainField1", + "mainField2", + "mainField3", + "mainField4", + "mediaClock", + "mediaTrack", + "menuName", + "menuTitle", + "addressLines", + "locationName", + "navigationText1", + "navigationText2", + "locationDescription", + "scrollableMessageBody", + "secondaryText", + "sliderFooter", + "sliderHeader", + "statusBar", + "tertiaryText", + "totalDistance", + "timeToDestination", + "turnText" + } + local values = { } + for _, v in pairs(names) do + local item = { + characterSet = "UTF_8", + name = v, + rows = 1, + width = 500 + } + table.insert(values, item) + end + return values +end + +local function getDisplayCapability() + return { + dynamicUpdateCapabilities = { + supportedDynamicImageFieldNames = {"subMenuIcon", "menuIcon"}, + supportsDynamicSubMenus = true + }, + menuLayoutsAvailable = { "LIST", "TILES" }, + textFields = getDisplayCapTextFieldsValues(), + imageFields = getDisplayCapImageFieldsValues(), + imageTypeSupported = { + "STATIC" + }, + templatesAvailable = { + "Template1", "Template2", "Template3", "Template4", "Template5" + }, + numCustomPresetsAvailable = 100, + buttonCapabilities = getButCapValues(), + softButtonCapabilities = getSoftButCapValues() + } +end + +local function fillArray(params, times) + local arr = {} + for i=1,times do + arr[i] = params + end + return arr +end + +local function updateDisplayCapabilities(appID) + common.getHMIConnection():SendNotification("BasicCommunication.OnSystemCapabilityUpdated", { + appID = common.getHMIAppId(appID), + systemCapability = { + systemCapabilityType = "DISPLAYS", + displayCapabilities = { + { + displayName = "displayName", + windowTypeSupported = { + { + type = "MAIN", + maximumNumberOfWindows = 1 + }, + { + type = "WIDGET", + maximumNumberOfWindows = 2 + } + }, + windowCapabilities = fillArray(getDisplayCapability(), 30) + } + } + } + }) + + -- Send several GetSystemCapability requests at 10ms intervals + for i=0,49 do + common.run.wait(10 * i):Do(function() + local requestID = common.getMobileSession(appID):SendRPC("GetSystemCapability", { + systemCapabilityType = "DISPLAYS" + }) + common.getMobileSession(appID):ExpectResponse(requestID) + end) + end +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Create mobile connection and session", common.start) +runner.Step("Register Media App", registerApp, { 1 }) +runner.Step("Register Non-media App", registerApp, { 2 }) +runner.Step("Register Navigation App", registerApp, { 3 }) + +runner.Title("Test") +runner.Step("Update and get display capabilities for app 1", updateDisplayCapabilities, { 1 }) +runner.Step("Update and get display capabilities for app 2", updateDisplayCapabilities, { 2 }) +runner.Step("Update and get display capabilities for app 3", updateDisplayCapabilities, { 3 }) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/Defects/8_1/3804_1_RAI_use_hmiCapabilities_from_cache_file.lua b/test_scripts/Defects/8_1/3804_1_RAI_use_hmiCapabilities_from_cache_file.lua new file mode 100644 index 0000000000..ba8dec97a3 --- /dev/null +++ b/test_scripts/Defects/8_1/3804_1_RAI_use_hmiCapabilities_from_cache_file.lua @@ -0,0 +1,103 @@ +--------------------------------------------------------------------------------------------------- +-- https://github.com/smartdevicelink/sdl_core/issues/3804 +--------------------------------------------------------------------------------------------------- +-- Description: +-- Validate hmiCapabilities navigation, phoneCall and videoStreaming in RAI response +-- +-- Precondition: +-- 1) HMI capabilities cache file (hmi_capabilities_cache.json) exists: +-- - with "hmiCapabilities": parameter +-- - without the "systemCapabilities": parameter +-- 2) SDL, HMI, Mobile session are started +-- +-- Test: +-- 1) App sends RegisterAppInterface request +-- SDL does: +-- - send RAI response with the parameter from HMI capabilities cache file +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local common = require('user_modules/sequences/actions') +local runner = require('user_modules/script_runner') +local utils = require("user_modules/utils") +local color = require("user_modules/consts").color +local SDL = require('SDL') +local hmi_values = require('user_modules/hmi_values') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local missingCapability = { + [1] = "navigationCapability", + [2] = "phoneCapability", + [3] = "videoStreamingCapability" +} + +--[[ Local Functions ]] +local function ignitionOff() + local isOnSDLCloseSent = false + common.hmi.getConnection():SendNotification("BasicCommunication.OnExitAllApplications", { reason = "SUSPEND" }) + common.hmi.getConnection():ExpectNotification("BasicCommunication.OnSDLPersistenceComplete") + :Do(function() + common.hmi.getConnection():SendNotification("BasicCommunication.OnExitAllApplications", + { reason = "IGNITION_OFF" }) + common.hmi.getConnection():ExpectNotification("BasicCommunication.OnSDLClose") + :Do(function() + isOnSDLCloseSent = true + SDL.DeleteFile() + end) + end) + common.run.wait(3000) + :Do(function() + if isOnSDLCloseSent == false then utils.cprint(color.magenta, "BC.OnSDLClose was not sent") end + for i = 1, common.mobile.getAppsCount() do + common.mobile.deleteSession(i) + end + StopSDL() + end) +end + +local function getHMIParams(pMissingCapability) + local params = hmi_values.getDefaultHMITable() + params.UI.GetCapabilities.params.hmiCapabilities = { navigation = true, phoneCall = true, videoStreaming = true } + params.UI.GetCapabilities.params.systemCapabilities[pMissingCapability] = nil + return params +end + +local function reRegisterApp() + local session = common.mobile.createSession() + session:StartService(7) + :Do(function() + local corId = session:SendRPC("RegisterAppInterface", common.app.getParams()) + common.hmi.getConnection():ExpectNotification("BasicCommunication.OnAppRegistered") + session:ExpectResponse(corId, { success = true, resultCode = "SUCCESS", + hmiCapabilities = { + appServices = true, + displays = true, + driverDistraction = true, + navigation = true, + phoneCall = true, + remoteControl = true, + seatLocation = true, + videoStreaming = true + } + }) + end) +end + +--[[ Scenario ]] +for i, cap in utils.spairs(missingCapability) do + runner.Title("Test case [" .. i .. "], missing capability: '" .. cap .. "'") + runner.Title("Preconditions") + runner.Step("Clean environment", common.preconditions) + runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start, { getHMIParams(cap) }) + runner.Step("Register App", common.registerAppWOPTU) + + runner.Title("Test") + runner.Step("Ignition Off", ignitionOff) + runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) + runner.Step("Reregister App", reRegisterApp) + + runner.Title("Postconditions") + runner.Step("Stop SDL", common.postconditions) +end diff --git a/test_scripts/Defects/8_1/3804_2_RAI_use_hmiCapabilities_from_cache_file_with_different_value.lua b/test_scripts/Defects/8_1/3804_2_RAI_use_hmiCapabilities_from_cache_file_with_different_value.lua new file mode 100644 index 0000000000..275ed2ae7b --- /dev/null +++ b/test_scripts/Defects/8_1/3804_2_RAI_use_hmiCapabilities_from_cache_file_with_different_value.lua @@ -0,0 +1,110 @@ +--------------------------------------------------------------------------------------------------- +-- https://github.com/smartdevicelink/sdl_core/issues/3804 +--------------------------------------------------------------------------------------------------- +-- Description: +-- Validate hmiCapabilities navigation, phoneCall and videoStreaming in RAI response +-- +-- Precondition: +-- 1) HMI capabilities cache file (hmi_capabilities_cache.json) exists: +-- - with "hmiCapabilities": parameter +-- 2) SDL, HMI, Mobile session are started +-- +-- Test: +-- 1) App sends RegisterAppInterface request +-- SDL does: +-- - send RAI response with the parameter from HMI capabilities cache file +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local common = require('user_modules/sequences/actions') +local runner = require('user_modules/script_runner') +local utils = require("user_modules/utils") +local color = require("user_modules/consts").color +local SDL = require('SDL') +local hmi_values = require('user_modules/hmi_values') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local hmiCapabilitiesParam = { + navigation = { [1] = true, [2] = false, [3] = nil }, + phoneCall = { [1] = true, [2] = false, [3] = nil }, + videoStreaming = { [1] = true, [2] = false, [3] = nil } +} + +--[[ Local Functions ]] +local function ignitionOff() + local isOnSDLCloseSent = false + common.hmi.getConnection():SendNotification("BasicCommunication.OnExitAllApplications", { reason = "SUSPEND" }) + common.hmi.getConnection():ExpectNotification("BasicCommunication.OnSDLPersistenceComplete") + :Do(function() + common.hmi.getConnection():SendNotification("BasicCommunication.OnExitAllApplications", + { reason = "IGNITION_OFF" }) + common.hmi.getConnection():ExpectNotification("BasicCommunication.OnSDLClose") + :Do(function() + isOnSDLCloseSent = true + SDL.DeleteFile() + end) + end) + common.run.wait(3000) + :Do(function() + if isOnSDLCloseSent == false then utils.cprint(color.magenta, "BC.OnSDLClose was not sent") end + for i = 1, common.mobile.getAppsCount() do + common.mobile.deleteSession(i) + end + StopSDL() + end) +end + +local function getHMIParams(pHmiCapParam, pHmiCapValue) + local params = hmi_values.getDefaultHMITable() + params.UI.GetCapabilities.params.hmiCapabilities = { navigation = true, phoneCall = true, videoStreaming = true } + params.UI.GetCapabilities.params.hmiCapabilities[pHmiCapParam] = pHmiCapValue + return params +end + +local function reRegisterApp(pHmiCapParam, pHmiCapValue) + local hmiCapabilities = { + appServices = true, + displays = true, + driverDistraction = true, + navigation = true, + phoneCall = true, + remoteControl = true, + seatLocation = true, + videoStreaming = true + } + if pHmiCapValue == nil then + hmiCapabilities[pHmiCapParam] = false + else + hmiCapabilities[pHmiCapParam] = pHmiCapValue + end + local session = common.mobile.createSession() + session:StartService(7) + :Do(function() + local corId = session:SendRPC("RegisterAppInterface", common.app.getParams()) + common.hmi.getConnection():ExpectNotification("BasicCommunication.OnAppRegistered") + session:ExpectResponse(corId, { success = true, resultCode = "SUCCESS", + hmiCapabilities = hmiCapabilities + }) + end) +end + +--[[ Scenario ]] +for p, v in utils.spairs(hmiCapabilitiesParam) do + for i = 1, #v do + runner.Title("Test case [" .. p .. "]: '" .. tostring(v[i]) .. "'") + runner.Title("Preconditions") + runner.Step("Clean environment", common.preconditions) + runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start, { getHMIParams(p, v[i]) }) + runner.Step("Register App", common.registerAppWOPTU) + + runner.Title("Test") + runner.Step("Ignition Off", ignitionOff) + runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) + runner.Step("Reregister App", reRegisterApp, { p, v[i] }) + + runner.Title("Postconditions") + runner.Step("Stop SDL", common.postconditions) + end +end diff --git a/test_scripts/Defects/8_1/3805_crash_during_langchange.lua b/test_scripts/Defects/8_1/3805_crash_during_langchange.lua new file mode 100644 index 0000000000..242691960f --- /dev/null +++ b/test_scripts/Defects/8_1/3805_crash_during_langchange.lua @@ -0,0 +1,80 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/SmartDeviceLink/sdl_core/issues/3805 +--------------------------------------------------------------------------------------------------- +-- Description: A crash occurs during registration +-- +-- Steps: +-- 1. Connect EN-US apps +-- 2. Change UI and TTS language to FR-CA +-- 3. Quickly register 5 apps and then unregister them +-- SDL does: +-- - not crash +--------------------------------------------------------------------------------------------------- +--[[ 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 Variables ]] + +--[[ Local Functions ]] +local function registerApp(pAppId) + local session = common.getMobileSession(pAppId, 1) + session:StartService(7) + :Do(function() + local corId = session:SendRPC("RegisterAppInterface", common.app.getParams(pAppId)) + common.hmi.getConnection():ExpectNotification("BasicCommunication.OnAppRegistered", + { application = { appName = common.app.getParams(pAppId).appName } }) + :Do(function(_, d1) + common.app.setHMIId(d1.params.application.appID, pAppId) + end) + session:ExpectResponse(corId, { success = true }) + :Do(function() + session:ExpectNotification("OnHMIStatus", + { hmiLevel = "NONE", audioStreamingState = "NOT_AUDIBLE", systemContext = "MAIN" }) + session:ExpectNotification("OnPermissionsChange") + :Times(AnyNumber()) + end) + end) + end + +local function changeHMILanguage(lang) + local hmi = common.hmi.getConnection() + hmi:SendNotification("UI.OnLanguageChange", { language = lang }) + hmi:SendNotification("TTS.OnLanguageChange", { language = lang }) +end + +local function registerAllApps() + for i = 1,5 do + common.getMobileSession(i, 1):SendRPC("RegisterAppInterface", common.app.getParams(i)) + end + utils.wait(500) + for j = 1,5 do + common.getMobileSession(j):SendRPC("UnregisterAppInterface", {}) + end +end + +local function checkCrashed() + if not common.sdl.isRunning() then common.run.fail("SDL crashed") end +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, init HMI", common.start) +runner.Step("Register App 1", registerApp, { 1 }) +runner.Step("Register App 2", registerApp, { 2 }) +runner.Step("Register App 3", registerApp, { 3 }) +runner.Step("Register App 4", registerApp, { 4 }) +runner.Step("Register App 5", registerApp, { 5 }) +runner.Step("Change Language to FR-CA", changeHMILanguage, { "FR-CA" }) + +runner.Title("Test") +runner.Step("Re-register all apps", registerAllApps) +runner.Step("Check SDL Core status", checkCrashed) + +runner.Title("Postconditions") +runner.Step("Stop SDL, restore SDL settings", common.postconditions) diff --git a/test_scripts/Defects/8_1/3831_SDL_calculates_playback_time_based_on_data_provided_by_HMI.lua b/test_scripts/Defects/8_1/3831_SDL_calculates_playback_time_based_on_data_provided_by_HMI.lua new file mode 100644 index 0000000000..66a1d3c2d5 --- /dev/null +++ b/test_scripts/Defects/8_1/3831_SDL_calculates_playback_time_based_on_data_provided_by_HMI.lua @@ -0,0 +1,114 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/smartdevicelink/sdl_core/issues/3831 +--------------------------------------------------------------------------------------------------- +-- Description: Check SDL calculates playback time based on 'samplingRate' and 'bitsPerSample' +-- provided by HMI +-- +-- Steps: +-- 1. HMI provides some values for 'samplingRate' and 'bitsPerSample' within 'UI.GetCapabilities' response +-- 2. Navi App registers and starts streaming Audio +-- SDL does: +-- - send 'Navigation.OnAudioDataStreaming(true)' to HMI once streaming is started +-- - start internal timer based on data provided by HMI according to formula: +-- timeout = 1000 * data_size / (sampling_rate * bits_per_sample / 8) + latency +-- - send 'Navigation.OnAudioDataStreaming(false)' to HMI once timer expires +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local common = require('user_modules/sequences/actions') +local runner = require('user_modules/script_runner') +local utils = require("user_modules/utils") +local color = require("user_modules/consts").color +local hmi_values = require('user_modules/hmi_values') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local testCases = { + [01] = { samplingRate = 8000, bitsPerSample = 8 }, + [02] = { samplingRate = 8000, bitsPerSample = 16 }, + [03] = { samplingRate = 16000, bitsPerSample = 8 }, + [04] = { samplingRate = 16000, bitsPerSample = 16 }, + [05] = { samplingRate = 22000, bitsPerSample = 8 }, + [06] = { samplingRate = 22000, bitsPerSample = 16 }, + [07] = { samplingRate = 44000, bitsPerSample = 8 }, + [08] = { samplingRate = 44000, bitsPerSample = 16 } +} +local serviceId = 10 +local streamingFile = "files/MP3_123kb.mp3" +local samplingRateMap = { + [8000] = "8KHZ", + [16000] = "16KHZ", + [22000] = "22KHZ", + [44000] = "44KHZ" +} +local bitsPerSampleMap = { + [8] = "8_BIT", + [16] = "16_BIT" +} + +--[[ Local Functions ]] +local function getHMIParams(pSamplingRate, pBitsPerSample) + local params = hmi_values.getDefaultHMITable() + local pcmStreamCapabilities = params.UI.GetCapabilities.params.pcmStreamCapabilities + pcmStreamCapabilities.samplingRate = samplingRateMap[pSamplingRate] + pcmStreamCapabilities.bitsPerSample = bitsPerSampleMap[pBitsPerSample] + return params +end + +local function startAudioService() + common.getHMIConnection():ExpectRequest("Navigation.StartAudioStream") + :Do(function(_, data) + common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", { }) + end) + common.getMobileSession():StartService(serviceId) +end + +local function startAudioStreaming(pSamplingRate, pBitsPerSample) + local start_ts = timestamp() + common.getHMIConnection():ExpectNotification("Navigation.OnAudioDataStreaming", + { available = true }, { available = false }) + :ValidIf(function(exp) + if exp.occurences == 2 then + local streamDelay = 500 + local latency = 500 + local data_size = 125309 + local sampling_rate = pSamplingRate + local bits_per_sample = pBitsPerSample + local expDuration = math.floor(1000 * data_size / (sampling_rate * bits_per_sample / 8) + latency + streamDelay) + local actDuration = timestamp() - start_ts + utils.cprint(color.magenta, "Duration expected: " .. tostring(expDuration) + .. ", actual: " .. tostring(actDuration)) + if actDuration < expDuration - latency or actDuration > expDuration + latency then + return false, "Unexpected streaming duration" + end + end + return true + end) + :Times(2) + :Timeout(20000) + common.getMobileSession():StartStreaming(serviceId, streamingFile, 80*1024) +end + +local function StopAudioStreaming() + common.getMobileSession():StopStreaming(streamingFile) +end + +--[[ Scenario ]] +for id, tc in utils.spairs(testCases) do + runner.Title("Test Case [" .. id .. "] samplingRate: " .. tc.samplingRate .. ", bitsPerSample: " .. tc.bitsPerSample) + runner.Title("Preconditions") + runner.Step("Clean environment", common.preconditions) + runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start, + { getHMIParams(tc.samplingRate, tc.bitsPerSample) }) + runner.Step("Register App", common.registerApp) + runner.Step("Activate App", common.activateApp) + runner.Step("Start audio service", startAudioService) + + runner.Title("Test") + runner.Step("Start audio streaming", startAudioStreaming, { tc.samplingRate, tc.bitsPerSample }) + + runner.Title("Postconditions") + runner.Step("Stop audio streaming", StopAudioStreaming) + runner.Step("Stop SDL", common.postconditions) +end diff --git a/test_scripts/Defects/8_1/3832_HMI_PTU_after_Ignition_cycle.lua b/test_scripts/Defects/8_1/3832_HMI_PTU_after_Ignition_cycle.lua new file mode 100644 index 0000000000..9bfd13fd63 --- /dev/null +++ b/test_scripts/Defects/8_1/3832_HMI_PTU_after_Ignition_cycle.lua @@ -0,0 +1,123 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/smartdevicelink/sdl_core/issues/3832 +--------------------------------------------------------------------------------------------------- +-- Description: SDL sends UP_TO_DATE in case of HMI PTU after Ignition cycle +-- +-- Steps: +-- 1. Core and HMI are started +-- 2. In HMI switch on PTU using in-vehicle modem option +-- 3. Policy Server is running and exchange_after_x_ignition_cycles = 1 +-- 4. App starts registration +-- SDL does: +-- - start PTU and sends SDL.OnStatusUpdate(UPDATE_NEEDED, UPDATING) to HMI +-- 5. HMI PTU sequences finished successfully +-- SDL does: +-- - send SDL.OnStatusUpdate(UP_TO_DATE) to HMI +-- 6. Ignition Cycle (Off/On) +-- SDL does: +-- - send SDL.OnStatusUpdate(UPDATE_NEEDED, UPDATING, UP_TO_DATE) to HMI +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/Policies/HMI_PTU/common_hmi_ptu') +local actions = require("user_modules/sequences/actions") +local SDL = require('SDL') +local utils = require('user_modules/utils') +local consts = require('user_modules/consts') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false +runner.testSettings.restrictions.sdlBuildOptions = { { extendedPolicy = { "PROPRIETARY", "EXTERNAL_PROPRIETARY" } } } + +--[[ Local Variables ]] +local cycles = 1 + +--[[ Local Functions ]] +local function ignitionOff() + common.hmi():SendNotification("BasicCommunication.OnIgnitionCycleOver") + common.hmi():SendNotification("BasicCommunication.OnExitAllApplications", { reason = "SUSPEND" }) + common.hmi():ExpectNotification("BasicCommunication.OnSDLPersistenceComplete") + :Do(function() + common.hmi():SendNotification("BasicCommunication.OnExitAllApplications", { reason = "IGNITION_OFF" }) + common.hmi():ExpectNotification("BasicCommunication.OnSDLClose") + :Do(function() + SDL.DeleteFile() + for i = 1, actions.mobile.getAppsCount() do + actions.mobile.deleteSession(i) + end + end) + end) + common.wait(3000) +end + +local function updFunc(pTbl) + pTbl.policy_table.module_config.exchange_after_x_ignition_cycles = cycles +end + +local function ignitionOnWithPTU() + common.start() + common.hmi():ExpectRequest("BasicCommunication.PolicyUpdate") + :Do(function(_, data) + common.hmi():SendResponse(data.id, data.method, "SUCCESS", { }) + end) + common.hmi():ExpectNotification("SDL.OnStatusUpdate", { status = "UPDATE_NEEDED" }, { status = "UPDATING" }) + :Times(2) +end + +local function getPTUFromPTS() + local pTbl = common.getPTS() + if pTbl == nil then + utils.cprint(consts.color.magenta, "PTS file was not found, PreloadedPT is used instead") + pTbl = common.getPreloadedPT() + end + if next(pTbl) ~= nil then + pTbl.policy_table.consumer_friendly_messages = nil + pTbl.policy_table.device_data = nil + pTbl.policy_table.module_meta = nil + pTbl.policy_table.usage_and_error_counts = nil + pTbl.policy_table.functional_groupings["DataConsent-2"].rpcs = utils.json.null + pTbl.policy_table.module_config.preloaded_pt = nil + pTbl.policy_table.module_config.preloaded_date = nil + pTbl.policy_table.vehicle_data = nil + end + return pTbl +end + +local function ptuViaHMI() + local ptuFileName = os.tmpname() + local requestId = common.hmi():SendRequest("SDL.GetPolicyConfigurationData", + { policyType = "module_config", property = "endpoints" }) + common.hmi():ExpectResponse(requestId) + :Do(function() + local ptuTable = getPTUFromPTS() + utils.tableToJsonFile(ptuTable, ptuFileName) + common.hmi():ExpectRequest("VehicleInfo.GetVehicleData", { odometer = true }) + common.hmi():ExpectNotification("SDL.OnStatusUpdate", { status = "UP_TO_DATE" }) + common.hmi():SendNotification("SDL.OnReceivedPolicyUpdate", { policyfile = ptuFileName }) + common.runAfter(function() os.remove(ptuFileName) end, 250) + end) +end + +local function ptuViaHMIWithAppRegister() + common.registerNoPTU() + common.runAfter(function() ptuViaHMI() end, 100) + common.wait(1000) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Clear HMICapabilitiesCacheFile parameter in INI file", + common.setSDLIniParameter, {"HMICapabilitiesCacheFile", ""}) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("HMI PTU Successful", common.ptuViaHMI, { updFunc }) +runner.Step("Ignition Off", ignitionOff) +runner.Step("New HMI PTU on Ignition cycles trigger", ignitionOnWithPTU) +runner.Step("HMI PTU Successful", ptuViaHMIWithAppRegister) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/Defects/8_1/3838/3838_1_SDL_does_not_send_UI.ClosePopUp_in_case_VR.PerformInteraction_TIME_OUT.lua b/test_scripts/Defects/8_1/3838/3838_1_SDL_does_not_send_UI.ClosePopUp_in_case_VR.PerformInteraction_TIME_OUT.lua new file mode 100644 index 0000000000..c9de7570eb --- /dev/null +++ b/test_scripts/Defects/8_1/3838/3838_1_SDL_does_not_send_UI.ClosePopUp_in_case_VR.PerformInteraction_TIME_OUT.lua @@ -0,0 +1,97 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/SmartDeviceLink/sdl_core/issues/3838 +--------------------------------------------------------------------------------------------------- +-- Description: Check that SDL does not send UI.ClosePopUp to HMI in case: +-- - mobile App sends PerformInteraction request with VR_ONLY interaction mode to SDL +-- - HMI responds with 'TIMED_OUT' to VR.PerformInteraction request +-- +-- Pre-conditions: +-- 1. SDL, HMI, Mobile session are started +-- 2. App is registered and activated +-- 3. CreateInteractionChoiceSet is added +-- Steps: +-- 1. App sends PerformInteraction request with VR_ONLY interaction mode to SDL +-- 2. HMI responds with 'SUCCESS' to UI.PerformInteraction request +-- 3. HMI responds with 'TIMED_OUT' to VR.PerformInteraction request +-- SDL does: +-- - not send UI.ClosePopUp request to HMI +-- - send PerformInteraction response (resultCode: TIMED_OUT, success:false) to mobile App +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local common = require("test_scripts/Defects/8_1/3838/common") + +--[[ Local Variables ]] +local initialPromptValue = common.getPromptValue(" Make your choice ") + +local helpPromptValue = common.getPromptValue(" Help Prompt ") + +local timeoutPromptValue = common.getPromptValue(" Time out ") + +local vrHelpvalue = { + { + text = " New VRHelp ", + position = 1 + } +} + +local requestParams = { + initialText = "StartPerformInteraction", + initialPrompt = initialPromptValue, + interactionMode = "VR_ONLY", + interactionChoiceSetIDList = { 100 }, + helpPrompt = helpPromptValue, + timeoutPrompt = timeoutPromptValue, + timeout = 5000, + vrHelp = vrHelpvalue, + interactionLayout = "ICON_ONLY" +} + +--[[ Local Functions ]] +local function PI_ViaVR_ONLY(pParams) + local cid = common.getMobileSession():SendRPC("PerformInteraction", pParams) + common.getHMIConnection():ExpectRequest("UI.ClosePopUp") + :Times(0) + common.getHMIConnection():ExpectRequest("VR.PerformInteraction", { + helpPrompt = pParams.helpPrompt, + initialPrompt = pParams.initialPrompt, + timeout = pParams.timeout, + timeoutPrompt = pParams.timeoutPrompt + }) + :Do(function(_, data) + local function vrResponse() + common.getHMIConnection():SendNotification("TTS.Started") + common.getHMIConnection():SendNotification("VR.Started") + common.sendOnSystemContext("VRSESSION") + common.getHMIConnection():SendError(data.id, data.method, "TIMED_OUT", "Perform Interaction error response.") + common.getHMIConnection():SendNotification("TTS.Stopped") + common.getHMIConnection():SendNotification("VR.Stopped") + common.sendOnSystemContext("MAIN") + end + common.runAfter(vrResponse, 1000) + end) + + common.getHMIConnection():ExpectRequest("UI.PerformInteraction", { + timeout = pParams.timeout, + vrHelp = pParams.vrHelp, + vrHelpTitle = pParams.initialText, + }) + :Do(function(_,data) + common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", { }) + end) + common.expectOnHMIStatusWithAudioStateChanged_PI("VR") + common.getMobileSession():ExpectResponse(cid, { success = false, resultCode = "TIMED_OUT" }) +end + +--[[ Scenario ]] +common.Title("Preconditions") +common.Step("Clean environment", common.preconditions) +common.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +common.Step("Register App", common.registerApp) +common.Step("Activate App", common.activateApp) +common.Step("CreateInteractionChoiceSet with id 100", common.createInteractionChoiceSet, { 100 }) + +common.Title("Test") +common.Step("PerformInteraction with VR_ONLY interaction mode", PI_ViaVR_ONLY, { requestParams }) + +common.Title("Postconditions") +common.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/Defects/8_1/3838/3838_2_SDL_does_not_send_UI.ClosePopUp_in_case_VR.PerformInteraction_SUCCESS.lua b/test_scripts/Defects/8_1/3838/3838_2_SDL_does_not_send_UI.ClosePopUp_in_case_VR.PerformInteraction_SUCCESS.lua new file mode 100644 index 0000000000..12c789f68e --- /dev/null +++ b/test_scripts/Defects/8_1/3838/3838_2_SDL_does_not_send_UI.ClosePopUp_in_case_VR.PerformInteraction_SUCCESS.lua @@ -0,0 +1,100 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/SmartDeviceLink/sdl_core/issues/3838 +--------------------------------------------------------------------------------------------------- +-- Description: Check that SDL does not send UI.ClosePopUp to HMI in case: +-- - mobile App sends PerformInteraction request with VR_ONLY interaction mode to SDL +-- - HMI responds with 'SUCCESS' to VR.PerformInteraction request +-- +-- Pre-conditions: +-- 1. SDL, HMI, Mobile session are started +-- 2. App is registered and activated +-- 3. CreateInteractionChoiceSet is added +-- Steps: +-- 1. App sends PerformInteraction request with VR_ONLY interaction mode to SDL +-- 2. HMI responds with 'SUCCESS' to UI.PerformInteraction request +-- 3. HMI responds with 'SUCCESS' to VR.PerformInteraction request +-- SDL does: +-- - not send UI.ClosePopUp request to HMI +-- - send PerformInteraction response with choiceID from VR response (resultCode: SUCCESS, success:true) to mobile App +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local common = require("test_scripts/Defects/8_1/3838/common") + +--[[ Local Variables ]] +local initialPromptValue = common.getPromptValue(" Make your choice ") + +local helpPromptValue = common.getPromptValue(" Help Prompt ") + +local timeoutPromptValue = common.getPromptValue(" Time out ") + +local vrHelpvalue = { + { + text = " New VRHelp ", + position = 1 + } +} + +local requestParams = { + initialText = "StartPerformInteraction", + initialPrompt = initialPromptValue, + interactionMode = "VR_ONLY", + interactionChoiceSetIDList = { 100 }, + helpPrompt = helpPromptValue, + timeoutPrompt = timeoutPromptValue, + timeout = 5000, + vrHelp = vrHelpvalue, + interactionLayout = "ICON_ONLY" +} + +--[[ Local Functions ]] +local function PI_ViaVR_ONLY(pParams) + local cid = common.getMobileSession():SendRPC("PerformInteraction", pParams) + common.getHMIConnection():ExpectRequest("UI.ClosePopUp") + :Times(0) + common.getHMIConnection():ExpectRequest("VR.PerformInteraction", { + helpPrompt = pParams.helpPrompt, + initialPrompt = pParams.initialPrompt, + timeout = pParams.timeout, + timeoutPrompt = pParams.timeoutPrompt + }) + :Do(function(_, data) + local function vrResponse() + common.getHMIConnection():SendNotification("TTS.Started") + common.getHMIConnection():SendNotification("VR.Started") + common.sendOnSystemContext("VRSESSION") + common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", + { choiceID = pParams.interactionChoiceSetIDList[1] }) + common.getHMIConnection():SendNotification("TTS.Stopped") + common.getHMIConnection():SendNotification("VR.Stopped") + common.sendOnSystemContext("MAIN") + end + common.runAfter(vrResponse, 1000) + end) + + common.getHMIConnection():ExpectRequest("UI.PerformInteraction", { + timeout = pParams.timeout, + vrHelp = pParams.vrHelp, + vrHelpTitle = pParams.initialText, + }) + :Do(function(_,data) + common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", { }) + end) + common.expectOnHMIStatusWithAudioStateChanged_PI("VR") + common.getMobileSession():ExpectResponse(cid, { + success = true, resultCode = "SUCCESS", choiceID = pParams.interactionChoiceSetIDList[1] + }) +end + +--[[ Scenario ]] +common.Title("Preconditions") +common.Step("Clean environment", common.preconditions) +common.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +common.Step("Register App", common.registerApp) +common.Step("Activate App", common.activateApp) +common.Step("CreateInteractionChoiceSet with id 100", common.createInteractionChoiceSet, { 100 }) + +common.Title("Test") +common.Step("PerformInteraction with VR_ONLY interaction mode", PI_ViaVR_ONLY, { requestParams }) + +common.Title("Postconditions") +common.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/Defects/8_1/3838/3838_3_SDL_does_not_send_UI.ClosePopUp_in_case_two_PerformInteraction_requests.lua b/test_scripts/Defects/8_1/3838/3838_3_SDL_does_not_send_UI.ClosePopUp_in_case_two_PerformInteraction_requests.lua new file mode 100644 index 0000000000..24d61ce06e --- /dev/null +++ b/test_scripts/Defects/8_1/3838/3838_3_SDL_does_not_send_UI.ClosePopUp_in_case_two_PerformInteraction_requests.lua @@ -0,0 +1,98 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/SmartDeviceLink/sdl_core/issues/3838 +--------------------------------------------------------------------------------------------------- +-- Description: Check that SDL does not send UI.ClosePopUp to HMI in case +-- mobile App sends two PerformInteraction request with VR_ONLY interaction mode to SDL +-- +-- Pre-conditions: +-- 1. SDL, HMI, Mobile session are started +-- 2. App is registered and activated +-- 3. ChoiceSets is added +-- Steps: +-- 1. Mobile app requests PerformInteraction(VR_ONLY) to SDL +-- 2. Mobile app requests PerformInteraction(VR_ONLY) one more time while the first one is in progress +-- 3. HMI responds with 'REJECTED' to second UI/VR.PerformInteraction requests +-- SDL does: +-- - not send UI.ClosePopUp request to HMI +-- - send PerformInteraction response with (resultCode: REJECTED, success:false) to mobile App +-- 4. HMI responds with 'SUCCESS' to first UI/VR.PerformInteraction requests +-- SDL does: +-- - send PerformInteraction response with choiceID from VR response (resultCode: SUCCESS, success:true) to mobile App +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local common = require("test_scripts/Defects/8_1/3838/common") +local utils = require('user_modules/utils') + +--[[ Local Variables ]] +local initialPromptValue = common.getPromptValue(" Make your choice ") + +local helpPromptValue = common.getPromptValue(" Help Prompt ") + +local timeoutPromptValue = common.getPromptValue(" Time out ") + +--[[ Local Functions ]] +local function sendPI(pChoiceVR, pExpResult) + local params1 = { + initialText = "StartPerformInteraction", + initialPrompt = initialPromptValue, + interactionMode = "VR_ONLY", + interactionChoiceSetIDList = { 100 }, + helpPrompt = helpPromptValue, + timeoutPrompt = timeoutPromptValue, + timeout = 5000, + vrHelp = { { text = pChoiceVR, position = 1 } } + } + local cid = common.getMobileSession():SendRPC("PerformInteraction", params1) + local success = true + if pExpResult ~= "SUCCESS" then success = false end + common.getMobileSession():ExpectResponse(cid, { success = success, resultCode = pExpResult }) +end + +local function PI_ViaVR_ONLY() + sendPI("ChoiceVR1", "SUCCESS") + common.runAfter(function() sendPI("ChoiceVR2", "REJECTED") end, 500) + common.getHMIConnection():ExpectRequest("UI.ClosePopUp", { methodName = "UI.PerformInteraction" }) + :Times(0) + common.getHMIConnection():ExpectRequest("VR.PerformInteraction") + :Do(function(exp, data) + if exp.occurences == 1 then + common.runAfter(function() + common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", + { choiceID = 100 }) + end, 1500) + else + common.getHMIConnection():SendError(data.id, data.method, "REJECTED", + "VR.PerformInteraction is already in progress") + end + end) + :Times(2) + + common.getHMIConnection():ExpectRequest("UI.PerformInteraction") + :Do(function(exp, data) + if exp.occurences == 1 then + common.runAfter(function() + common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", { }) + end, 1000) + else + common.getHMIConnection():SendError(data.id, data.method, "REJECTED", + "UI.PerformInteraction is already in progress") + end + end) + :Times(2) + + utils.wait(5000) +end + +--[[ Scenario ]] +common.Title("Preconditions") +common.Step("Clean environment", common.preconditions) +common.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +common.Step("Register App", common.registerApp) +common.Step("Activate App", common.activateApp) +common.Step("CreateInteractionChoiceSet with id 100", common.createInteractionChoiceSet, { 100 }) + +common.Title("Test") +common.Step("Two PerformInteraction requests with VR_ONLY", PI_ViaVR_ONLY) + +common.Title("Postconditions") +common.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/Defects/8_1/3838/3838_4_SDL_sends_UI.ClosePopUp_VR_ONLY_mode_in_case_VR.PerformInteraction_without_choiceID.lua b/test_scripts/Defects/8_1/3838/3838_4_SDL_sends_UI.ClosePopUp_VR_ONLY_mode_in_case_VR.PerformInteraction_without_choiceID.lua new file mode 100644 index 0000000000..581abbcc9e --- /dev/null +++ b/test_scripts/Defects/8_1/3838/3838_4_SDL_sends_UI.ClosePopUp_VR_ONLY_mode_in_case_VR.PerformInteraction_without_choiceID.lua @@ -0,0 +1,105 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/SmartDeviceLink/sdl_core/issues/3838 +--------------------------------------------------------------------------------------------------- +-- Description: Check that SDL sends UI.ClosePopUp to HMI in case: +-- - mobile App sends PerformInteraction request with VR_ONLY interaction mode to SDL +-- - HMI responds with 'SUCCESS' to VR.PerformInteraction requests before UI.PerformInteraction response from HMI +-- +-- Pre-conditions: +-- 1. SDL, HMI, Mobile session are started +-- 2. App is registered and activated +-- 3. CreateInteractionChoiceSet is added +-- +-- Steps: +-- 1. App sends PerformInteraction request with VR_ONLY interaction mode to SDL +-- 2. HMI responds with 'SUCCESS' to VR.PerformInteraction request +-- SDL does: +-- - send UI.ClosePopUp request to HMI +-- - send PerformInteraction response (resultCode: SUCCESS, success:true) to mobile App +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local common = require("test_scripts/Defects/8_1/3838/common") + +--[[ Local Variables ]] +local initialPromptValue = common.getPromptValue(" Make your choice ") + +local helpPromptValue = common.getPromptValue(" Help Prompt ") + +local timeoutPromptValue = common.getPromptValue(" Time out ") + +local vrHelpvalue = { + { + text = " New VRHelp ", + position = 1 + } +} + +local requestParams = { + initialText = "StartPerformInteraction", + initialPrompt = initialPromptValue, + interactionMode = "VR_ONLY", + interactionChoiceSetIDList = { 100 }, + helpPrompt = helpPromptValue, + timeoutPrompt = timeoutPromptValue, + timeout = 5000, + vrHelp = vrHelpvalue, + interactionLayout = "ICON_ONLY" +} + +--[[ Local Functions ]] +local function PI_ViaVR_ONLY(pParams, pChoiceID) + local cid = common.getMobileSession():SendRPC("PerformInteraction", pParams) + + common.getHMIConnection():ExpectRequest("VR.PerformInteraction", { + helpPrompt = pParams.helpPrompt, + initialPrompt = pParams.initialPrompt, + timeout = pParams.timeout, + timeoutPrompt = pParams.timeoutPrompt + }) + :Do(function(_, data) + local function vrResponse() + common.getHMIConnection():SendNotification("TTS.Started") + common.getHMIConnection():SendNotification("VR.Started") + common.sendOnSystemContext("VRSESSION") + common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", + { choiceID = pChoiceID }) + common.getHMIConnection():SendNotification("TTS.Stopped") + common.getHMIConnection():SendNotification("VR.Stopped") + common.sendOnSystemContext("MAIN") + end + common.runAfter(vrResponse, 1000) + end) + + common.getHMIConnection():ExpectRequest("UI.PerformInteraction", { + timeout = pParams.timeout, + vrHelp = pParams.vrHelp, + vrHelpTitle = pParams.initialText, + }) + :Do(function(_,data) + common.getHMIConnection():ExpectRequest("UI.ClosePopUp", { methodName = "UI.PerformInteraction" }) + :Do(function() + common.getHMIConnection():SendError(data.id, data.method, "ABORTED", "Error message") + end) + end) + common.expectOnHMIStatusWithAudioStateChanged_PI("VR") + common.getMobileSession():ExpectResponse(cid, { + success = true, resultCode = "SUCCESS", choiceID = pChoiceID + }) +end + +--[[ Scenario ]] +common.Title("Preconditions") +common.Step("Clean environment", common.preconditions) +common.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +common.Step("Register App", common.registerApp) +common.Step("Activate App", common.activateApp) +common.Step("CreateInteractionChoiceSet with id 100", common.createInteractionChoiceSet, { 100 }) + +common.Title("Test") +common.Step("PerformInteraction with VR_ONLY interaction mode, with choiceID from VR response", + PI_ViaVR_ONLY, { requestParams, requestParams.interactionChoiceSetIDList[1] }) +common.Step("PerformInteraction with VR_ONLY interaction mode, without choiceID from VR response", + PI_ViaVR_ONLY, { requestParams }) + +common.Title("Postconditions") +common.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/Defects/8_1/3838/3838_5_SDL_does_not_send_UI.ClosePopUp_BOTH_mode_in_case_VR.PerformInteraction_without_choiceID.lua b/test_scripts/Defects/8_1/3838/3838_5_SDL_does_not_send_UI.ClosePopUp_BOTH_mode_in_case_VR.PerformInteraction_without_choiceID.lua new file mode 100644 index 0000000000..0ce6cb721b --- /dev/null +++ b/test_scripts/Defects/8_1/3838/3838_5_SDL_does_not_send_UI.ClosePopUp_BOTH_mode_in_case_VR.PerformInteraction_without_choiceID.lua @@ -0,0 +1,124 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/SmartDeviceLink/sdl_core/issues/3838 +--------------------------------------------------------------------------------------------------- +-- Description: Check that SDL does not send UI.ClosePopUp to HMI in case: +-- - mobile App sends PerformInteraction request with BOTH interaction mode to SDL +-- - HMI responds with 'SUCCESS' to VR.PerformInteraction request without choiceID +-- +-- Pre-conditions: +-- 1. SDL, HMI, Mobile session are started +-- 2. App is registered and activated +-- 3. CreateInteractionChoiceSet is added +-- +-- Steps: +-- 1. App sends PerformInteraction request with BOTH interaction mode to SDL +-- 2. HMI responds with 'SUCCESS' to VR.PerformInteraction request without choiceID +-- SDL does: +-- - not send UI.ClosePopUp request to HMI +-- - send PerformInteraction response (resultCode: SUCCESS, success:true) to mobile App +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local common = require("test_scripts/Defects/8_1/3838/common") + +--[[ Local Variables ]] +local initialPromptValue = common.getPromptValue(" Make your choice ") + +local helpPromptValue = common.getPromptValue(" Help Prompt ") + +local timeoutPromptValue = common.getPromptValue(" Time out ") + +local vrHelpvalue = { + { + text = " New VRHelp ", + position = 1 + } +} + +local requestParams = { + initialText = "StartPerformInteraction", + initialPrompt = initialPromptValue, + interactionMode = "BOTH", + interactionChoiceSetIDList = { 100 }, + helpPrompt = helpPromptValue, + timeoutPrompt = timeoutPromptValue, + timeout = 5000, + vrHelp = vrHelpvalue, + interactionLayout = "ICON_ONLY" +} + +--[[ Local Functions ]] +local function setExChoiceSet(pChoiceIDValues) + local exChoiceSet = { } + for i = 1, #pChoiceIDValues do + exChoiceSet[i] = { + choiceID = pChoiceIDValues[i], + menuName = "Choice" .. pChoiceIDValues[i] + } + end + return exChoiceSet +end + +local function PI_ViaBOTH(pParams) + local cid = common.getMobileSession():SendRPC("PerformInteraction",pParams) + common.getHMIConnection():ExpectRequest("UI.ClosePopUp", { methodName = "UI.PerformInteraction" }):Times(0) + common.getHMIConnection():ExpectRequest("VR.PerformInteraction", { + helpPrompt = pParams.helpPrompt, + initialPrompt = pParams.initialPrompt, + timeout = pParams.timeout, + timeoutPrompt = pParams.timeoutPrompt + }) + :Do(function(_,data) + common.getHMIConnection():SendNotification("VR.Started") + common.getHMIConnection():SendNotification("TTS.Started") + common.sendOnSystemContext("VRSESSION") + local function firstSpeakTimeOut() + common.getHMIConnection():SendNotification("TTS.Stopped") + end + common.runAfter(firstSpeakTimeOut, 5) + local function vrResponse() + common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS") -- without choiceID + common.getHMIConnection():SendNotification("VR.Stopped") + end + common.runAfter(vrResponse, 2000) + end) + common.getHMIConnection():ExpectRequest("UI.PerformInteraction", { + timeout = pParams.timeout, + choiceSet = setExChoiceSet(pParams.interactionChoiceSetIDList), + initialText = { + fieldName = "initialInteractionText", + fieldText = pParams.initialText + }, + vrHelp = pParams.vrHelp, + vrHelpTitle = pParams.initialText + }) + :Do(function(_,data) + local function choiceIconDisplayed() + common.sendOnSystemContext("HMI_OBSCURED") + end + common.runAfter(choiceIconDisplayed, 2050) + local function uiResponse() + common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", + { choiceID = pParams.interactionChoiceSetIDList[1] }) + common.sendOnSystemContext("MAIN") + end + common.runAfter(uiResponse, 3000) + end) + common.expectOnHMIStatusWithAudioStateChanged_PI("BOTH") + common.getMobileSession():ExpectResponse(cid, { success = true, resultCode = "SUCCESS", + choiceID = pParams.interactionChoiceSetIDList[1], triggerSource = "MENU" }) +end + +--[[ Scenario ]] +common.Title("Preconditions") +common.Step("Clean environment", common.preconditions) +common.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +common.Step("Register App", common.registerApp) +common.Step("Activate App", common.activateApp) +common.Step("CreateInteractionChoiceSet with id 100", common.createInteractionChoiceSet, { 100 }) + +common.Title("Test") +common.Step("PerformInteraction with BOTH interaction mode, without choiceID from VR response", + PI_ViaBOTH, { requestParams }) + +common.Title("Postconditions") +common.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/Defects/8_1/3838/common.lua b/test_scripts/Defects/8_1/3838/common.lua new file mode 100644 index 0000000000..9b35ce29a6 --- /dev/null +++ b/test_scripts/Defects/8_1/3838/common.lua @@ -0,0 +1,100 @@ +--------------------------------------------------------------------------------------------------- +-- Common module for tests of https://github.com/SmartDeviceLink/sdl_core/issues/3838 issue +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local actions = require("user_modules/sequences/actions") + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Module ]] +local m = { } + +--[[ Proxy Functions ]] +m.Title = runner.Title +m.Step = runner.Step +m.preconditions = actions.preconditions +m.postconditions = actions.postconditions +m.start = actions.start +m.registerApp = actions.registerApp +m.activateApp = actions.activateApp +m.getMobileSession = actions.getMobileSession +m.getHMIConnection = actions.getHMIConnection +m.runAfter = actions.run.runAfter + +--[[ Local Functions ]] +local function setChoiceSet(pChoiceIDValue) + local temp = { + { + choiceID = pChoiceIDValue, + menuName = "Choice" .. tostring(pChoiceIDValue), + vrCommands = { + "VrChoice" .. tostring(pChoiceIDValue), + } + } + } + return temp +end + +--[[ Common Functions ]] +function m.getPromptValue(pText) + return { + { + text = pText, + type = "TEXT" + } + } +end + +function m.sendOnSystemContext(pCtx) + actions.getHMIConnection():SendNotification("UI.OnSystemContext", { + appID = actions.getHMIAppId(), + systemContext = pCtx + }) +end + +function m.expectOnHMIStatusWithAudioStateChanged_PI(pRequest) + if pRequest == "BOTH" then + actions.getMobileSession():ExpectNotification("OnHMIStatus", + { hmiLevel = "FULL", audioStreamingState = "NOT_AUDIBLE", systemContext = "MAIN" }, + { hmiLevel = "FULL", audioStreamingState = "NOT_AUDIBLE", systemContext = "VRSESSION" }, + { hmiLevel = "FULL", audioStreamingState = "AUDIBLE", systemContext = "VRSESSION" }, + { hmiLevel = "FULL", audioStreamingState = "AUDIBLE", systemContext = "HMI_OBSCURED" }, + { hmiLevel = "FULL", audioStreamingState = "AUDIBLE", systemContext = "MAIN" }) + :Times(5) + elseif pRequest == "VR" then + actions.getMobileSession():ExpectNotification("OnHMIStatus", + { systemContext = "MAIN", hmiLevel = "FULL", audioStreamingState = "ATTENUATED" }, + { systemContext = "MAIN", hmiLevel = "FULL", audioStreamingState = "NOT_AUDIBLE" }, + { systemContext = "VRSESSION", hmiLevel = "FULL", audioStreamingState = "NOT_AUDIBLE" }, + { systemContext = "VRSESSION", hmiLevel = "FULL", audioStreamingState = "AUDIBLE" }, + { systemContext = "MAIN", hmiLevel = "FULL", audioStreamingState = "AUDIBLE" }) + :Times(5) + elseif pRequest == "MANUAL" then + actions.getMobileSession():ExpectNotification("OnHMIStatus", + { systemContext = "MAIN", hmiLevel = "FULL", audioStreamingState = "ATTENUATED" }, + { systemContext = "HMI_OBSCURED", hmiLevel = "FULL", audioStreamingState = "ATTENUATED" }, + { systemContext = "HMI_OBSCURED", hmiLevel = "FULL", audioStreamingState = "AUDIBLE" }, + { systemContext = "MAIN", hmiLevel = "FULL", audioStreamingState = "AUDIBLE" }) + :Times(4) + end +end + +function m.createInteractionChoiceSet(pChoiceSetID) + local cid = actions.getMobileSession():SendRPC("CreateInteractionChoiceSet", { + interactionChoiceSetID = pChoiceSetID, + choiceSet = setChoiceSet(pChoiceSetID), + }) + actions.getHMIConnection():ExpectRequest("VR.AddCommand", { + cmdID = pChoiceSetID, + type = "Choice", + vrCommands = { "VrChoice" .. tostring(pChoiceSetID) } + }) + :Do(function(_, data) + actions.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", { }) + end) + actions.getMobileSession():ExpectResponse(cid, { resultCode = "SUCCESS", success = true }) +end + +return m diff --git a/test_scripts/Defects/8_1/3845/3845_1_PerformAudioPassThru_custom_success_codes_to_ui.lua b/test_scripts/Defects/8_1/3845/3845_1_PerformAudioPassThru_custom_success_codes_to_ui.lua new file mode 100644 index 0000000000..03d4dc31bb --- /dev/null +++ b/test_scripts/Defects/8_1/3845/3845_1_PerformAudioPassThru_custom_success_codes_to_ui.lua @@ -0,0 +1,44 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/smartdevicelink/sdl_core/issues/3845 +--------------------------------------------------------------------------------------------------- +-- Description: SDL responds with success = true to mobile app in case of receiving the next result codes from HMI: +-- "UNSUPPORTED_RESOURCE", "WARNINGS", "RETRY", "SAVED", "WRONG_LANGUAGE", "TRUNCATED_DATA" +-- +-- Steps: +-- 1. HMI and SDL are started +-- 2. Mobile app is registered and activated +-- 3. Mobile app requests PerformAudioPassThru RPC +-- 4. HMI responds with SUCCESS result to TTS.Speak request +-- 5. HMI responds to UI.PerformAudioPassThru request in result structure with one of result code: +-- "UNSUPPORTED_RESOURCE", "WARNINGS", "RETRY", "SAVED", "WRONG_LANGUAGE", "TRUNCATED_DATA" +-- SDL does: +-- - send PerformAudioPassThru(resultCode = , success = true) response to mobile app +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/Defects/8_1/3845/common_3845') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("Register App", common.registerApp) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +for tc, resultCode in ipairs(common.tcs) do + local responses = { + speak = { code = "SUCCESS", structure = common.responsesStructures.result }, + performAudioPassThru = { code = resultCode, structure = common.responsesStructures.result }, + general = resultCode + } + runner.Title("Test case [" .. string.format("%02d", tc) .. "]: '" .. tostring(resultCode) .. "'") + runner.Step("PerformAudioPassThru response with success=true", common.performAudioPassThru, { responses }) +end + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/Defects/8_1/3845/3845_2_PerformAudioPassThru_custom_success_codes_to_tts.lua b/test_scripts/Defects/8_1/3845/3845_2_PerformAudioPassThru_custom_success_codes_to_tts.lua new file mode 100644 index 0000000000..88996f2d1c --- /dev/null +++ b/test_scripts/Defects/8_1/3845/3845_2_PerformAudioPassThru_custom_success_codes_to_tts.lua @@ -0,0 +1,44 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/smartdevicelink/sdl_core/issues/3845 +--------------------------------------------------------------------------------------------------- +-- Description: SDL responds with resultCode = WARNINGS and success = true to mobile app in case +-- HMI responds with not "SUCCESS" result code to TTS.Speak request in result structure +-- +-- Steps: +-- 1. HMI and SDL are started +-- 2. Mobile app is registered and activated +-- 3. Mobile app requests PerformAudioPassThru RPC +-- 4. HMI responds to TTS.Speak request in result structure with one of result code: +-- "UNSUPPORTED_RESOURCE", "WARNINGS", "RETRY", "SAVED", "WRONG_LANGUAGE", "TRUNCATED_DATA" +-- 5. HMI responds with "SUCCESS" to UI.PerformAudioPassThru request +-- SDL does: +-- - send PerformAudioPassThru(resultCode = "WARNINGS", success = true) response to mobile app +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/Defects/8_1/3845/common_3845') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("Register App", common.registerApp) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +for tc, resultCode in ipairs(common.tcs) do + local responses = { + speak = { code = resultCode, structure = common.responsesStructures.result }, + performAudioPassThru = { code = "SUCCESS", structure = common.responsesStructures.result }, + general = "WARNINGS" + } + runner.Title("Test case [" .. string.format("%02d", tc) .. "]: '" .. tostring(resultCode) .. "'") + runner.Step("PerformAudioPassThru response with success=true", common.performAudioPassThru, { responses }) +end + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/Defects/8_1/3845/3845_3_PerformAudioPassThru_custom_success_codes_to_tts_and_ui.lua b/test_scripts/Defects/8_1/3845/3845_3_PerformAudioPassThru_custom_success_codes_to_tts_and_ui.lua new file mode 100644 index 0000000000..07606c4485 --- /dev/null +++ b/test_scripts/Defects/8_1/3845/3845_3_PerformAudioPassThru_custom_success_codes_to_tts_and_ui.lua @@ -0,0 +1,46 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/smartdevicelink/sdl_core/issues/3845 +--------------------------------------------------------------------------------------------------- +-- Description: SDL responds with success = true to mobile app in case +-- HMI responds with not "SUCCESS" result code to TTS.Speak and UI.PerformAudioPassThru requests +-- in result structure +-- +-- Steps: +-- 1. HMI and SDL are started +-- 2. Mobile app is registered and activated +-- 3. Mobile app requests PerformAudioPassThru RPC +-- 4. HMI responds to TTS.Speak and UI.PerformAudioPassThr requests in result structure with one of result code: +-- "UNSUPPORTED_RESOURCE", "WARNINGS", "RETRY", "SAVED", "WRONG_LANGUAGE", "TRUNCATED_DATA" +-- SDL does: +-- - send PerformAudioPassThru(resultCode = , success = true) response to mobile app +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/Defects/8_1/3845/common_3845') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("Register App", common.registerApp) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +for _, resultCodeUI in ipairs(common.tcs) do + for _, resultCodeSpeak in ipairs(common.tcs) do + local responses = { + speak = { code = resultCodeSpeak, structure = common.responsesStructures.result }, + performAudioPassThru = { code = resultCodeUI, structure = common.responsesStructures.result }, + general = resultCodeUI + } + runner.Title("Test case: '" .. tostring(resultCodeSpeak) .. "' to tts, '" .. tostring(resultCodeUI) .. "' to ui") + runner.Step("PerformAudioPassThru response with success=true", common.performAudioPassThru, { responses }) + end +end + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/Defects/8_1/3845/3845_4_PerformAudioPassThru_custom_success_codes_in_error_structure_to_ui.lua b/test_scripts/Defects/8_1/3845/3845_4_PerformAudioPassThru_custom_success_codes_in_error_structure_to_ui.lua new file mode 100644 index 0000000000..677da82b13 --- /dev/null +++ b/test_scripts/Defects/8_1/3845/3845_4_PerformAudioPassThru_custom_success_codes_in_error_structure_to_ui.lua @@ -0,0 +1,44 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/smartdevicelink/sdl_core/issues/3845 +--------------------------------------------------------------------------------------------------- +-- Description: SDL responds with success = true to mobile app in case of receiving the next result codes from HMI +-- in error structure: "UNSUPPORTED_RESOURCE", "WARNINGS", "RETRY", "SAVED", "WRONG_LANGUAGE", "TRUNCATED_DATA" +-- +-- Steps: +-- 1. HMI and SDL are started +-- 2. Mobile app is registered and activated +-- 3. Mobile app requests PerformAudioPassThru RPC +-- 4. HMI responds with SUCCESS result to TTS.Speak request +-- 5. HMI responds to UI.PerformAudioPassThru request in error structure with one of result code: +-- "UNSUPPORTED_RESOURCE", "WARNINGS", "RETRY", "SAVED", "WRONG_LANGUAGE", "TRUNCATED_DATA" +-- SDL does: +-- - send PerformAudioPassThru(resultCode = , success = true) response to mobile app +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/Defects/8_1/3845/common_3845') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("Register App", common.registerApp) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +for tc, resultCode in ipairs(common.tcs) do + local responses = { + speak = { code = "SUCCESS", structure = common.responsesStructures.result }, + performAudioPassThru = { code = resultCode, structure = common.responsesStructures.error }, + general = resultCode + } + runner.Title("Test case [" .. string.format("%02d", tc) .. "]: '" .. tostring(resultCode) .. "'") + runner.Step("PerformAudioPassThru response with success=true", common.performAudioPassThru, { responses }) +end + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/Defects/8_1/3845/3845_5_PerformAudioPassThru_custom_success_codes_in_error_structure_to_tts.lua b/test_scripts/Defects/8_1/3845/3845_5_PerformAudioPassThru_custom_success_codes_in_error_structure_to_tts.lua new file mode 100644 index 0000000000..1cf7638bcb --- /dev/null +++ b/test_scripts/Defects/8_1/3845/3845_5_PerformAudioPassThru_custom_success_codes_in_error_structure_to_tts.lua @@ -0,0 +1,44 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/smartdevicelink/sdl_core/issues/3845 +--------------------------------------------------------------------------------------------------- +-- Description: SDL responds with resultCode = WARNINGS and success = true to mobile app in case +-- HMI responds with not "SUCCESS" result code to TTS.Speak request in error structure +-- +-- Steps: +-- 1. HMI and SDL are started +-- 2. Mobile app is registered and activated +-- 3. Mobile app requests PerformAudioPassThru RPC +-- 4. HMI responds to TTS.Speak request in error structure with one of result code: +-- "UNSUPPORTED_RESOURCE", "WARNINGS", "RETRY", "SAVED", "WRONG_LANGUAGE", "TRUNCATED_DATA" +-- 5. HMI responds with "SUCCESS" to UI.PerformAudioPassThru request +-- SDL does: +-- - send PerformAudioPassThru(resultCode = "WARNINGS", success = true) response to mobile app +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/Defects/8_1/3845/common_3845') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("Register App", common.registerApp) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +for tc, resultCode in ipairs(common.tcs) do + local responses = { + speak = { code = resultCode, structure = common.responsesStructures.error }, + performAudioPassThru = { code = "SUCCESS", structure = common.responsesStructures.result }, + general = "WARNINGS" + } + runner.Title("Test case [" .. string.format("%02d", tc) .. "]: '" .. tostring(resultCode) .. "'") + runner.Step("PerformAudioPassThru response with success=true", common.performAudioPassThru, { responses }) +end + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/Defects/8_1/3845/3845_6_PerformAudioPassThru_custom_success_codes_in_error_structure_to_tts_and_ui.lua b/test_scripts/Defects/8_1/3845/3845_6_PerformAudioPassThru_custom_success_codes_in_error_structure_to_tts_and_ui.lua new file mode 100644 index 0000000000..a1bddaef2b --- /dev/null +++ b/test_scripts/Defects/8_1/3845/3845_6_PerformAudioPassThru_custom_success_codes_in_error_structure_to_tts_and_ui.lua @@ -0,0 +1,46 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/smartdevicelink/sdl_core/issues/3845 +--------------------------------------------------------------------------------------------------- +-- Description: SDL responds with success = true to mobile app in case +-- HMI responds with not "SUCCESS" result code to TTS.Speak and UI.PerformAudioPassThru requests +-- in error structure +-- +-- Steps: +-- 1. HMI and SDL are started +-- 2. Mobile app is registered and activated +-- 3. Mobile app requests PerformAudioPassThru RPC +-- 4. HMI responds to TTS.Speak and UI.PerformAudioPassThr requests in error structure with one of result code: +-- "UNSUPPORTED_RESOURCE", "WARNINGS", "RETRY", "SAVED", "WRONG_LANGUAGE", "TRUNCATED_DATA" +-- SDL does: +-- - send PerformAudioPassThru(resultCode = , success = true) response to mobile app +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/Defects/8_1/3845/common_3845') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("Register App", common.registerApp) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +for _, resultCodeUI in ipairs(common.tcs) do + for _, resultCodeSpeak in ipairs(common.tcs) do + local responses = { + speak = { code = resultCodeSpeak, structure = common.responsesStructures.error }, + performAudioPassThru = { code = resultCodeUI, structure = common.responsesStructures.error }, + general = resultCodeUI + } + runner.Title("Test case: '" .. tostring(resultCodeSpeak) .. "' to tts, '" .. tostring(resultCodeUI) .. "' to ui") + runner.Step("PerformAudioPassThru response with success=true", common.performAudioPassThru, { responses }) + end +end + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/Defects/8_1/3845/common_3845.lua b/test_scripts/Defects/8_1/3845/common_3845.lua new file mode 100644 index 0000000000..8a360c6e00 --- /dev/null +++ b/test_scripts/Defects/8_1/3845/common_3845.lua @@ -0,0 +1,116 @@ +--------------------------------------------------------------------------------------------------- +-- Common module +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local actions = require("user_modules/sequences/actions") +local utils = require('user_modules/utils') +local SDL = require('SDL') + +--[[ Module ]] +local m = {} + +--[[ Proxy Functions ]] +m.start = actions.start +m.preconditions = actions.preconditions +m.postconditions = actions.postconditions +m.getMobileSession = actions.getMobileSession +m.getHMIConnection = actions.getHMIConnection +m.registerApp = actions.registerApp +m.activateApp = actions.activateApp +m.runAfter = actions.run.runAfter +m.getHMIAppId = actions.app.getHMIId +m.SDLStoragePath = SDL.AppStorage.path + +--[[ Common Variables ]] +m.tcs = { + [01] = "UNSUPPORTED_RESOURCE", + [02] = "WARNINGS", + [03] = "RETRY", + [04] = "SAVED", + [05] = "WRONG_LANGUAGE", + [06] = "TRUNCATED_DATA" +} + +m.responsesStructures = { + result = function(data, code) m.getHMIConnection():SendResponse(data.id, data.method, code, {}) end, + error = function(data, code) m.getHMIConnection():SendError(data.id, data.method, code, "Error message") end +} + +--[[ Local Variables ]] +local requestParams = { + initialPrompt = { + { + text = "Makeyourchoice", + type = "TEXT", + }, + }, + audioPassThruDisplayText1 = "DisplayText1", + samplingRate = "8KHZ", + maxDuration = 2000, + bitsPerSample = "8_BIT", + audioType = "PCM" +} + +local requestUIparams = { + audioPassThruDisplayTexts = { + { fieldName = "audioPassThruDisplayText1", fieldText = requestParams.audioPassThruDisplayText1 } + }, + maxDuration = requestParams.maxDuration, + muteAudio = requestParams.muteAudio +} + +local requestTTSparams = { + ttsChunks = requestParams.initialPrompt, + speakType = "AUDIO_PASS_THRU" +} + +local allParams = { + requestParams = requestParams, + requestUIparams = requestUIparams, + requestTTSparams = requestTTSparams +} + +--[[ Common Functions ]] +local function sendOnSystemContext(pCtx) + m.getHMIConnection():SendNotification("UI.OnSystemContext", { appID = m.getHMIAppId(), systemContext = pCtx }) +end + +function m.performAudioPassThru(pResult) + local cid = m.getMobileSession():SendRPC("PerformAudioPassThru", allParams.requestParams) + allParams.requestUIparams.appID = m.getHMIAppId() + m.getHMIConnection():ExpectRequest("TTS.Speak", allParams.requestTTSparams) + :Do(function(_, data) + m.getHMIConnection():SendNotification("TTS.Started") + local function ttsSpeakResponse() + pResult.speak.structure(data, pResult.speak.code) + m.getHMIConnection():SendNotification("TTS.Stopped") + end + m.runAfter(ttsSpeakResponse, 100) + end) + m.getHMIConnection():ExpectRequest("UI.PerformAudioPassThru", allParams.requestUIparams) + :Do(function(_, data) + sendOnSystemContext("HMI_OBSCURED", allParams.requestUIparams.appID) + local function uiResponse() + pResult.performAudioPassThru.structure(data, pResult.performAudioPassThru.code) + sendOnSystemContext("MAIN", allParams.requestUIparams.appID) + end + m.runAfter(uiResponse, 1500) + end) + m.getHMIConnection():ExpectNotification("UI.OnRecordStart", { appID = m.getHMIAppId() }) + m.getMobileSession():ExpectNotification("OnHMIStatus", + { hmiLevel = "FULL", audioStreamingState = "ATTENUATED", systemContext = "MAIN" }, + { hmiLevel = "FULL", audioStreamingState = "ATTENUATED", systemContext = "HMI_OBSCURED" }, + { hmiLevel = "FULL", audioStreamingState = "AUDIBLE", systemContext = "HMI_OBSCURED" }, -- after PerformAudioPassThruResponse before OnSysCtx(MAIN) + { hmiLevel = "FULL", audioStreamingState = "AUDIBLE", systemContext = "MAIN" }) + :Times(4) + m.getMobileSession():ExpectNotification("OnAudioPassThru") + m.getMobileSession():ExpectResponse(cid, { success = true, resultCode = pResult.general }) + :ValidIf(function() + if utils.isFileExist(m.SDLStoragePath("audio.wav")) ~= true then + return false, "Can not found file: audio.wav" + end + return true + end) +end + +return m diff --git a/test_scripts/Defects/8_1/3880_1_PTU_Empty_endpoint_properties.lua b/test_scripts/Defects/8_1/3880_1_PTU_Empty_endpoint_properties.lua new file mode 100644 index 0000000000..bfed61bc1f --- /dev/null +++ b/test_scripts/Defects/8_1/3880_1_PTU_Empty_endpoint_properties.lua @@ -0,0 +1,88 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/smartdevicelink/sdl_core/pull/3880 +--------------------------------------------------------------------------------------------------- +-- Description: Checks if endpoint_properties is cleared in the policy storage database in case of a +-- PTU with empty endpoint_properties +-- +-- Preconditions: +-- 1) SDL, HMI, Mobile session are started +-- 2) App1 is registered +-- SDL does: +-- - Trigger a PTU +-- +-- Steps: +-- 1) Send PTU with empty endpoint_properties +-- SDL does: +-- - Successfully apply the received PTU +-- 2) Check policy.sqlite database in storage folder. +-- endpoint_properties table is cleared +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('user_modules/sequences/actions') +local utils = require("user_modules/utils") +local consts = require("user_modules/consts") +local json = require("modules/json") + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false +runner.testSettings.restrictions.sdlBuildOptions = { { extendedPolicy = { "PROPRIETARY", "EXTERNAL_PROPRIETARY" } } } + +--[[ Local Variables ]] +local endpointQueryString = "SELECT * FROM endpoint_properties" + +--[[ Local Functions ]] +local function PTUEmptyEndpointProperties(tbl) + tbl.policy_table.module_config.endpoint_properties = {} +end + +local function constructPathToDatabase() + if utils.isFileExist(config.pathToSDL .. "storage/policy.sqlite") then + return config.pathToSDL .. "storage/policy.sqlite" + else + utils.cprint(consts.color.red, "policy.sqlite is not found" ) + return nil + end +end + +local function executeSqliteQuery(rawQueryString, dbFilePath) + if not dbFilePath then + return nil + end + local queryExecutionResult = {} + local queryString = table.concat({"sqlite3 ", dbFilePath, " '", rawQueryString, "'"}) + local file = io.popen(queryString, 'r') + if file then + local index = 1 + for line in file:lines() do + queryExecutionResult[index] = line + index = index + 1 + end + file:close() + return queryExecutionResult + else + return nil + end +end + +local function checkDBEndpointProperties(pExp, pFailMsg) + utils.wait(5000) + PtEndpointPropertiesValue = executeSqliteQuery(endpointQueryString, constructPathToDatabase()) + if not utils.isTableEqual(PtEndpointPropertiesValue, pExp) then + common.run.fail(pFailMsg) + end +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("App registration", common.registerAppWOPTU, { 1 }) + +runner.Title("Test empty endpoint_properties") +runner.Step("PTU with empty endpoint_properties", common.policyTableUpdate, { PTUEmptyEndpointProperties }) +runner.Step("Check values in policy db", checkDBEndpointProperties, + {json.EMPTY_OBJECT, "Endpoint properties NOT overwritten in policy DB"}) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/Defects/8_1/3880_2_PTU_Omitted_endpoint_properties.lua b/test_scripts/Defects/8_1/3880_2_PTU_Omitted_endpoint_properties.lua new file mode 100644 index 0000000000..0a5b89d7e2 --- /dev/null +++ b/test_scripts/Defects/8_1/3880_2_PTU_Omitted_endpoint_properties.lua @@ -0,0 +1,91 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/smartdevicelink/sdl_core/pull/3880 +--------------------------------------------------------------------------------------------------- +-- Description: Checks if endpoint_properties is NOT cleared in the policy storage database in case of a +-- PTU with empty (not omitted) endpoint_properties +-- +-- Preconditions: +-- 1) SDL, HMI, Mobile session are started +-- 2) App1 is registered +-- SDL does: +-- - Trigger a PTU +-- +-- Steps: +-- 1) Send PTU with endpoint_properties omitted +-- SDL does: +-- - Successfully apply the received PTU +-- 2) Check policy.sqlite database in storage folder. +-- endpoint_properties table is NOT cleared +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('user_modules/sequences/actions') +local utils = require("user_modules/utils") +local consts = require("user_modules/consts") +local json = require("modules/json") + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false +runner.testSettings.restrictions.sdlBuildOptions = { { extendedPolicy = { "PROPRIETARY", "EXTERNAL_PROPRIETARY" } } } + +--[[ Local Variables ]] +local endpointQueryString = "SELECT * FROM endpoint_properties" +local defaultEndpointProperties = { + [1] = "custom_vehicle_data_mapping_url|0.0.0" +} + +--[[ Local Functions ]] +local function PTUOmittedEndpointProperties(tbl) + tbl.policy_table.module_config["endpoint_properties"] = nil +end + +local function constructPathToDatabase() + if utils.isFileExist(config.pathToSDL .. "storage/policy.sqlite") then + return config.pathToSDL .. "storage/policy.sqlite" + else + utils.cprint(consts.color.red, "policy.sqlite is not found" ) + return nil + end +end + +local function executeSqliteQuery(rawQueryString, dbFilePath) + if not dbFilePath then + return nil + end + local queryExecutionResult = {} + local queryString = table.concat({"sqlite3 ", dbFilePath, " '", rawQueryString, "'"}) + local file = io.popen(queryString, 'r') + if file then + local index = 1 + for line in file:lines() do + queryExecutionResult[index] = line + index = index + 1 + end + file:close() + return queryExecutionResult + else + return nil + end +end + +local function checkDBEndpointProperties(pExp, pFailMsg) + utils.wait(5000) + PtEndpointPropertiesValue = executeSqliteQuery(endpointQueryString, constructPathToDatabase()) + if not utils.isTableEqual(PtEndpointPropertiesValue, pExp) then + common.run.fail(pFailMsg) + end +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("App registration", common.registerAppWOPTU, { 1 }) + +runner.Title("Test omitted endpoint_properties") +runner.Step("PTU with omitted endpoint_properties", common.policyTableUpdate, { PTUOmittedEndpointProperties }) +runner.Step("Check values in policy db", checkDBEndpointProperties, + {defaultEndpointProperties, "Endpoint properties overwritten in policy DB"}) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/Defects/8_1/980_SDL_responds_INVALID_DATA_in_case_soft_button_has_Type_Image_or_Both_and_Text_has_specific_string.lua b/test_scripts/Defects/8_1/980_SDL_responds_INVALID_DATA_in_case_soft_button_has_Type_Image_or_Both_and_Text_has_specific_string.lua new file mode 100644 index 0000000000..f147bcdf73 --- /dev/null +++ b/test_scripts/Defects/8_1/980_SDL_responds_INVALID_DATA_in_case_soft_button_has_Type_Image_or_Both_and_Text_has_specific_string.lua @@ -0,0 +1,169 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/smartdevicelink/sdl_core/issues/980 +--------------------------------------------------------------------------------------------------- +-- Description: Check that SDL responds INVALID_DATA in case soft button has Type(Image or Both) +-- and Text is whitespace or \t or \n or empty +-- +-- Precondition: +-- 1) AlertManeuver is allowed by policy +-- 2) SDL, HMI, Mobile session are started +-- 3) App is registered and activated +-- In case: +-- 1) App sends AlertManeuver with soft button (type = Image or Both and Text = whitespace or \t or \n or empty) +-- SDL does: +-- - respond with AlertManeuver(success = false, resultCode = "INVALID_DATA") 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 Variables ]] +local putFileParams = { + requestParams = { + syncFileName = 'icon.png', + fileType = "GRAPHIC_PNG", + persistentFile = false, + systemFile = false + }, + filePath = "files/icon.png" +} + +local softButtonParams = { + imageParams = { + value = "icon.png", + imageType = "DYNAMIC", + }, + id = 821 +} + +local requestParams = { + type_BOTH_Text_whitespace = { + ttsChunks = {{ text = "FirstAlert", type = "TEXT" }}, + softButtons = { + { + type = "BOTH", + text = " ", + image = softButtonParams.imageParams, + softButtonID = softButtonParams.id + } + } + }, + type_BOTH_Text_HorizontalTab = { + ttsChunks = {{ text = "FirstAlert", type = "TEXT" }}, + softButtons = { + { + type = "BOTH", + text = "Close\t", + image = softButtonParams.imageParams, + softButtonID = softButtonParams.id + } + } + }, + type_BOTH_Text_lineBreak = { + ttsChunks = {{ text = "FirstAlert", type = "TEXT" }}, + softButtons = { + { + type = "BOTH", + text = "Close\n", + image = softButtonParams.imageParams, + softButtonID = softButtonParams.id + } + } + }, + type_BOTH_Text_empty = { + ttsChunks = {{ text = "FirstAlert", type = "TEXT" }}, + softButtons = { + { + type = "BOTH", + text = "", + image = softButtonParams.imageParams, + softButtonID = softButtonParams.id + } + } + }, + type_IMAGE_Text_whitespace = { + ttsChunks = {{ text = "FirstAlert", type = "TEXT" }}, + softButtons = { + { + type = "IMAGE", + text = " ", + image = softButtonParams.imageParams, + softButtonID = softButtonParams.id + } + } + }, + type_IMAGE_Text_HorizontalTab = { + ttsChunks = {{ text = "FirstAlert", type = "TEXT" }}, + softButtons = { + { + type = "IMAGE", + text = "Close\t", + image = softButtonParams.imageParams, + softButtonID = softButtonParams.id + } + } + }, + type_IMAGE_Text_lineBreak = { + ttsChunks = {{ text = "FirstAlert", type = "TEXT" }}, + softButtons = { + { + type = "IMAGE", + text = "Close\n", + image = softButtonParams.imageParams, + softButtonID = softButtonParams.id + } + } + }, + type_IMAGE_Text_empty = { + ttsChunks = {{ text = "FirstAlert", type = "TEXT" }}, + softButtons = { + { + type = "IMAGE", + text = "", + image = softButtonParams.imageParams, + softButtonID = softButtonParams.id + } + } + } +} + +--[[ Local Functions ]] +local function updatePreloadedPT() + local pt = common.sdl.getPreloadedPT() + local appId = common.app.getParams().fullAppID + pt.policy_table.app_policies[appId] = utils.cloneTable(pt.policy_table.app_policies.default) + pt.policy_table.app_policies[appId].groups = { "Base-4", "Navigation-1" } + pt.policy_table.functional_groupings["DataConsent-2"].rpcs = common.json.null + common.sdl.setPreloadedPT(pt) +end + +local function putFile(pParams) + local cid = common.mobile.getSession():SendRPC("PutFile", pParams.requestParams, pParams.filePath) + common.mobile.getSession():ExpectResponse(cid, { success = true, resultCode = "SUCCESS" }) +end + +local function sendAlertManeuver(pParams) + local corId = common.mobile.getSession():SendRPC("AlertManeuver", pParams) + common.mobile.getSession():ExpectResponse(corId, { success = false, resultCode = "INVALID_DATA" }) +end + +--[[ Test ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Update Preloaded PT", updatePreloadedPT) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("Register App", common.registerAppWOPTU) +runner.Step("Activate App", common.activateApp) +runner.Step("Upload icon file", putFile, { putFileParams }) + +runner.Title("Test") +for k, v in pairs(requestParams) do + runner.Step("App sends AlertManeuver with soft button has " .. k, sendAlertManeuver, { v }) +end + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/Defects/8_1/994_SDL_sends_appName_in_vrSynonyms_and_ttsName_in_case_of_separated_structure_in_json_file.lua b/test_scripts/Defects/8_1/994_SDL_sends_appName_in_vrSynonyms_and_ttsName_in_case_of_separated_structure_in_json_file.lua new file mode 100644 index 0000000000..d217444488 --- /dev/null +++ b/test_scripts/Defects/8_1/994_SDL_sends_appName_in_vrSynonyms_and_ttsName_in_case_of_separated_structure_in_json_file.lua @@ -0,0 +1,152 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/smartdevicelink/sdl_core/issues/994 +--------------------------------------------------------------------------------------------------- +-- Description: Check that SDL write a values from language struct in json for SDL4.0 feature +-- to the 'tts' and 'vrSynonym' parameters and send them via UpdateAppList to HMI in case +-- 'language' struct has ttsName in default element and vrSynonyms in current HMI language and vice versa +-- +-- Precondition: +-- 1. SDL4.0 feature is enabled in .ini file, SDL and HMI are started. +-- Steps: +-- 1. App is registered app via 4th protocol +-- 2. App sends via 'SystemRequest' json files +-- - JSONWithTtsNameVrSynonymsInSeparatedStructs.json +-- SDL does: +-- - sends in BC.UpdateAppList values of 'vrSynonyms' and 'ttsName' from json file +--------------------------------------------------------------------------------------------------- +--[[ 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 +config.defaultProtocolVersion = 4 +common.getConfigAppParams().appHMIType = { "DEFAULT" } + +--[[ Local Variables ]] +local pathToJsonFiles = "files/jsons/JSON_Language_parameter" +local jsonFiles = "JSONWithTtsNameVrSynonymsInSeparatedStructs.json" + +--[[ Local Functions ]] +local function checkParams(pAppData, pJsonFile) + local tbl = utils.jsonFileToTable(pathToJsonFiles .. "/" .. pJsonFile) + local isAppFound = false + for _, item in ipairs(tbl.response) do + if pAppData.appName == common.getConfigAppParams().appName then return true end + if item.name == pAppData.appName then + isAppFound = true + local deviceInfo + if item.ios ~= nil then + deviceInfo = item.ios + else + deviceInfo = item.android + end + local exp = {} + for _, tab in pairs(deviceInfo.languages) do + for l, params in pairs(tab) do + if l == "default" then + for p,v in pairs(params) do + if not exp[p] then + exp[p] = v + end + end + elseif l == "EN-US" then + for p,v in pairs(params) do + exp[p] = v + end + end + end + end + local act = pAppData + if exp.ttsName ~= act.ttsName[1] then + return false, "Expected 'ttsName' is '" .. tostring(exp.ttsName) + .. "', actual '" .. tostring(act.ttsName[1]) .. "'" + end + if not utils.isTableEqual(exp.vrSynonyms, act.vrSynonyms) then + return false, "Expected 'vrSynonyms' is:\n" .. utils.tableToString(exp.vrSynonyms) + .. "\nactual:\n" .. utils.tableToString(act.vrSynonyms) + end + end + end + if isAppFound == false then + return false, "App wasn't found" + end + return true +end + +local function registerAppWithOnSystemRequestQueryApps(pJsonFile) + local session = common.mobile.createSession() + session:StartService(7) + :Do(function() + local cid = session:SendRPC("RegisterAppInterface", common.getConfigAppParams()) + common.getHMIConnection():ExpectNotification("BasicCommunication.OnAppRegistered") + session:ExpectResponse(cid, { success = true, resultCode = "SUCCESS" }) + :Do(function() + common.getMobileSession():ExpectNotification("OnHMIStatus", + { hmiLevel = "NONE", audioStreamingState = "NOT_AUDIBLE", systemContext = "MAIN" }) + :Do(function() + local msg = { + serviceType = 7, + frameInfo = 0, + rpcType = 2, + rpcFunctionId = 32768, + rpcCorrelationId = common.getMobileSession().correlationId + 30, + payload = '{"hmiLevel":"FULL", "audioStreamingState":"NOT_AUDIBLE", "systemContext":"MAIN"}' + } + common.getMobileSession():Send(msg) + end) + end) + end) + common.getMobileSession():ExpectNotification("OnSystemRequest", + { requestType = "LOCK_SCREEN_ICON_URL" }, + { requestType = "QUERY_APPS" }) + :Times(2) + :Do(function(_, data) + if data.payload.requestType == "QUERY_APPS" then + local cid = common.getMobileSession():SendRPC("SystemRequest", { + requestType = "QUERY_APPS", fileName = pJsonFile }, + pathToJsonFiles .. "/" .. pJsonFile) + common.getHMIConnection():ExpectRequest("BasicCommunication.UpdateAppList") + :ValidIf(function(_, data1) + local countAppExp = 3 + local countApp = #data1.params.applications + if countApp ~= countAppExp then + return false, "Expected number of apps is " .. countAppExp .. " in applications array," + .. "'actual' " .. countApp + end + for _, appData in ipairs(data1.params.applications) do + local result, msg = checkParams(appData, pJsonFile) + if result == false then return result, msg end + end + return true + end) + :Do(function(_, data2) + common.getHMIConnection():SendResponse(data2.id, data.method, "SUCCESS", {}) + end) + common.getMobileSession():ExpectResponse(cid, { success = true, resultCode = "SUCCESS"}) + end + end) +end + +local function unregisterApp() + local cid = common.getMobileSession():SendRPC("UnregisterAppInterface",{}) + common.getHMIConnection():ExpectNotification("BasicCommunication.OnAppUnregistered", { unexpectedDisconnect = false }) + common.getMobileSession():ExpectResponse(cid, { success = true, resultCode = "SUCCESS" }) + common.getHMIConnection():ExpectRequest("BasicCommunication.UpdateAppList") + :Do(function(_, data) + common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", { }) + end) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Create mobile connection and session", common.start) + +runner.Title("Test") +runner.Step("Register App with OnSystemRequest Query_Apps ", registerAppWithOnSystemRequestQueryApps, { jsonFiles }) +runner.Step("App unregistered", unregisterApp) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/Policies/App_Permissions/005_ATF_DISALLOWED_app_Id_policies_And_RequestType_Validation.lua b/test_scripts/Policies/App_Permissions/005_ATF_DISALLOWED_app_Id_policies_And_RequestType_Validation.lua index 9a6e43f850..f6f5464085 100644 --- a/test_scripts/Policies/App_Permissions/005_ATF_DISALLOWED_app_Id_policies_And_RequestType_Validation.lua +++ b/test_scripts/Policies/App_Permissions/005_ATF_DISALLOWED_app_Id_policies_And_RequestType_Validation.lua @@ -219,13 +219,17 @@ end function Test:TestStep_SDL_Allow_SystemRequest_Of_PROPRIETARY_Type() - local CorIdSystemRequest = self.mobileSession:SendRPC("SystemRequest", {fileName = "PolicyTableUpdate", requestType = "PROPRIETARY"}, "files/icon.png") - EXPECT_HMICALL("BasicCommunication.SystemRequest") - :Do(function(_,data) - self.hmiConnection:SendResponse(data.id,"BasicCommunication.SystemRequest", "SUCCESS", {}) - end) - self.mobileSession:ExpectResponse(CorIdSystemRequest, {success = true, resultCode = "SUCCESS"}) + self.hmiConnection:SendNotification("BasicCommunication.OnSystemRequest", { requestType = "PROPRIETARY", fileName = "PolicyTableUpdate", appID = self.applications["App_1"] }) + self.mobileSession:ExpectNotification("OnSystemRequest", { requestType = "PROPRIETARY" }) + :Do(function() + local CorIdSystemRequest = self.mobileSession:SendRPC("SystemRequest", {fileName = "PolicyTableUpdate", requestType = "PROPRIETARY"}, "files/icon.png") + EXPECT_HMICALL("BasicCommunication.SystemRequest") + :Do(function(_,data) + self.hmiConnection:SendResponse(data.id,"BasicCommunication.SystemRequest", "SUCCESS", {}) + end) + self.mobileSession:ExpectResponse(CorIdSystemRequest, {success = true, resultCode = "SUCCESS"}) + end) end function Test:TestStep_SDL_Disallow_SystemRequest_Of_HTTP_Type() diff --git a/test_scripts/Policies/App_Permissions/008_ATF_DISALLOWED_default_policies_And_RequestType_Validation.lua b/test_scripts/Policies/App_Permissions/008_ATF_DISALLOWED_default_policies_And_RequestType_Validation.lua index 7758c44138..d1f434ec83 100644 --- a/test_scripts/Policies/App_Permissions/008_ATF_DISALLOWED_default_policies_And_RequestType_Validation.lua +++ b/test_scripts/Policies/App_Permissions/008_ATF_DISALLOWED_default_policies_And_RequestType_Validation.lua @@ -103,13 +103,17 @@ end function Test:TestStep_SDL_Allow_SystemRequest_Of_PROPRIETARY_Type() - local CorIdSystemRequest = self.mobileSession:SendRPC("SystemRequest", {fileName = "PolicyTableUpdate", requestType = "PROPRIETARY"}, "files/icon.png") - EXPECT_HMICALL("BasicCommunication.SystemRequest") - :Do(function(_,data) - self.hmiConnection:SendResponse(data.id,"BasicCommunication.SystemRequest", "SUCCESS", {}) - end) - self.mobileSession:ExpectResponse(CorIdSystemRequest, {success = true, resultCode = "SUCCESS"}) - + self.hmiConnection:SendNotification("BasicCommunication.OnSystemRequest", { requestType = "PROPRIETARY", fileName = "PolicyTableUpdate", appID = self.applications["App_1"] }) + + self.mobileSession:ExpectNotification("OnSystemRequest", { requestType = "PROPRIETARY" }) + :Do(function() + local CorIdSystemRequest = self.mobileSession:SendRPC("SystemRequest", {fileName = "PolicyTableUpdate", requestType = "PROPRIETARY"}, "files/icon.png") + EXPECT_HMICALL("BasicCommunication.SystemRequest") + :Do(function(_,data) + self.hmiConnection:SendResponse(data.id,"BasicCommunication.SystemRequest", "SUCCESS", {}) + end) + self.mobileSession:ExpectResponse(CorIdSystemRequest, {success = true, resultCode = "SUCCESS"}) + end) end function Test:TestStep_SDL_Disallow_SystemRequest_Of_HTTP_Type() diff --git a/test_scripts/Policies/Policy_Table_Update/148_ATF_HMILvl_on_PTU_affected_in_BACKGROUND_or_NONE.lua b/test_scripts/Policies/Policy_Table_Update/148_ATF_HMILvl_on_PTU_affected_in_BACKGROUND_or_NONE.lua index 83b66c5494..13d3515e5f 100644 --- a/test_scripts/Policies/Policy_Table_Update/148_ATF_HMILvl_on_PTU_affected_in_BACKGROUND_or_NONE.lua +++ b/test_scripts/Policies/Policy_Table_Update/148_ATF_HMILvl_on_PTU_affected_in_BACKGROUND_or_NONE.lua @@ -159,13 +159,13 @@ local function ptu(self, id) storePTUInFile(ptu_table, ptu_file_name) self["mobileSession" .. id]:ExpectNotification("OnSystemRequest", { requestType = "PROPRIETARY" }) :Do(function() - local corIdSystemRequest = self.mobileSession:SendRPC("SystemRequest", { requestType = "PROPRIETARY", fileName = policy_file_name }, ptu_file_name) + local corIdSystemRequest = self["mobileSession" .. id]:SendRPC("SystemRequest", { requestType = "PROPRIETARY", fileName = policy_file_name }, ptu_file_name) EXPECT_HMICALL("BasicCommunication.SystemRequest") :Do(function(_, data) self.hmiConnection:SendResponse(data.id, "BasicCommunication.SystemRequest", "SUCCESS", { }) self.hmiConnection:SendNotification("SDL.OnReceivedPolicyUpdate", { policyfile = policy_file_path .. "/" .. policy_file_name }) end) - EXPECT_RESPONSE(corIdSystemRequest, { success = true, resultCode = "SUCCESS" }) + self["mobileSession" .. id]:ExpectResponse(corIdSystemRequest, { success = true, resultCode = "SUCCESS" }) :Do(function() requestId = self.hmiConnection:SendRequest("SDL.GetUserFriendlyMessage", {language = "EN-US", messageCodes = { "StatusUpToDate" }}) EXPECT_HMIRESPONSE(requestId) diff --git a/test_scripts/Policies/Policy_Table_Update/173_PTU_when_not_UPDATING.lua b/test_scripts/Policies/Policy_Table_Update/173_PTU_when_not_UPDATING.lua new file mode 100644 index 0000000000..a777a983a6 --- /dev/null +++ b/test_scripts/Policies/Policy_Table_Update/173_PTU_when_not_UPDATING.lua @@ -0,0 +1,74 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/smartdevicelink/sdl_core/issues/3715 +--------------------------------------------------------------------------------------------------- +-- Description: SDL rejects PTUs when not UPDATING +-- +-- Steps: +-- 1. Core and HMI are started +-- 2. Application 1 connections and activates +-- 3. PTU is completed successfully and status is UP_TO_DATE +-- 4. App 1 sends SystemRequest PROPRIETARY +-- SDL does: +-- - reject the PTU, responding success false REJECTED +-- 5. Application 2 registers and is activated +-- 6. App 2 sends SystemRequest PROPRIETARY +-- SDL does: +-- - reject the PTU, responding success false REJECTED +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('user_modules/sequences/actions') +local SDL = require('SDL') +local utils = require('user_modules/utils') +local consts = require('user_modules/consts') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] + +--[[ Local Functions ]] +local function checkPTUStatus(pExpStatus) + local cid = common.hmi.getConnection():SendRequest("SDL.GetStatusUpdate") + common.hmi.getConnection():ExpectResponse(cid, { result = { status = pExpStatus }}) +end + +local function attemptUnpromptedPTU(appId) + local ptuFileName = os.tmpname() + local ptuTable = common.getPTUFromPTS() + for i, _ in pairs(common.mobile.getApps()) do + ptuTable.policy_table.app_policies[common.app.getPolicyAppId(i)] = common.ptu.getAppData(i) + end + utils.tableToJsonFile(ptuTable, ptuFileName) + + local mobile = common.getMobileSession(appId) + + local cid = 0 + local policyMode = SDL.buildOptions.extendedPolicy + if policyMode == "HTTP" then + cid = mobile:SendRPC("SystemRequest", { requestType = "HTTP", fileName = "PolicyTableUpdate" }, ptuFileName) + else + cid = mobile:SendRPC("SystemRequest", { requestType = "PROPRIETARY" }, ptuFileName) + end + + mobile:ExpectResponse(cid, { success = false, resultCode = "REJECTED" }) + :Do(function() os.remove(ptuFileName) end) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("Register App", common.registerApp) +runner.Step("Activate App", common.activateApp) +runner.Step("Successful PTU via Mobile", common.ptu.policyTableUpdate) +runner.Step("Check PTU status UP_TO_DATE", checkPTUStatus, { "UP_TO_DATE" }) + +runner.Title("Test") +runner.Step("App 1 attempt unprompted PTU", attemptUnpromptedPTU, { 1 }) +runner.Step("Register App 2", common.registerAppWOPTU, { 2 }) +runner.Step("Activate App 2", common.activateApp, { 2 }) +runner.Step("App 2 attempt unprompted PTU 2", attemptUnpromptedPTU, { 2 }) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/Policies/Policy_Table_Update/174_PTU_from_wrong_app.lua b/test_scripts/Policies/Policy_Table_Update/174_PTU_from_wrong_app.lua new file mode 100644 index 0000000000..2e64e3c8f7 --- /dev/null +++ b/test_scripts/Policies/Policy_Table_Update/174_PTU_from_wrong_app.lua @@ -0,0 +1,81 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/smartdevicelink/sdl_core/issues/3715 +--------------------------------------------------------------------------------------------------- +-- Description: SDL only accepts PTU from application which was sent OnSystemRequest +-- +-- Steps: +-- 1. Core and HMI are started +-- 2. An application is registered +-- 3. Core sends OnStatusUpdate UPDATING +-- 4. Before OnSystemRequest is sent to any app, app 1 attempts SystemRequest PTU +-- SDL does: +-- - reject the PTU, responding success false REJECTED +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local SDL = require('SDL') +local utils = require('user_modules/utils') +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') +local commonFunctions = require("user_modules/shared_testcases/commonFunctions") + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false +runner.testSettings.restrictions.sdlBuildOptions = { { extendedPolicy = { "PROPRIETARY", "EXTERNAL_PROPRIETARY" } } } + +--[[ Local Variables ]] + +--[[ Local Functions ]] +local function ptuWrongApp() + local session = common.mobile.createSession(1, 1) + session:StartService(7) + :Do(function() + local corId = session:SendRPC("RegisterAppInterface", common.app.getParams(1)) + common.hmi.getConnection():ExpectNotification("BasicCommunication.OnAppRegistered", + { application = { appName = common.app.getParams(1).appName } }) + :Do(function(_, d1) + local appId = 1 + if d1.params.application.appName == common.app.getParams(2).appName then + appId = 2 + end + common.app.setHMIId(d1.params.application.appID, appId) + end) + session:ExpectResponse(corId, { success = true, resultCode = "SUCCESS" }) + :Do(function() + common.isPTUStarted() + session:ExpectNotification("OnHMIStatus", + { hmiLevel = "NONE", audioStreamingState = "NOT_AUDIBLE", systemContext = "MAIN" }) + session:ExpectNotification("OnPermissionsChange") + :Times(AnyNumber()) + end) + end) + + common.hmi.getConnection():ExpectNotification("SDL.OnStatusUpdate", + { status = "UPDATE_NEEDED" }, + { status = "UPDATING" }) + :Times(2) + :Do(function(_, d) + if d.params.status == "UPDATING" then + local ptuFileName = os.tmpname() + local ptuTable = common.getPTUFromPTS() + for i, _ in pairs(common.mobile.getApps()) do + ptuTable.policy_table.app_policies[common.app.getPolicyAppId(i)] = common.ptu.getAppData(i) + end + utils.tableToJsonFile(ptuTable, ptuFileName) + local corId3 = common.mobile.getSession(1):SendRPC("SystemRequest", { requestType = "PROPRIETARY" }, ptuFileName) + common.mobile.getSession(1):ExpectResponse(corId3, { success = false, resultCode = "REJECTED" }) + :Do(function() os.remove(ptuFileName) end) + end + end) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) + +runner.Title("Test") +runner.Step("Register two apps and PTU from the wrong app", ptuWrongApp) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/Policies/Policy_Table_Update/175_PTU_from_wrong_app_HTTP.lua b/test_scripts/Policies/Policy_Table_Update/175_PTU_from_wrong_app_HTTP.lua new file mode 100644 index 0000000000..b36bfa2ee2 --- /dev/null +++ b/test_scripts/Policies/Policy_Table_Update/175_PTU_from_wrong_app_HTTP.lua @@ -0,0 +1,52 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/smartdevicelink/sdl_core/issues/3715 +--------------------------------------------------------------------------------------------------- +-- Description: SDL only accepts PTU from application which was sent OnSystemRequest +-- +-- Steps: +-- 1. Core and HMI are started +-- 2. An application is registered +-- 3. Core sends OnStatusUpdate UPDATING +-- 4. Two Applications register, OnSystemRequest is sent to one of them +-- SDL does: +-- - reject the PTU, responding success false REJECTED +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local SDL = require('SDL') +local utils = require('user_modules/utils') +local runner = require('user_modules/script_runner') +local common = require('test_scripts/AppServices/commonAppServices') +local commonFunctions = require("user_modules/shared_testcases/commonFunctions") + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false +runner.testSettings.restrictions.sdlBuildOptions = { { extendedPolicy = { "HTTP" } } } + +--[[ Local Variables ]] + +--[[ Local Functions ]] +local function ptuWrongApp() + local ptuFileName = os.tmpname() + local ptuTable = common.getPTUFromPTS() + for i, _ in pairs(common.mobile.getApps()) do + ptuTable.policy_table.app_policies[common.app.getPolicyAppId(2)] = common.ptu.getAppData(2) + end + utils.tableToJsonFile(ptuTable, ptuFileName) + local corId3 = common.mobile.getSession(1):SendRPC("SystemRequest", { requestType = "PROPRIETARY" }, ptuFileName) + common.mobile.getSession(1):ExpectResponse(corId3, { success = false, resultCode = "REJECTED" }) + :Do(function() os.remove(ptuFileName) end) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("Register App1", common.registerAppWOPTU, { 1 }) +runner.Step("Register App2", common.registerAppWOPTU, { 2 }) + +runner.Title("Test") +runner.Step("PTU from the wrong app", ptuWrongApp) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/Policies/Policy_Table_Update/176_PTU_is_performed_if_HMI_sends_BC_OnSystemRequest_with_url_parameter.lua b/test_scripts/Policies/Policy_Table_Update/176_PTU_is_performed_if_HMI_sends_BC_OnSystemRequest_with_url_parameter.lua new file mode 100644 index 0000000000..436641265d --- /dev/null +++ b/test_scripts/Policies/Policy_Table_Update/176_PTU_is_performed_if_HMI_sends_BC_OnSystemRequest_with_url_parameter.lua @@ -0,0 +1,72 @@ +--------------------------------------------------------------------------------------------------- +-- Issues: https://github.com/smartdevicelink/sdl_core/issues/3715, +-- https://github.com/smartdevicelink/sdl_core/issues/3881 +--------------------------------------------------------------------------------------------------- +-- Description: SDL accepts PTU from application in case HMI sends BC.OnSystemRequest with 'url' parameter +-- Steps: +-- 1. Core and HMI are started +-- 2. App is registered +-- 3. Core sends OnStatusUpdate UPDATING +-- 4. HMI sends OnSystemRequest with 'url' parameter +-- 5. After OnSystemRequest is sent to app, app attempts to send first SystemRequest during PTU +-- SDL does: +-- - accept the PTU, responding success:true, resultCode:SUCCESS +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local utils = require('user_modules/utils') +local runner = require('user_modules/script_runner') +local common = require("user_modules/sequences/actions") + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false +runner.testSettings.restrictions.sdlBuildOptions = { { extendedPolicy = { "PROPRIETARY", "EXTERNAL_PROPRIETARY" } } } + +--[[ Local Functions ]] +local function policyTableUpdate() + local ptuFileName = os.tmpname() + local requestId = common.hmi.getConnection():SendRequest("SDL.GetPolicyConfigurationData", + { policyType = "module_config", property = "endpoints" }) + common.hmi.getConnection():ExpectResponse(requestId) + :Do(function() + common.hmi.getConnection():SendNotification("BasicCommunication.OnSystemRequest", { + requestType = "PROPRIETARY", + fileName = common.sdl.getPTSFilePath(), + url = "http://x.x.x.x:3000/api/1/policies/proprietary" + }) + local ptuTable = common.getPTUFromPTS() + ptuTable.policy_table.app_policies[common.app.getPolicyAppId()] = common.ptu.getAppData() + utils.tableToJsonFile(ptuTable, ptuFileName) + local event = common.run.createEvent() + common.hmi.getConnection():ExpectEvent(event, "PTU event") + common.mobile.getSession():ExpectNotification("OnSystemRequest", { requestType = "PROPRIETARY" }) + :Do(function() + common.hmi.getConnection():ExpectRequest("BasicCommunication.SystemRequest") + :Do(function(_, d3) + common.hmi.getConnection():ExpectRequest("VehicleInfo.GetVehicleData", { odometer = true }) + common.hmi.getConnection():ExpectNotification("SDL.OnStatusUpdate", { status = "UP_TO_DATE" }) + common.hmi.getConnection():SendResponse(d3.id, "BasicCommunication.SystemRequest", "SUCCESS", { }) + common.hmi.getConnection():SendNotification("SDL.OnReceivedPolicyUpdate", + { policyfile = d3.params.fileName }) + end) + common.hmi.getConnection():RaiseEvent(event, "PTU event") + local corIdSystemRequest = common.mobile.getSession():SendRPC("SystemRequest", { + requestType = "PROPRIETARY" }, ptuFileName) + common.mobile.getSession():ExpectResponse(corIdSystemRequest, { success = true, resultCode = "SUCCESS" }) + :Do(function() os.remove(ptuFileName) end) + end) + :Times(AtMost(1)) + end) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) + +runner.Title("Test") +runner.Step("Successful PTU via a mobile app", policyTableUpdate) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/Policies/Policy_Table_Update/177_PTU_is_performed_for_several_Apps_if_HMI_sends_BC_OnSystemRequest_with_url_parameter.lua b/test_scripts/Policies/Policy_Table_Update/177_PTU_is_performed_for_several_Apps_if_HMI_sends_BC_OnSystemRequest_with_url_parameter.lua new file mode 100644 index 0000000000..83335df5a5 --- /dev/null +++ b/test_scripts/Policies/Policy_Table_Update/177_PTU_is_performed_for_several_Apps_if_HMI_sends_BC_OnSystemRequest_with_url_parameter.lua @@ -0,0 +1,80 @@ +--------------------------------------------------------------------------------------------------- +-- Issues: https://github.com/smartdevicelink/sdl_core/issues/3715, +-- https://github.com/smartdevicelink/sdl_core/issues/3881 +--------------------------------------------------------------------------------------------------- +-- Description: +-- SDL accepts PTU from application for several Apps in case HMI sends BC.OnSystemRequest with 'url' parameter +-- Steps: +-- 1. Core and HMI are started +-- 2. App1 is registered +-- 3. App2 is registered +-- 4. Core sends OnStatusUpdate UPDATING +-- 5. HMI sends OnSystemRequest with 'url' parameter +-- 6. After OnSystemRequest is sent to randomly app, app attempts to send SystemRequest during PTU +-- SDL does: +-- - accept the PTU, responding success:true, resultCode:SUCCESS +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local utils = require('user_modules/utils') +local runner = require('user_modules/script_runner') +local common = require("user_modules/sequences/actions") + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false +runner.testSettings.restrictions.sdlBuildOptions = { { extendedPolicy = { "PROPRIETARY", "EXTERNAL_PROPRIETARY" } } } + +--[[ Local Functions ]] +local function policyTableUpdate() + local ptuFileName = os.tmpname() + local requestId = common.hmi.getConnection():SendRequest("SDL.GetPolicyConfigurationData", + { policyType = "module_config", property = "endpoints" }) + common.hmi.getConnection():ExpectResponse(requestId) + :Do(function() + common.hmi.getConnection():SendNotification("BasicCommunication.OnSystemRequest", { + requestType = "PROPRIETARY", + fileName = common.sdl.getPTSFilePath(), + url = "http://x.x.x.x:3000/api/1/policies/proprietary" + }) + local ptuTable = common.getPTUFromPTS() + for i, _ in pairs(common.mobile.getApps()) do + ptuTable.policy_table.app_policies[common.app.getPolicyAppId(i)] = common.ptu.getAppData(i) + end + utils.tableToJsonFile(ptuTable, ptuFileName) + local event = common.run.createEvent() + common.hmi.getConnection():ExpectEvent(event, "PTU event") + for id, _ in pairs(common.mobile.getApps()) do + common.mobile.getSession(id):ExpectNotification("OnSystemRequest", { requestType = "PROPRIETARY" }) + :Do(function() + common.hmi.getConnection():ExpectRequest("BasicCommunication.SystemRequest") + :Do(function(_, d3) + common.hmi.getConnection():ExpectRequest("VehicleInfo.GetVehicleData", { odometer = true }) + common.hmi.getConnection():ExpectNotification("SDL.OnStatusUpdate", { status = "UP_TO_DATE" }) + common.hmi.getConnection():SendResponse(d3.id, "BasicCommunication.SystemRequest", "SUCCESS", { }) + common.hmi.getConnection():SendNotification("SDL.OnReceivedPolicyUpdate", + { policyfile = d3.params.fileName }) + end) + utils.cprint(35, "App ".. id .. " was used for PTU") + common.hmi.getConnection():RaiseEvent(event, "PTU event") + local corIdSystemRequest = common.mobile.getSession(id):SendRPC("SystemRequest", { + requestType = "PROPRIETARY" }, ptuFileName) + common.mobile.getSession(id):ExpectResponse(corIdSystemRequest, { success = true, resultCode = "SUCCESS" }) + :Do(function() os.remove(ptuFileName) end) + end) + :Times(AtMost(1)) + end + end) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("Register App1", common.app.registerNoPTU, { 1 }) +runner.Step("Register App2", common.app.register, { 2 }) + +runner.Title("Test") +runner.Step("Successful PTU via a mobile app", policyTableUpdate) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/Policies/Related_HMI_API/186_ATF_OnPolicyUpdate_initiation_of_PTU.lua b/test_scripts/Policies/Related_HMI_API/186_ATF_OnPolicyUpdate_initiation_of_PTU.lua index be8d5fbc36..b9a4574741 100644 --- a/test_scripts/Policies/Related_HMI_API/186_ATF_OnPolicyUpdate_initiation_of_PTU.lua +++ b/test_scripts/Policies/Related_HMI_API/186_ATF_OnPolicyUpdate_initiation_of_PTU.lua @@ -77,6 +77,8 @@ function Test:Precondtion_Activate_App_Consent_Update() } }) :Do(function(_,data) + EXPECT_NOTIFICATION("OnHMIStatus", + {hmiLevel = "NONE", systemContext = "MAIN"}, {hmiLevel = "FULL", systemContext = "MAIN"}):Times(2) local RequestIdActivateApp = self.hmiConnection:SendRequest("SDL.ActivateApp", {appID = data.params.application.appID}) EXPECT_HMIRESPONSE(RequestIdActivateApp, {result = {code = 0, isSDLAllowed = false}, method = "SDL.ActivateApp"}) :Do(function(_,_) @@ -87,7 +89,6 @@ function Test:Precondtion_Activate_App_Consent_Update() EXPECT_HMICALL("BasicCommunication.ActivateApp") :Do(function(_,data1) self.hmiConnection:SendResponse(data1.id,"BasicCommunication.ActivateApp", "SUCCESS", {}) - EXPECT_NOTIFICATION("OnHMIStatus", {hmiLevel = "FULL", systemContext = "MAIN"}) end) end) end) @@ -112,7 +113,7 @@ function Test:Precondtion_Activate_App_Consent_Update() { policyfile = "/tmp/fs/mp/images/ivsu_cache/PolicyTableUpdate" }) - EXPECT_HMINOTIFICATION("SDL.OnStatusUpdate", {status = "UP_TO_DATE"}):Timeout(500) + EXPECT_HMINOTIFICATION("SDL.OnStatusUpdate", {status = "UP_TO_DATE"}):Timeout(1000) end) end) end) diff --git a/test_scripts/Policies/Validation_of_PolicyTables/299_ATF_Memory_Kb_Constraints_Ignoring.lua b/test_scripts/Policies/Validation_of_PolicyTables/299_ATF_Memory_Kb_Constraints_Ignoring.lua deleted file mode 100644 index 64ac2ec9d8..0000000000 --- a/test_scripts/Policies/Validation_of_PolicyTables/299_ATF_Memory_Kb_Constraints_Ignoring.lua +++ /dev/null @@ -1,132 +0,0 @@ ---------------------------------------------------------------------------------------------- --- Requirement summary: --- [Policies] "pre_DataConsent", "default" and policies and "'memory_kb'" validation --- --- Description: --- In case the "pre_DataConsent" or "default" or policies are assigned to the application, and "memory_kb" section exists and is not empty, --- PoliciesManager must ignore the memory constraints in PT defined in "memory_kb" and apply the value "AppDirectoryQuota" from smartDeviceLink.ini file. --- 1. Used preconditions: --- a) Set SDL in first life cycle state --- b) Set AppDirectoryQuota = 15000000 in .ini file --- c) Register app, activate, consent device and update policy where memory_kb = 5000 for this app --- 2. Performed steps --- a) Send PutFile with file 8414449 bytes --- b) Send one more time this file --- --- Expected result: --- a) PutFile SUCCESS resultCode - memory_kb parameter is ignored for app --- b) PutFile OUT_OF_MEMORY resultCode - AppDirectoryQuota applies for app ---------------------------------------------------------------------------------------------- -require('user_modules/script_runner').isTestApplicable({ { extendedPolicy = { "EXTERNAL_PROPRIETARY" } } }) - ---[[ General configuration parameters ]] ---ToDo: shall be removed when issue: "ATF does not stop HB timers by closing session and connection" is fixed -config.defaultProtocolVersion = 2 -config.application1.registerAppInterfaceParams.appName = "SPT" -config.application1.registerAppInterfaceParams.fullAppID = "1234567" -config.application1.registerAppInterfaceParams.isMediaApplication = true - ---[[ Required Shared libraries ]] -local commonFunctions = require ('user_modules/shared_testcases/commonFunctions') -local commonSteps = require ('user_modules/shared_testcases/commonSteps') -local testCasesForPolicyTable = require ('user_modules/shared_testcases/testCasesForPolicyTable') -local commonPreconditions = require ('user_modules/shared_testcases/commonPreconditions') -local utils = require ('user_modules/utils') - ---[[ General Precondition before ATF start ]] -commonFunctions:SDLForceStop() -commonSteps:DeleteLogsFiles() -commonSteps:DeletePolicyTable() -testCasesForPolicyTable.Delete_Policy_table_snapshot() -testCasesForPolicyTable:Precondition_updatePolicy_By_overwriting_preloaded_pt("files/jsons/Policies/PTU_ValidationRules/preloaded_memory_kb_exist.json") -commonPreconditions:BackupFile("smartDeviceLink.ini") -commonFunctions:write_parameter_to_smart_device_link_ini("AppDirectoryQuota", "1000000") -commonFunctions:write_parameter_to_smart_device_link_ini("FrequencyCount", "0") - ---[[ General Settings for configuration ]] -Test = require('connecttest') -require('cardinalities') -require('user_modules/AppTypes') - ---[[ Test ]] -commonFunctions:newTestCasesGroup("Test") - -function Test:TestStep_PredataConsent_Send_PutFile_Bigger_Than_AppDirectoryQuota_OUT_OF_MEMORY() - local cid = self.mobileSession:SendRPC("PutFile", {syncFileName ="1166384_bytes_audio_1.mp3", fileType ="AUDIO_MP3"}, "files/MP3_1140kb.mp3") - EXPECT_RESPONSE(cid, { success = false, resultCode = "OUT_OF_MEMORY" }):Timeout(15000) -end - -function Test.Wait() - os.execute("sleep 3") -end - -function Test:TestStep_PredataConsent_Send_PutFile_Bigger_Than_AppDirectoryQuota_OUT_OF_MEMORY() - local cid = self.mobileSession:SendRPC("PutFile", {syncFileName ="icon1.png", fileType ="AUDIO_MP3"}, "files/icon.png") - EXPECT_RESPONSE(cid, { success = true, resultCode = "SUCCESS" }):Timeout(15000) -end - -function Test:TestStep_trigger_getting_device_consent() - testCasesForPolicyTable:trigger_getting_device_consent(self, config.application1.registerAppInterfaceParams.appName, utils.getDeviceMAC()) -end - -function Test:TestStep_Default_Send_PutFile_Bigger_Than_AppDirectoryQuota_OUT_OF_MEMORY() - local cid = self.mobileSession:SendRPC("PutFile", {syncFileName ="1166384_bytes_audio_2.mp3", fileType ="AUDIO_MP3"}, "files/MP3_1140kb.mp3") - EXPECT_RESPONSE(cid, { success = false, resultCode = "OUT_OF_MEMORY" }):Timeout(15000) -end - -function Test:Precondition_Update_Policy_With_memory_kb_Param() - local requestId = self.hmiConnection:SendRequest("SDL.GetPolicyConfigurationData", - { policyType = "module_config", property = "endpoints" }) - EXPECT_HMIRESPONSE(requestId) - :Do(function() - self.hmiConnection:SendNotification("BasicCommunication.OnSystemRequest",{requestType = "PROPRIETARY", fileName = "filename"}) - EXPECT_NOTIFICATION("OnSystemRequest", { requestType = "PROPRIETARY" }) - :Do(function() - local CorIdSystemRequest = self.mobileSession:SendRPC("SystemRequest", {fileName = "PolicyTableUpdate", requestType = "PROPRIETARY"}, - "files/ptu_memory_kb_app_1234567.json") - local systemRequestId - EXPECT_HMICALL("BasicCommunication.SystemRequest") - :Do(function(_,data) - systemRequestId = data.id - self.hmiConnection:SendNotification("SDL.OnReceivedPolicyUpdate", - { - policyfile = "/tmp/fs/mp/images/ivsu_cache/PolicyTableUpdate" - }) - local function to_run() - self.hmiConnection:SendResponse(systemRequestId, "BasicCommunication.SystemRequest", "SUCCESS", {}) - self.mobileSession:ExpectResponse(CorIdSystemRequest, {success = true, resultCode = "SUCCESS"}) - end - RUN_AFTER(to_run, 800) - end) - end) - end) - - EXPECT_HMINOTIFICATION("SDL.OnStatusUpdate", {status = "UP_TO_DATE"}) -end - -function Test:TestStep_PredataConsent_Send_PutFile_Bigger_Than_AppDirectoryQuota_OUT_OF_MEMORY() - local cid = self.mobileSession:SendRPC("PutFile", {syncFileName ="1166384_bytes_audio_2.mp3", fileType ="AUDIO_MP3"}, "files/MP3_1140kb.mp3") - EXPECT_RESPONSE(cid, { success = false, resultCode = "OUT_OF_MEMORY" }):Timeout(15000) -end - -function Test.Wait() - os.execute("sleep 3") -end - -function Test:TestStep_PredataConsent_Send_PutFile_Bigger_Than_AppDirectoryQuota_OUT_OF_MEMORY() - local cid = self.mobileSession:SendRPC("PutFile", {syncFileName ="icon2.png", fileType ="AUDIO_MP3"}, "files/icon.png") - EXPECT_RESPONSE(cid, { success = true, resultCode = "SUCCESS" }):Timeout(15000) -end - ---[[ Postconditions ]] -commonFunctions:newTestCasesGroup("Postconditions") -testCasesForPolicyTable:Restore_preloaded_pt() -function Test.Postcondition_Restore_INI_file() - commonPreconditions:RestoreFile("smartDeviceLink.ini") -end - -function Test.Postcondition_StopSDL() - StopSDL() -end - -return Test diff --git a/test_scripts/Policies/build_options/078_ATF_PTU_HMI_Level_Affected_Apps_FULL_LIMITED_HTTP.lua b/test_scripts/Policies/build_options/078_ATF_PTU_HMI_Level_Affected_Apps_FULL_LIMITED_HTTP.lua index 21bf50263f..b19e0e6743 100644 --- a/test_scripts/Policies/build_options/078_ATF_PTU_HMI_Level_Affected_Apps_FULL_LIMITED_HTTP.lua +++ b/test_scripts/Policies/build_options/078_ATF_PTU_HMI_Level_Affected_Apps_FULL_LIMITED_HTTP.lua @@ -177,20 +177,36 @@ end function Test:TestStep_UpdatePolicyAfterAddSecondApp_ExpectOnHMIStatusNotCall() - local CorIdSystemRequest = self.mobileSession1:SendRPC("SystemRequest", + self.hmiConnection:SendNotification("BasicCommunication.OnSystemRequest", { requestType = "HTTP", fileName = "PolicyTableUpdate", appID = self.applications["App_1"] }) + self.mobileSession:ExpectNotification("OnSystemRequest", { requestType = "HTTP" }):Times(AnyNumber()) + :Do(function() + print("OnSystemRequset received for App_1: hmilevel: LIMITED") + local CorIdSystemRequest = self.mobileSession:SendRPC("SystemRequest", { requestType = "HTTP", fileName = "ptu2app.json", },"files/ptu2app.json") - self.mobileSession1:ExpectResponse(CorIdSystemRequest, {success = true, resultCode = "SUCCESS"}) + self.mobileSession:ExpectResponse(CorIdSystemRequest, {success = true, resultCode = "SUCCESS"}) + end) - EXPECT_HMINOTIFICATION("SDL.OnStatusUpdate", {status = "UP_TO_DATE"}) - - self.mobileSession1:ExpectNotification("OnPermissionsChange") - -- Expect after updating HMI status will not change - self.mobileSession1:ExpectNotification("OnHMIStatus"):Times(0) - self.mobileSession:ExpectNotification("OnHMIStatus"):Times(0) - commonTestCases:DelayedExp(10000) + self.mobileSession1:ExpectNotification("OnSystemRequest", { requestType = "HTTP" }):Times(AnyNumber()) + :Do(function() + print("OnSystemRequset received for App_2: hmilevel: FULL") + local CorIdSystemRequest = self.mobileSession1:SendRPC("SystemRequest", + { + requestType = "HTTP", + fileName = "ptu2app.json", + },"files/ptu2app.json") + self.mobileSession1:ExpectResponse(CorIdSystemRequest, {success = true, resultCode = "SUCCESS"}) + end) + + EXPECT_HMINOTIFICATION("SDL.OnStatusUpdate", {status = "UP_TO_DATE"}) + + self.mobileSession1:ExpectNotification("OnPermissionsChange") + -- Expect after updating HMI status will not change + self.mobileSession1:ExpectNotification("OnHMIStatus"):Times(0) + self.mobileSession:ExpectNotification("OnHMIStatus"):Times(0) + commonTestCases:DelayedExp(10000) end --[[ Postconditions ]] diff --git a/test_scripts/Policies/build_options/079_ATF_PTU_HMI_Level_Affected_Apps_NONE_BACKGROUND_HTTP.lua b/test_scripts/Policies/build_options/079_ATF_PTU_HMI_Level_Affected_Apps_NONE_BACKGROUND_HTTP.lua index 9665ff7c4c..cfeb79db51 100644 --- a/test_scripts/Policies/build_options/079_ATF_PTU_HMI_Level_Affected_Apps_NONE_BACKGROUND_HTTP.lua +++ b/test_scripts/Policies/build_options/079_ATF_PTU_HMI_Level_Affected_Apps_NONE_BACKGROUND_HTTP.lua @@ -127,8 +127,8 @@ local function ptu(self, id) local ptu_table = ptsToTable("files/ptu.json") updatePTU(ptu_table, id) storePTUInFile(ptu_table, ptu_file_name) - local corId = self.mobileSession:SendRPC("SystemRequest", { requestType = "HTTP", fileName = "PolicyTableUpdate" }, ptu_file_name) - EXPECT_RESPONSE(corId, { success = true, resultCode = "SUCCESS" }) + local corId = self["mobileSession"..id]:SendRPC("SystemRequest", { requestType = "HTTP", fileName = "PolicyTableUpdate" }, ptu_file_name) + self["mobileSession"..id]:ExpectResponse(corId, { success = true, resultCode = "SUCCESS" }) os.remove(ptu_file_name) end @@ -272,7 +272,11 @@ function Test:Test_UPDATING() end function Test:Test_PTU_2() - ptu(self, 2) + self.hmiConnection:SendNotification("BasicCommunication.OnSystemRequest", { requestType = "HTTP", fileName = "PolicyTableUpdate", appID = self.applications["App_2"] }) + self.mobileSession2:ExpectNotification("OnSystemRequest", { requestType = "HTTP" }) + :Do(function() + ptu(self, 2) + end) self["mobileSession1"]:ExpectNotification("OnHMIStatus"):Times(0) self["mobileSession2"]:ExpectNotification("OnHMIStatus"):Times(0) commonTestCases:DelayedExp(10000) diff --git a/test_scripts/Policies/user_consent_of_Policies/208_ATF_No_consent_for_default_policies.lua b/test_scripts/Policies/user_consent_of_Policies/208_ATF_No_consent_for_default_policies.lua index ba001c2184..01aa3ae88f 100644 --- a/test_scripts/Policies/user_consent_of_Policies/208_ATF_No_consent_for_default_policies.lua +++ b/test_scripts/Policies/user_consent_of_Policies/208_ATF_No_consent_for_default_policies.lua @@ -54,27 +54,32 @@ function Test:Precondition_RegisterApp2() end function Test:Precondition_PTU_with_new_default_permissions() - local CorIdSystemRequest = self.mobileSession:SendRPC("SystemRequest", - { fileName = "PolicyTableUpdate", requestType = "PROPRIETARY", appID = self.HMIAppID2 }, - "files/PTU_NewDefaultPermissions.json") + self.hmiConnection:SendNotification("BasicCommunication.OnSystemRequest", { requestType = "PROPRIETARY", fileName = "PolicyTableUpdate", appID = self.applications["App_1"] }) - EXPECT_HMICALL("BasicCommunication.SystemRequest") - :Do(function(_,data) - local systemRequestId = data.id - self.hmiConnection:SendNotification("SDL.OnReceivedPolicyUpdate", { policyfile = "/tmp/fs/mp/images/ivsu_cache/PolicyTableUpdate" }) - - local function to_run() - self.hmiConnection:SendResponse(systemRequestId,"BasicCommunication.SystemRequest", "SUCCESS", {}) - end - RUN_AFTER(to_run, 500) - end) - - EXPECT_RESPONSE(CorIdSystemRequest, { success = true, resultCode = "SUCCESS"}) + self.mobileSession:ExpectNotification("OnSystemRequest", { requestType = "PROPRIETARY" }) :Do(function() - local RequestIdGetUserFriendlyMessage = self.hmiConnection:SendRequest("SDL.GetUserFriendlyMessage", - {language = "EN-US", messageCodes = {"StatusUpToDate"}}) - EXPECT_HMIRESPONSE(RequestIdGetUserFriendlyMessage) - end) + local CorIdSystemRequest = self.mobileSession:SendRPC("SystemRequest", + { fileName = "PolicyTableUpdate", requestType = "PROPRIETARY", appID = self.HMIAppID2 }, + "files/PTU_NewDefaultPermissions.json") + + EXPECT_HMICALL("BasicCommunication.SystemRequest") + :Do(function(_,data) + local systemRequestId = data.id + self.hmiConnection:SendNotification("SDL.OnReceivedPolicyUpdate", { policyfile = "/tmp/fs/mp/images/ivsu_cache/PolicyTableUpdate" }) + + local function to_run() + self.hmiConnection:SendResponse(systemRequestId,"BasicCommunication.SystemRequest", "SUCCESS", {}) + end + RUN_AFTER(to_run, 500) + end) + + EXPECT_RESPONSE(CorIdSystemRequest, { success = true, resultCode = "SUCCESS"}) + :Do(function() + local RequestIdGetUserFriendlyMessage = self.hmiConnection:SendRequest("SDL.GetUserFriendlyMessage", + {language = "EN-US", messageCodes = {"StatusUpToDate"}}) + EXPECT_HMIRESPONSE(RequestIdGetUserFriendlyMessage) + end) + end) end --[[ Test ]] diff --git a/test_scripts/Protocol/NACKReason/004_Invalid_Certificate_NACK.lua b/test_scripts/Protocol/NACKReason/004_Invalid_Certificate_NACK.lua index 2f6426c6e6..fa357bef40 100644 --- a/test_scripts/Protocol/NACKReason/004_Invalid_Certificate_NACK.lua +++ b/test_scripts/Protocol/NACKReason/004_Invalid_Certificate_NACK.lua @@ -43,9 +43,12 @@ local common = require("test_scripts/Protocol/commonProtocol") --[[ Test Configuration ]] runner.testSettings.isSelfIncluded = false +runner.testSettings.restrictions.sdlBuildOptions = { { extendedPolicy = { "PROPRIETARY", "EXTERNAL_PROPRIETARY" } } } config.defaultProtocolVersion = 5 --[[ Local Variables ]] +local odometerValue = 0 + rpcServiceParams = { [1] = { reqParams = { @@ -68,6 +71,7 @@ local function missingCertificateNACK(pAppId, pServiceId, pRequestPayload, pResp :Times(0) local function ptUpdate(pTbl) pTbl.policy_table.module_config.certificate = nil + pTbl.policy_table.module_config.exchange_after_x_kilometers = 10 end common.policyTableUpdateSuccess(ptUpdate) end @@ -84,6 +88,12 @@ local function expiredCertificateNACK(pAppId, pServiceId, pRequestPayload, pResp common.policyTableUpdateSuccess(ptUpdate) end +local function setUpdating() + odometerValue = odometerValue + 20 + common.getHMIConnection():SendNotification("VehicleInfo.OnVehicleData", { odometer = odometerValue }) + common.hmi.getConnection():ExpectNotification("SDL.OnStatusUpdate", + { status = "UPDATE_NEEDED" }) +end --[[ Scenario ]] runner.Title("Preconditions") @@ -96,13 +106,16 @@ runner.Step("Register App 2", common.registerApp, {2}) runner.Title("Test NAK reason param(protocol version 5.3.0)") runner.Step("PolicyTableUpdate", common.policyTableUpdate) runner.Step("Switch RPC Service to Protected mode NACK (Missing certificate)", missingCertificateNACK, {1, common.serviceType.RPC, rpcServiceParams[1].reqParams, rpcServiceParams[1].nackParams}) +runner.Step("Begin PTU process", setUpdating) runner.Step("PolicyTableUpdate", common.policyTableUpdate) runner.Step("Switch RPC Service to Protected mode NACK(Expired certificate)", expiredCertificateNACK, {1, common.serviceType.RPC, rpcServiceParams[1].reqParams, rpcServiceParams[1].nackParams}) runner.Title("Test NAK reason param(protocol version 5.2.0)") +runner.Step("Begin PTU process", setUpdating) runner.Step("PolicyTableUpdate", common.policyTableUpdate) runner.Step("Switch RPC Service to Protected mode NACK (Missing certificate)", missingCertificateNACK, {2, common.serviceType.RPC, rpcServiceParams[2].reqParams, rpcServiceParams[2].nackParams}) +runner.Step("Begin PTU process", setUpdating) runner.Step("PolicyTableUpdate", common.policyTableUpdate) runner.Step("Switch RPC Service to Protected mode NACK(Expired certificate)", expiredCertificateNACK, {2, common.serviceType.RPC, rpcServiceParams[2].reqParams, rpcServiceParams[2].nackParams}) diff --git a/test_scripts/Resumption/Handling_errors_from_HMI/007_resume_all_data_with_one_error_rpc_2apps_unexpected_disconnect.lua b/test_scripts/Resumption/Handling_errors_from_HMI/007_resume_all_data_with_one_error_rpc_2apps_unexpected_disconnect.lua index f3285c72ca..af3ccadd90 100644 --- a/test_scripts/Resumption/Handling_errors_from_HMI/007_resume_all_data_with_one_error_rpc_2apps_unexpected_disconnect.lua +++ b/test_scripts/Resumption/Handling_errors_from_HMI/007_resume_all_data_with_one_error_rpc_2apps_unexpected_disconnect.lua @@ -38,7 +38,7 @@ local rpcs = { addCommand = { "UI", "VR" }, addSubMenu = { "UI" }, createIntrerationChoiceSet = { "VR" }, - setGlobalProperties = { "UI", "TTS" }, + setGlobalProperties = { "UI", "TTS", "RC" }, subscribeVehicleData = { "VehicleInfo" }, getInteriorVehicleData = { "RC" }, createWindow = { "UI" }, @@ -49,7 +49,7 @@ local rpcsForApp2 = { addCommand = { "UI", "VR" }, addSubMenu = { "UI" }, createIntrerationChoiceSet = { "VR" }, - setGlobalProperties = { "UI", "TTS" }, + setGlobalProperties = { "UI", "TTS", "RC" }, createWindow = { "UI" }, subscribeButton = { "Buttons" } } diff --git a/test_scripts/Resumption/Handling_errors_from_HMI/008_resume_all_data_with_one_error_rpc_2apps_ign_off.lua b/test_scripts/Resumption/Handling_errors_from_HMI/008_resume_all_data_with_one_error_rpc_2apps_ign_off.lua index 32511cb777..f9ab90281e 100644 --- a/test_scripts/Resumption/Handling_errors_from_HMI/008_resume_all_data_with_one_error_rpc_2apps_ign_off.lua +++ b/test_scripts/Resumption/Handling_errors_from_HMI/008_resume_all_data_with_one_error_rpc_2apps_ign_off.lua @@ -38,7 +38,7 @@ local rpcs = { addCommand = { "UI", "VR" }, addSubMenu = { "UI" }, createIntrerationChoiceSet = { "VR" }, - setGlobalProperties = { "UI", "TTS" }, + setGlobalProperties = { "UI", "TTS", "RC" }, subscribeVehicleData = { "VehicleInfo" }, getInteriorVehicleData = { "RC" }, createWindow = { "UI" }, @@ -49,7 +49,7 @@ local rpcsForApp2 = { addCommand = { "UI", "VR" }, addSubMenu = { "UI" }, createIntrerationChoiceSet = { "VR" }, - setGlobalProperties = { "UI", "TTS" }, + setGlobalProperties = { "UI", "TTS", "RC" }, createWindow = { "UI" }, subscribeButton = { "Buttons" } } diff --git a/test_scripts/Resumption/Handling_errors_from_HMI/019_resume_all_data_without_response_to_one_rpc_2apps_unexpected_disconnect.lua b/test_scripts/Resumption/Handling_errors_from_HMI/019_resume_all_data_without_response_to_one_rpc_2apps_unexpected_disconnect.lua index 98822a79a1..d085b3257d 100644 --- a/test_scripts/Resumption/Handling_errors_from_HMI/019_resume_all_data_without_response_to_one_rpc_2apps_unexpected_disconnect.lua +++ b/test_scripts/Resumption/Handling_errors_from_HMI/019_resume_all_data_without_response_to_one_rpc_2apps_unexpected_disconnect.lua @@ -38,7 +38,7 @@ local rpcs = { addCommand = { "UI", "VR" }, addSubMenu = { "UI" }, createIntrerationChoiceSet = { "VR" }, - setGlobalProperties = { "UI", "TTS" }, + setGlobalProperties = { "UI", "TTS", "RC" }, subscribeVehicleData = { "VehicleInfo" }, getInteriorVehicleData = { "RC" }, createWindow = { "UI" }, @@ -49,7 +49,7 @@ local rpcsForApp2 = { addCommand = { "UI", "VR" }, addSubMenu = { "UI" }, createIntrerationChoiceSet = { "VR" }, - setGlobalProperties = { "UI", "TTS" }, + setGlobalProperties = { "UI", "TTS", "RC" }, createWindow = { "UI" }, subscribeButton = { "Buttons" } } diff --git a/test_scripts/Resumption/Handling_errors_from_HMI/020_resume_all_data_without_response_to_one_rpc_2apps_ign_off.lua b/test_scripts/Resumption/Handling_errors_from_HMI/020_resume_all_data_without_response_to_one_rpc_2apps_ign_off.lua index 7a24a65f9c..a5b16f15df 100644 --- a/test_scripts/Resumption/Handling_errors_from_HMI/020_resume_all_data_without_response_to_one_rpc_2apps_ign_off.lua +++ b/test_scripts/Resumption/Handling_errors_from_HMI/020_resume_all_data_without_response_to_one_rpc_2apps_ign_off.lua @@ -38,7 +38,7 @@ local rpcs = { addCommand = { "UI", "VR" }, addSubMenu = { "UI" }, createIntrerationChoiceSet = { "VR" }, - setGlobalProperties = { "UI", "TTS" }, + setGlobalProperties = { "UI", "TTS", "RC" }, subscribeVehicleData = { "VehicleInfo" }, getInteriorVehicleData = { "RC" }, createWindow = { "UI" }, @@ -49,7 +49,7 @@ local rpcsForApp2 = { addCommand = { "UI", "VR" }, addSubMenu = { "UI" }, createIntrerationChoiceSet = { "VR" }, - setGlobalProperties = { "UI", "TTS" }, + setGlobalProperties = { "UI", "TTS", "RC" }, createWindow = { "UI" }, subscribeButton = { "Buttons" } } diff --git a/test_scripts/Resumption/Handling_errors_from_HMI/commonResumptionErrorHandling.lua b/test_scripts/Resumption/Handling_errors_from_HMI/commonResumptionErrorHandling.lua index 9edfc65288..e81eb83fcd 100644 --- a/test_scripts/Resumption/Handling_errors_from_HMI/commonResumptionErrorHandling.lua +++ b/test_scripts/Resumption/Handling_errors_from_HMI/commonResumptionErrorHandling.lua @@ -56,7 +56,7 @@ m.rpcs = { addCommand = { "UI", "VR" }, addSubMenu = { "UI" }, createIntrerationChoiceSet = { "VR" }, - setGlobalProperties = { "UI", "TTS" }, + setGlobalProperties = { "UI", "TTS", "RC" }, subscribeVehicleData = { "VehicleInfo" }, subscribeWayPoints = { "Navigation" }, createWindow = { "UI" }, @@ -153,14 +153,28 @@ local function isResponseErroneous(pData, pErrorRpc, pErrorInterface) elseif pErrorRpc == "setGlobalProperties" then local helpPromptText = "Help prompt1" local vrHelpTitle ="VR help title1" + local userLocation = { + grid = { + col = 1, + colspan = 1, + level = 2, + levelspan = 1, + row = 2, + rowspan =1 + } + } if pData.method == "TTS.SetGlobalProperties" then if pErrorInterface == "TTS" and pData.params.helpPrompt[1].text == helpPromptText then return true end - else + elseif pData.method == "UI.SetGlobalProperties" then if pErrorInterface == "UI" and pData.params.vrHelpTitle == vrHelpTitle then return true end + elseif pData.method == "RC.SetGlobalProperties" then + if pErrorInterface == "RC" and utils.isTableEqual(pData.params.userLocation, userLocation) then + return true + end end end end @@ -223,10 +237,22 @@ function m.getGlobalPropertiesResetData(pAppId, pInterface) resetData.timeoutPrompt[key] = data resetData.helpPrompt[key] = data end - else + elseif pInterface == "UI" then resetData.menuTitle = "" resetData.vrHelp = { [1] = { position = 1, text = m.getConfigAppParams(pAppId).appName }} resetData.vrHelpTitle = SDL.INI.get("HelpTitle") + elseif pInterface == "RC" then + local defaultUserLocation = { + grid = { + col = 0, + colspan = 1, + level = 0, + levelspan = 1, + row = 0, + rowspan =1 + } + } + resetData.userLocation = defaultUserLocation end return resetData end @@ -485,6 +511,34 @@ m.rpcsRevert = { end end) :Times(pTimes) + end, + RC = function(pAppId, pTimes) + if not pTimes then pTimes = 2 end + m.getHMIConnection():ExpectRequest("RC.SetGlobalProperties") + :Do(function(_, data) + m.sendResponse(data) + end) + :ValidIf(function(exp, data) + if exp.occurences == 1 then + if utils.isTableEqual(data.params, m.resumptionData[pAppId].setGlobalProperties.RC) == true then + return true + else + return false, "Params in RC.SetGlobalProperties are not match to expected result.\n" .. + "Actual result:" .. m.tableToString(data.params) .. "\n" .. + "Expected result:" .. m.tableToString(m.resumptionData[pAppId].setGlobalProperties.RC) .."\n" + end + else + local resetData = m.getGlobalPropertiesResetData(pAppId, "RC") + if utils.isTableEqual(data.params, resetData) == true then + return true + else + return false, "Params in RC.SetGlobalProperties are not match to expected result.\n" .. + "Actual result:" .. m.tableToString(data.params) .. "\n" .. + "Expected result:" .. m.tableToString(resetData) .."\n" + end + end + end) + :Times(pTimes) end } }, @@ -833,6 +887,16 @@ function m.setGlobalProperties(pAppId) } }, menuTitle = "Menu Title" .. pAppId, + userLocation = { + grid = { + col = pAppId, + colspan = 1, + level = 2, + levelspan = 1, + row = 2, + rowspan =1 + } + } } local cid = m.getMobileSession(pAppId):SendRPC("SetGlobalProperties", params) m.resumptionData[pAppId].setGlobalProperties = {} @@ -848,6 +912,12 @@ function m.setGlobalProperties(pAppId) m.resumptionData[pAppId].setGlobalProperties.TTS = data.params end) + m.getHMIConnection():ExpectRequest("RC.SetGlobalProperties") + :Do(function(_,data) + m.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", {}) + m.resumptionData[pAppId].setGlobalProperties.RC = data.params + end) + m.getMobileSession(pAppId):ExpectResponse(cid, { success = true, resultCode = "SUCCESS" }) m.getMobileSession(pAppId):ExpectNotification("OnHashChange") :Do(function(_, data) @@ -1010,28 +1080,45 @@ end function m.setGlobalPropertiesResumption(pAppId, pErrorResponseInterface) local timesTTS = 1 local timesUI = 1 + local timesRC = 1 local restoreData = {} if pErrorResponseInterface == "TTS" then timesUI = 2 - restoreData = m.getGlobalPropertiesResetData(pAppId, "UI") + timesRC = 2 + restoreData.UI = m.getGlobalPropertiesResetData(pAppId, "UI") + restoreData.RC = m.getGlobalPropertiesResetData(pAppId, "RC") elseif pErrorResponseInterface == "UI" then timesTTS = 2 - restoreData = m.getGlobalPropertiesResetData(pAppId, "TTS") + timesRC = 2 + restoreData.TTS = m.getGlobalPropertiesResetData(pAppId, "TTS") + restoreData.RC = m.getGlobalPropertiesResetData(pAppId, "RC") + elseif pErrorResponseInterface == "RC" then + timesUI = 2 + timesTTS = 2 + restoreData.UI = m.getGlobalPropertiesResetData(pAppId, "UI") + restoreData.TTS = m.getGlobalPropertiesResetData(pAppId, "TTS") end m.getHMIConnection():ExpectRequest("UI.SetGlobalProperties", m.resumptionData[pAppId].setGlobalProperties.UI, - restoreData) + restoreData.UI) :Do(function(_, data) m.sendResponse(data, pErrorResponseInterface, "UI") end) :Times(timesUI) m.getHMIConnection():ExpectRequest("TTS.SetGlobalProperties", m.resumptionData[pAppId].setGlobalProperties.TTS, - restoreData) + restoreData.TTS) :Do(function(_, data) m.sendResponse(data, pErrorResponseInterface, "TTS") end) :Times(timesTTS) + m.getHMIConnection():ExpectRequest("RC.SetGlobalProperties", + m.resumptionData[pAppId].setGlobalProperties.RC, + restoreData.RC) + :Do(function(_, data) + m.sendResponse(data, pErrorResponseInterface, "RC") + end) + :Times(timesRC) end --[[ @subscribeVehicleDataResumption: check resumption of subscribeVehicleDat data @@ -1285,13 +1372,16 @@ end function m.checkResumptionData2Apps(pErrorRpc, pErrorInterface) local uiSetGPtimes = 3 local ttsSetGPtimes = 3 + local rcSetGPtimes = 3 local rcGIVDtimes = 3 if pErrorRpc == "setGlobalProperties" then if pErrorInterface == "UI" then uiSetGPtimes = 2 - else + elseif pErrorInterface == "TTS" then ttsSetGPtimes = 2 + elseif pErrorInterface == "RC" then + rcSetGPtimes = 2 end end if pErrorRpc == "getInteriorVehicleData" then @@ -1353,6 +1443,12 @@ function m.checkResumptionData2Apps(pErrorRpc, pErrorInterface) end) :Times(ttsSetGPtimes) + m.getHMIConnection():ExpectRequest("RC.SetGlobalProperties") + :Do(function(_, data) + m.sendResponse2Apps(data, pErrorRpc, pErrorInterface) + end) + :Times(rcSetGPtimes) + m.getHMIConnection():ExpectRequest("VehicleInfo.SubscribeVehicleData") :Do(function(_, data) m.sendResponse2Apps(data, pErrorRpc, pErrorInterface) diff --git a/test_scripts/SDL5_0/TemplateColorSchemes/001_TemplateColorSchemes_setDisplayWithColorsAndNewLayoutSuccess.lua b/test_scripts/SDL5_0/TemplateColorSchemes/001_TemplateColorSchemes_setDisplayWithColorsAndNewLayoutSuccess.lua index 26bdfeffc5..d75965769b 100644 --- a/test_scripts/SDL5_0/TemplateColorSchemes/001_TemplateColorSchemes_setDisplayWithColorsAndNewLayoutSuccess.lua +++ b/test_scripts/SDL5_0/TemplateColorSchemes/001_TemplateColorSchemes_setDisplayWithColorsAndNewLayoutSuccess.lua @@ -35,6 +35,21 @@ local function getRequestParams() } end +local function getHMIRequestParams() + return { + templateConfiguration = { + template = "ONSCREEN_PRESETS", + dayColorScheme = { + primaryColor = { + red = 0, + green = 255, + blue = 100 + } + } + } + } +end + local function getRequestParams2() return { displayLayout = "MEDIA", @@ -48,10 +63,25 @@ local function getRequestParams2() } end +local function getHMIRequestParams2() + return { + templateConfiguration = { + template = "MEDIA", + dayColorScheme = { + primaryColor = { + red = 0, + green = 255, + blue = 100 + } + } + } + } +end + local function setDisplayWithColorsSuccess() local responseParams = {} local cid = commonSmoke.getMobileSession():SendRPC("SetDisplayLayout", getRequestParams()) - EXPECT_HMICALL("UI.SetDisplayLayout", getRequestParams()) + EXPECT_HMICALL("UI.Show", getHMIRequestParams()) :Do(function(_, data) commonSmoke.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", responseParams) end) @@ -64,7 +94,7 @@ end local function setDisplayWithColorsAndNewLayoutSuccess() local responseParams = {} local cid = commonSmoke.getMobileSession():SendRPC("SetDisplayLayout", getRequestParams2()) - EXPECT_HMICALL("UI.SetDisplayLayout", getRequestParams2()) + EXPECT_HMICALL("UI.Show", getHMIRequestParams2()) :Do(function(_, data) commonSmoke.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", responseParams) end) diff --git a/test_scripts/SDL5_0/TemplateColorSchemes/002_TemplateColorSchemes_setDisplayWithColorsRejected.lua b/test_scripts/SDL5_0/TemplateColorSchemes/002_TemplateColorSchemes_setDisplayWithColorsRejected.lua index 476162afc8..da4006469a 100644 --- a/test_scripts/SDL5_0/TemplateColorSchemes/002_TemplateColorSchemes_setDisplayWithColorsRejected.lua +++ b/test_scripts/SDL5_0/TemplateColorSchemes/002_TemplateColorSchemes_setDisplayWithColorsRejected.lua @@ -35,6 +35,21 @@ local function getRequestParams() } end +local function getHMIRequestParams() + return { + templateConfiguration = { + template = "ONSCREEN_PRESETS", + dayColorScheme = { + primaryColor = { + red = 0, + green = 255, + blue = 100 + } + } + } + } +end + local function getRequestParams2() return { displayLayout = "ONSCREEN_PRESETS", @@ -51,7 +66,7 @@ end local function setDisplayWithColorsSuccess() local responseParams = {} local cid = commonSmoke.getMobileSession():SendRPC("SetDisplayLayout", getRequestParams()) - EXPECT_HMICALL("UI.SetDisplayLayout", getRequestParams()) + EXPECT_HMICALL("UI.Show", getHMIRequestParams()) :Do(function(_, data) commonSmoke.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", responseParams) end) diff --git a/test_scripts/SDL5_0/TemplateColorSchemes/003_TemplateColorSchemes_setDisplayWithSameColorsSuccess.lua b/test_scripts/SDL5_0/TemplateColorSchemes/003_TemplateColorSchemes_setDisplayWithSameColorsSuccess.lua index 96ef91eab8..0dbe9bace8 100644 --- a/test_scripts/SDL5_0/TemplateColorSchemes/003_TemplateColorSchemes_setDisplayWithSameColorsSuccess.lua +++ b/test_scripts/SDL5_0/TemplateColorSchemes/003_TemplateColorSchemes_setDisplayWithSameColorsSuccess.lua @@ -35,10 +35,25 @@ local function getRequestParams() } end +local function getHMIRequestParams() + return { + templateConfiguration = { + template = "ONSCREEN_PRESETS", + dayColorScheme = { + primaryColor = { + red = 0, + green = 255, + blue = 100 + } + } + } + } +end + local function setDisplayWithColorsSuccess() local responseParams = {} local cid = commonSmoke.getMobileSession():SendRPC("SetDisplayLayout", getRequestParams()) - EXPECT_HMICALL("UI.SetDisplayLayout", getRequestParams()) + EXPECT_HMICALL("UI.Show", getHMIRequestParams()) :Do(function(_, data) commonSmoke.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", responseParams) end) @@ -51,7 +66,7 @@ end local function setDisplayWithSameColorsSuccess() local responseParams = {} local cid = commonSmoke.getMobileSession():SendRPC("SetDisplayLayout", getRequestParams()) - EXPECT_HMICALL("UI.SetDisplayLayout", getRequestParams()) + EXPECT_HMICALL("UI.Show", getHMIRequestParams()) :Do(function(_, data) commonSmoke.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", responseParams) end) diff --git a/test_scripts/Security/RPCMessageProtection/020_SystemRequest_NotEncrypted_even_EncryptedRequired.lua b/test_scripts/Security/RPCMessageProtection/020_SystemRequest_NotEncrypted_even_EncryptedRequired.lua index 7b5999d79f..5f1f74c4d7 100644 --- a/test_scripts/Security/RPCMessageProtection/020_SystemRequest_NotEncrypted_even_EncryptedRequired.lua +++ b/test_scripts/Security/RPCMessageProtection/020_SystemRequest_NotEncrypted_even_EncryptedRequired.lua @@ -37,11 +37,8 @@ local param = { --[[ Local Functions ]] local function rpcUnencryptedEncryptionNotRequired() local cid = common.getMobileSession():SendRPC("SystemRequest", param, file) - common.getHMIConnection():ExpectRequest("BasicCommunication.SystemRequest") - :Do(function(_, data) - common.getHMIConnection():SendResponse(data.id,"BasicCommunication.SystemRequest", "SUCCESS", {}) - end) - common.getMobileSession():ExpectResponse(cid, { success = true, resultCode = "SUCCESS"}) + -- REJECTED because not UPDATING + common.getMobileSession():ExpectResponse(cid, { success = false, resultCode = "REJECTED"}) end local function rpcUnencryptedEncryptionRequired() @@ -51,11 +48,8 @@ end local function rpcEncryptedEncryptionRequired() local cid = common.getMobileSession():SendEncryptedRPC("SystemRequest", param, file) - common.getHMIConnection():ExpectRequest("BasicCommunication.SystemRequest") - :Do(function(_, data) - common.getHMIConnection():SendResponse(data.id,"BasicCommunication.SystemRequest", "SUCCESS", {}) - end) - common.getMobileSession():ExpectEncryptedResponse(cid, { success = true, resultCode = "SUCCESS"}) + -- REJECTED because not UPDATING + common.getMobileSession():ExpectEncryptedResponse(cid, { success = false, resultCode = "REJECTED"}) end --[[ Scenario ]] diff --git a/test_scripts/Security/SecurityQueryErrorHandling/004_SendInternalError_during_handshake_process.lua b/test_scripts/Security/SecurityQueryErrorHandling/004_SendInternalError_during_handshake_process.lua new file mode 100644 index 0000000000..f8b5e5732a --- /dev/null +++ b/test_scripts/Security/SecurityQueryErrorHandling/004_SendInternalError_during_handshake_process.lua @@ -0,0 +1,65 @@ +--------------------------------------------------------------------------------------------------- +-- Case: Send SendInternalError query with INTERNAL error code when establishing a secure audio +-- service, verify Core handles the message internally and that it does not interrupt the +-- handshake process +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require("test_scripts/Security/SecurityQueryErrorHandling/common") +local commonTestCases = require('user_modules/shared_testcases/commonTestCases') +local constants = require("protocol_handler/ford_protocol_constants") +local securityConstants = require('security/security_constants') +local json = require("json") + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false +config.application1.registerAppInterfaceParams.appHMIType = { "NAVIGATION" } + +--[[ Local Functions ]] +local function startHandshake() + local serviceId = 10 + common.getMobileSession():StartSecureService(serviceId) + common.getMobileSession():ExpectControlMessage(serviceId, { + frameInfo = constants.FRAME_INFO.START_SERVICE_ACK, + encryption = true + }) + + local params = { + frameInfo = 0, + serviceType = constants.SERVICE_TYPE.CONTROL, + encryption = false, + rpcType = constants.BINARY_RPC_TYPE.NOTIFICATION, + rpcFunctionId = constants.BINARY_RPC_FUNCTION_ID.INTERNAL_ERROR, + payload = json.encode({ + id = constants.QUERY_ERROR_CODE.INTERNAL, + text = "Something went wrong" + }), + binaryData = string.char(constants.QUERY_ERROR_CODE.INTERNAL) + } + + common.getMobileSession():ExpectHandshakeMessage() + :Do(function(_, data) + common.sendSecurityQuery(params) + end) + :Times(1) + commonTestCases:DelayedExp(5000) +end + +local function checkCrashed() + if not common.sdl.isRunning() then common.run.fail("SDL crashed") end +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Init SDL certificates", common.initSDLCertificates, { "./files/Security/client_credential.pem" }) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) + +runner.Title("Test") +runner.Step("Register App", common.registerApp) +runner.Step("Activate App", common.activateApp) +runner.Step("Send handshake for audio service", startHandshake) +runner.Step("Check SDL Core status", checkCrashed) + +runner.Title("Postconditions") +runner.Step("Stop SDL, clean-up certificates", common.postconditions) diff --git a/test_scripts/Security/SecurityQueryErrorHandling/005_Malformed_SendInternalError_during_handshake.lua b/test_scripts/Security/SecurityQueryErrorHandling/005_Malformed_SendInternalError_during_handshake.lua new file mode 100644 index 0000000000..ece859f774 --- /dev/null +++ b/test_scripts/Security/SecurityQueryErrorHandling/005_Malformed_SendInternalError_during_handshake.lua @@ -0,0 +1,62 @@ +--------------------------------------------------------------------------------------------------- +-- Case: Send SendInternalError query with INTERNAL error code and a malformed payload when +-- establishing a secure audio service, verify Core handles the message internally and that +-- it does not interrupt the handshake process +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require("test_scripts/Security/SecurityQueryErrorHandling/common") +local commonTestCases = require('user_modules/shared_testcases/commonTestCases') +local constants = require("protocol_handler/ford_protocol_constants") +local securityConstants = require('security/security_constants') +local json = require("json") + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false +config.application1.registerAppInterfaceParams.appHMIType = { "NAVIGATION" } + +--[[ Local Functions ]] +local function startHandshake() + local serviceId = 10 + common.getMobileSession():StartSecureService(serviceId) + common.getMobileSession():ExpectControlMessage(serviceId, { + frameInfo = constants.FRAME_INFO.START_SERVICE_ACK, + encryption = true + }) + + local params = { + frameInfo = 0, + serviceType = constants.SERVICE_TYPE.CONTROL, + encryption = false, + rpcType = constants.BINARY_RPC_TYPE.NOTIFICATION, + rpcFunctionId = constants.BINARY_RPC_FUNCTION_ID.INTERNAL_ERROR, + payload = json.encode(constants.QUERY_ERROR_CODE.INTERNAL), + binaryData = string.char(constants.QUERY_ERROR_CODE.INTERNAL) + } + + common.getMobileSession():ExpectHandshakeMessage() + :Do(function(_, data) + common.sendSecurityQuery(params) + end) + :Times(1) + commonTestCases:DelayedExp(5000) +end + +local function checkCrashed() + if not common.sdl.isRunning() then common.run.fail("SDL crashed") end +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Init SDL certificates", common.initSDLCertificates, { "./files/Security/client_credential.pem" }) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) + +runner.Title("Test") +runner.Step("Register App", common.registerApp) +runner.Step("Activate App", common.activateApp) +runner.Step("Send handshake for audio service", startHandshake) +runner.Step("Check SDL Core status", checkCrashed) + +runner.Title("Postconditions") +runner.Step("Stop SDL, clean-up certificates", common.postconditions) diff --git a/test_scripts/Security/SecurityQueryErrorHandling/006_Invalid_SendInternalError_during_handshake.lua b/test_scripts/Security/SecurityQueryErrorHandling/006_Invalid_SendInternalError_during_handshake.lua new file mode 100644 index 0000000000..aeff1e04c4 --- /dev/null +++ b/test_scripts/Security/SecurityQueryErrorHandling/006_Invalid_SendInternalError_during_handshake.lua @@ -0,0 +1,65 @@ +--------------------------------------------------------------------------------------------------- +-- Case: Send SendInternalError query with invalid/unknown error code when establishing a secure +-- audio service, verify Core handles the message internally and that it does not interrupt +-- the handshake process +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require("test_scripts/Security/SecurityQueryErrorHandling/common") +local commonTestCases = require('user_modules/shared_testcases/commonTestCases') +local constants = require("protocol_handler/ford_protocol_constants") +local securityConstants = require('security/security_constants') +local json = require("json") + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false +config.application1.registerAppInterfaceParams.appHMIType = { "NAVIGATION" } + +--[[ Local Functions ]] +local function startHandshake() + local serviceId = 10 + common.getMobileSession():StartSecureService(serviceId) + common.getMobileSession():ExpectControlMessage(serviceId, { + frameInfo = constants.FRAME_INFO.START_SERVICE_ACK, + encryption = true + }) + + local params = { + frameInfo = 0, + serviceType = constants.SERVICE_TYPE.CONTROL, + encryption = false, + rpcType = constants.BINARY_RPC_TYPE.NOTIFICATION, + rpcFunctionId = constants.BINARY_RPC_FUNCTION_ID.INTERNAL_ERROR, + payload = json.encode({ + id = 0xDE, -- Unknown error code + text = "Something went wrong" + }), + binaryData = string.char(0xDE) + } + + common.getMobileSession():ExpectHandshakeMessage() + :Do(function(_, data) + common.sendSecurityQuery(params) + end) + :Times(1) + commonTestCases:DelayedExp(5000) +end + +local function checkCrashed() + if not common.sdl.isRunning() then common.run.fail("SDL crashed") end +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Init SDL certificates", common.initSDLCertificates, { "./files/Security/client_credential.pem" }) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) + +runner.Title("Test") +runner.Step("Register App", common.registerApp) +runner.Step("Activate App", common.activateApp) +runner.Step("Send handshake for audio service", startHandshake) +runner.Step("Check SDL Core status", checkCrashed) + +runner.Title("Postconditions") +runner.Step("Stop SDL, clean-up certificates", common.postconditions) diff --git a/test_scripts/Security/SecurityQueryErrorHandling/common.lua b/test_scripts/Security/SecurityQueryErrorHandling/common.lua index 51b0d779dd..cf2d1f0b9e 100644 --- a/test_scripts/Security/SecurityQueryErrorHandling/common.lua +++ b/test_scripts/Security/SecurityQueryErrorHandling/common.lua @@ -53,6 +53,11 @@ function common.expectSecurityQuery(params) end) end +function common.sendSecurityQuery(params) + local session = common.getMobileSession().mobile_session_impl.control_services.session + session:Send(params) +end + function common.HandshakeMessageError(handshakeResponse, expErrorNotification) local session = common.getMobileSession().mobile_session_impl.control_services.session local handshakeEvent = events.Event() diff --git a/test_scripts/Smoke/API/012_PerfomInteraction_PositiveCase_SUCCESS.lua b/test_scripts/Smoke/API/012_PerfomInteraction_PositiveCase_SUCCESS.lua index 3ce3bbef09..c3e07d0c88 100644 --- a/test_scripts/Smoke/API/012_PerfomInteraction_PositiveCase_SUCCESS.lua +++ b/test_scripts/Smoke/API/012_PerfomInteraction_PositiveCase_SUCCESS.lua @@ -255,6 +255,8 @@ end local function PI_ViaMANUAL_ONLY(pParams) pParams.interactionMode = "MANUAL_ONLY" local cid = common.getMobileSession():SendRPC("PerformInteraction", pParams) + common.getHMIConnection():ExpectRequest("UI.ClosePopUp") + :Times(0) common.getHMIConnection():ExpectRequest("VR.PerformInteraction", { helpPrompt = pParams.helpPrompt, initialPrompt = pParams.initialPrompt, @@ -293,6 +295,8 @@ end local function PI_ViaBOTH(pParams) pParams.interactionMode = "BOTH" local cid = common.getMobileSession():SendRPC("PerformInteraction",pParams) + common.getHMIConnection():ExpectRequest("UI.ClosePopUp") + :Times(0) common.getHMIConnection():ExpectRequest("VR.PerformInteraction", { helpPrompt = pParams.helpPrompt, initialPrompt = pParams.initialPrompt, @@ -343,6 +347,8 @@ end local function PI_ViaBOTHuiChoice(pParams) pParams.interactionMode = "BOTH" local cid = common.getMobileSession():SendRPC("PerformInteraction",pParams) + common.getHMIConnection():ExpectRequest("UI.ClosePopUp") + :Times(0) common.getHMIConnection():ExpectRequest("VR.PerformInteraction", { helpPrompt = pParams.helpPrompt, initialPrompt = pParams.initialPrompt, diff --git a/test_scripts/Smoke/API/020_SetDisplayLayout_PositiveCase_SUCCESS.lua b/test_scripts/Smoke/API/020_SetDisplayLayout_PositiveCase_SUCCESS.lua index 650e294656..56e1842d85 100644 --- a/test_scripts/Smoke/API/020_SetDisplayLayout_PositiveCase_SUCCESS.lua +++ b/test_scripts/Smoke/API/020_SetDisplayLayout_PositiveCase_SUCCESS.lua @@ -30,195 +30,39 @@ --[[ Required Shared libraries ]] local runner = require('user_modules/script_runner') local common = require('test_scripts/Smoke/commonSmoke') +local hmi_values = require('user_modules/hmi_values') --[[ Test Configuration ]] runner.testSettings.isSelfIncluded = false --[[ Local Functions ]] -local function getSoftButCapValues() - return { - { - shortPressAvailable = true, - longPressAvailable = true, - upDownAvailable = true, - imageSupported = true - } - } -end - -local function getPresetBankCapValues() - return { onScreenPresetsAvailable = true } -end - -local function getButCapValues() - local names = { - "PRESET_0", - "PRESET_1", - "PRESET_2", - "PRESET_3", - "PRESET_4", - "PRESET_5", - "PRESET_6", - "PRESET_7", - "PRESET_8", - "PRESET_9", - "OK", - "SEEKLEFT", - "SEEKRIGHT", - "TUNEUP", - "TUNEDOWN" - } - local values = { } - for _, v in pairs(names) do - local item = { - name = v, - shortPressAvailable = true, - longPressAvailable = true, - upDownAvailable = true - } - table.insert(values, item) - end - return values -end - -local function getDisplayCapImageFieldsValues() - local names = { - "softButtonImage", - "choiceImage", - "choiceSecondaryImage", - "vrHelpItem", - "turnIcon", - "menuIcon", - "cmdIcon", - "graphic", - "secondaryGraphic", - "showConstantTBTIcon", - "showConstantTBTNextTurnIcon" - } - local values = { } - for _, v in pairs(names) do - local item = { - imageResolution = { - resolutionHeight = 64, - resolutionWidth = 64 - }, - imageTypeSupported = { - "GRAPHIC_BMP", - "GRAPHIC_JPEG", - "GRAPHIC_PNG" - }, - name = v - } - table.insert(values, item) - end - return values -end - -local function getDisplayCapTextFieldsValues() - -- some text fields are excluded due to SDL issue - local names = { - "alertText1", - "alertText2", - "alertText3", - "audioPassThruDisplayText1", - "audioPassThruDisplayText2", - "ETA", - "initialInteractionText", - -- "phoneNumber", - "mainField1", - "mainField2", - "mainField3", - "mainField4", - "mediaClock", - "mediaTrack", - "menuName", - "menuTitle", - -- "addressLines", - -- "locationName", - "navigationText1", - "navigationText2", - -- "locationDescription", - "scrollableMessageBody", - "secondaryText", - "sliderFooter", - "sliderHeader", - "statusBar", - "tertiaryText", - "totalDistance", - "timeToDestination", - "turnText" - } - local values = { } - for _, v in pairs(names) do - local item = { - characterSet = "UTF_8", - name = v, - rows = 1, - width = 500 - } - table.insert(values, item) - end - return values -end - -local function getDisplayCapValues() - -- some capabilities are excluded due to SDL issue - return { - displayType = "GEN2_8_DMA", - displayName = "GENERIC_DISPLAY", - graphicSupported = true, - -- imageCapabilities = { - -- "DYNAMIC", - -- "STATIC" - -- }, - imageFields = getDisplayCapImageFieldsValues(), - mediaClockFormats = { - "CLOCK1", - "CLOCK2", - "CLOCK3", - "CLOCKTEXT1", - "CLOCKTEXT2", - "CLOCKTEXT3", - "CLOCKTEXT4" - }, - numCustomPresetsAvailable = 10, - screenParams = { - resolution = { - resolutionHeight = 480, - resolutionWidth = 800 - }, - touchEventAvailable = { - doublePressAvailable = false, - multiTouchAvailable = true, - pressAvailable = true - } - }, - templatesAvailable = { - "ONSCREEN_PRESETS" - }, - textFields = getDisplayCapTextFieldsValues() - } +local function getRequestParams() + return { displayLayout = "TEMPLATE" } end -local function getRequestParams() - return { displayLayout = "ONSCREEN_PRESETS" } +local function getHMIRequestParams() + return { templateConfiguration = { template = "TEMPLATE" } } end local function getResponseParams() + local hmiTable = hmi_values.getDefaultHMITable() + local defaultDisplayCapabilities = hmiTable.UI.GetCapabilities.params.displayCapabilities + defaultDisplayCapabilities.imageCapabilities = nil -- some capabilities are excluded due to SDL issue + return { - displayCapabilities = getDisplayCapValues(), - buttonCapabilities = getButCapValues(), - softButtonCapabilities = getSoftButCapValues(), - presetBankCapabilities = getPresetBankCapValues() + displayCapabilities = defaultDisplayCapabilities, + buttonCapabilities = hmiTable.Buttons.GetCapabilities.params.capabilities, + softButtonCapabilities = hmiTable.UI.GetCapabilities.params.softButtonCapabilities, + presetBankCapabilities = hmiTable.Buttons.GetCapabilities.params.presetBankCapabilities } end local function setDisplaySuccess() local responseParams = getResponseParams() local cid = common.getMobileSession():SendRPC("SetDisplayLayout", getRequestParams()) - common.getHMIConnection():ExpectRequest("UI.SetDisplayLayout", getRequestParams()) + common.getHMIConnection():ExpectRequest("UI.Show", getHMIRequestParams()) :Do(function(_, data) - common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", responseParams) + common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", {}) end) common.getMobileSession():ExpectResponse(cid, { success = true, diff --git a/test_scripts/TheSameApp/Policies/AppId/002_PTU_is_triggered_after_registration_app_with_different_app_id.lua b/test_scripts/TheSameApp/Policies/AppId/002_PTU_is_triggered_after_registration_app_with_different_app_id.lua index 03f6545355..14f2cce4a1 100644 --- a/test_scripts/TheSameApp/Policies/AppId/002_PTU_is_triggered_after_registration_app_with_different_app_id.lua +++ b/test_scripts/TheSameApp/Policies/AppId/002_PTU_is_triggered_after_registration_app_with_different_app_id.lua @@ -22,6 +22,7 @@ local common = require('test_scripts/TheSameApp/commonTheSameApp') --[[ Test Configuration ]] runner.testSettings.isSelfIncluded = false +runner.testSettings.restrictions.sdlBuildOptions = { { extendedPolicy = { "PROPRIETARY", "EXTERNAL_PROPRIETARY" } } } --[[ Local Data ]] local devices = { diff --git a/test_scripts/WidgetSupport/Templates/SetDisplayLayout/001_SetDisplayLayout_2_requests.lua b/test_scripts/WidgetSupport/Templates/SetDisplayLayout/001_SetDisplayLayout_2_requests.lua index ad3d0d429c..b519248482 100644 --- a/test_scripts/WidgetSupport/Templates/SetDisplayLayout/001_SetDisplayLayout_2_requests.lua +++ b/test_scripts/WidgetSupport/Templates/SetDisplayLayout/001_SetDisplayLayout_2_requests.lua @@ -58,6 +58,7 @@ local testCases = { local id local params = { } +local HMIParams = { } local schemaTypes = { DAY = "day", @@ -108,12 +109,19 @@ local function setParams(pTC) dayColorScheme = getColorScheme(schemaTypes.DAY, pTC.day), nightColorScheme = getColorScheme(schemaTypes.NIGHT, pTC.night) } + HMIParams = { + templateConfiguration = { + template = getLayout(pTC.layout), + dayColorScheme = getColorScheme(schemaTypes.DAY, pTC.day), + nightColorScheme = getColorScheme(schemaTypes.NIGHT, pTC.night) + } + } id = id + 1 end local function sendSetDisplayLayout_SUCCESS() local cid = common.getMobileSession():SendRPC("SetDisplayLayout", params) - common.getHMIConnection():ExpectRequest("UI.SetDisplayLayout", params) + common.getHMIConnection():ExpectRequest("UI.Show", HMIParams) :Do(function(_, data) common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", {}) end) @@ -122,7 +130,7 @@ end local function sendSetDisplayLayout_UNSUCCESS(pResultCode) local cid = common.getMobileSession():SendRPC("SetDisplayLayout", params) - common.getHMIConnection():ExpectRequest("UI.SetDisplayLayout") + common.getHMIConnection():ExpectRequest("UI.Show") :Times(0) common.getMobileSession():ExpectResponse(cid, { success = false, resultCode = pResultCode }) end diff --git a/test_scripts/WidgetSupport/Templates/SetDisplayLayout/002_SetDisplayLayout_RAI_and_request.lua b/test_scripts/WidgetSupport/Templates/SetDisplayLayout/002_SetDisplayLayout_RAI_and_request.lua index d63d1d709f..d0ad82808b 100644 --- a/test_scripts/WidgetSupport/Templates/SetDisplayLayout/002_SetDisplayLayout_RAI_and_request.lua +++ b/test_scripts/WidgetSupport/Templates/SetDisplayLayout/002_SetDisplayLayout_RAI_and_request.lua @@ -40,6 +40,7 @@ local testCases = { local id local params = { } +local HMIParams = { } local schemaTypes = { DAY = "day", @@ -90,12 +91,19 @@ local function setParams(pTC) dayColorScheme = getColorScheme(schemaTypes.DAY, pTC.day), nightColorScheme = getColorScheme(schemaTypes.NIGHT, pTC.night) } + HMIParams = { + templateConfiguration = { + template = getLayout(pTC.layout), + dayColorScheme = getColorScheme(schemaTypes.DAY, pTC.day), + nightColorScheme = getColorScheme(schemaTypes.NIGHT, pTC.night) + } + } id = id + 1 end local function sendSetDisplayLayout_SUCCESS() local cid = common.getMobileSession():SendRPC("SetDisplayLayout", params) - common.getHMIConnection():ExpectRequest("UI.SetDisplayLayout", params) + common.getHMIConnection():ExpectRequest("UI.Show", HMIParams) :Do(function(_, data) common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", {}) end) @@ -104,7 +112,7 @@ end local function sendSetDisplayLayout_UNSUCCESS(pResultCode) local cid = common.getMobileSession():SendRPC("SetDisplayLayout", params) - common.getHMIConnection():ExpectRequest("UI.SetDisplayLayout") + common.getHMIConnection():ExpectRequest("UI.Show") :Times(0) common.getMobileSession():ExpectResponse(cid, { success = false, resultCode = pResultCode }) end diff --git a/test_scripts/WidgetSupport/Templates/SetDisplayLayout/003_SetDisplayLayout_unsuccessful_HMI_response.lua b/test_scripts/WidgetSupport/Templates/SetDisplayLayout/003_SetDisplayLayout_unsuccessful_HMI_response.lua index ea9f189c52..39d0192f2e 100644 --- a/test_scripts/WidgetSupport/Templates/SetDisplayLayout/003_SetDisplayLayout_unsuccessful_HMI_response.lua +++ b/test_scripts/WidgetSupport/Templates/SetDisplayLayout/003_SetDisplayLayout_unsuccessful_HMI_response.lua @@ -38,7 +38,7 @@ local params = { --[[ Local Functions ]] local function sendSetDisplayLayout_UNSUCCESS_noHMIResponse() local cid = common.getMobileSession():SendRPC("SetDisplayLayout", params) - common.getHMIConnection():ExpectRequest("UI.SetDisplayLayout") + common.getHMIConnection():ExpectRequest("UI.Show") :Do(function() -- no response from HMI end) @@ -47,7 +47,7 @@ end local function sendSetDisplayLayout_UNSUCCESS_errorHMIResponse() local cid = common.getMobileSession():SendRPC("SetDisplayLayout", params) - common.getHMIConnection():ExpectRequest("UI.SetDisplayLayout") + common.getHMIConnection():ExpectRequest("UI.Show") :Do(function(_, data) common.getHMIConnection():SendError(data.id, data.method, "TIMED_OUT", "Error code") end) @@ -56,7 +56,7 @@ end local function sendSetDisplayLayout_UNSUCCESS_invalidHMIResponse() local cid = common.getMobileSession():SendRPC("SetDisplayLayout", params) - common.getHMIConnection():ExpectRequest("UI.SetDisplayLayout") + common.getHMIConnection():ExpectRequest("UI.Show") :Do(function(_, data) common.getHMIConnection():SendResponse(data.id, 123, "SUCCESS", {}) -- invalid method end) diff --git a/test_scripts/WidgetSupport/Versioning/002_SetDisplayLayout_new_app.lua b/test_scripts/WidgetSupport/Versioning/002_SetDisplayLayout_new_app.lua index e359ab637e..7bb1aeb7b3 100644 --- a/test_scripts/WidgetSupport/Versioning/002_SetDisplayLayout_new_app.lua +++ b/test_scripts/WidgetSupport/Versioning/002_SetDisplayLayout_new_app.lua @@ -24,7 +24,7 @@ local function sendSetDisplayLayout() displayLayout = "Layout1" } local cid = common.getMobileSession():SendRPC("SetDisplayLayout", params) - common.getHMIConnection():ExpectRequest("UI.SetDisplayLayout") + common.getHMIConnection():ExpectRequest("UI.Show") :Do(function(_, data) common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", {}) end) diff --git a/test_scripts/WidgetSupport/Versioning/004_SetDisplayLayout_old_app.lua b/test_scripts/WidgetSupport/Versioning/004_SetDisplayLayout_old_app.lua index 6a4bc0f3d9..1bcdac3ea3 100644 --- a/test_scripts/WidgetSupport/Versioning/004_SetDisplayLayout_old_app.lua +++ b/test_scripts/WidgetSupport/Versioning/004_SetDisplayLayout_old_app.lua @@ -24,7 +24,7 @@ local function sendSetDisplayLayout() displayLayout = "Layout1" } local cid = common.getMobileSession():SendRPC("SetDisplayLayout", params) - common.getHMIConnection():ExpectRequest("UI.SetDisplayLayout") + common.getHMIConnection():ExpectRequest("UI.Show") :Do(function(_, data) common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", {}) end) diff --git a/test_sets/API/vehicle_data.txt b/test_sets/API/vehicle_data.txt index 2dc4e839d1..5623c5f282 100644 --- a/test_sets/API/vehicle_data.txt +++ b/test_sets/API/vehicle_data.txt @@ -8,6 +8,7 @@ ./test_scripts/API/VehicleData/GetVehicleData/008_GetVD_app_version_is_less_than_parameter_version.lua ./test_scripts/API/VehicleData/GetVehicleData/009_GetVD_min_max_boundary_values.lua ./test_scripts/API/VehicleData/GetVehicleData/010_GetVD_enum_and_bool_values.lua +./test_scripts/API/VehicleData/GetVehicleData/011_GetVD_allowed_and_disallowed_after_PTU.lua ./test_scripts/API/VehicleData/OnVehicleData/001_OnVD_Success.lua ./test_scripts/API/VehicleData/OnVehicleData/002_OnVD_disallowed.lua ./test_scripts/API/VehicleData/OnVehicleData/003_OnVD_disallowed_after_PTU.lua @@ -16,6 +17,8 @@ ./test_scripts/API/VehicleData/OnVehicleData/006_OnVD_mandatory_parameters.lua ./test_scripts/API/VehicleData/OnVehicleData/007_OnVD_min_max_boundary_values.lua ./test_scripts/API/VehicleData/OnVehicleData/008_OnVD_enum_and_bool_values.lua +./test_scripts/API/VehicleData/OnVehicleData/009_OnVD_allowed_for_omitted_parameters_field.lua +./test_scripts/API/VehicleData/OnVehicleData/010_OnVD_allowed_and_disallowed_after_PTU.lua ./test_scripts/API/VehicleData/SubscribeVehicleData/001_SubscribeVD_Success.lua ./test_scripts/API/VehicleData/SubscribeVehicleData/002_SubscribeVD_disallowed.lua ./test_scripts/API/VehicleData/SubscribeVehicleData/003_SubscribeVD_disallowed_after_PTU.lua @@ -30,6 +33,7 @@ ./test_scripts/API/VehicleData/SubscribeVehicleData/012_SubscribeVD_Resumption_of_subscription_for_2_apps_Ignition_Cycle.lua ./test_scripts/API/VehicleData/SubscribeVehicleData/013_SubscribeVD_Resumption_of_subscription_for_2_apps_Unexpected_Disconnect_different_data.lua ./test_scripts/API/VehicleData/SubscribeVehicleData/014_SubscribeVD_Resumption_of_subscription_for_2_apps_Ignition_Cycle_different_data.lua +./test_scripts/API/VehicleData/SubscribeVehicleData/015_SubscribeVD_allowed_and_disallowed_after_PTU.lua ./test_scripts/API/VehicleData/UnsubscribeVehicleData/001_UnsubscribeVD_Success.lua ./test_scripts/API/VehicleData/UnsubscribeVehicleData/002_UnsubscribeVD_disallowed.lua ./test_scripts/API/VehicleData/UnsubscribeVehicleData/003_UnsubscribeVD_disallowed_after_PTU.lua @@ -41,3 +45,4 @@ ./test_scripts/API/VehicleData/UnsubscribeVehicleData/009_UnsubscribeVD_for_2_apps_different_data.lua ./test_scripts/API/VehicleData/UnsubscribeVehicleData/010_UnsubscribeVD_for_2_apps_Expected_Disconnect.lua ./test_scripts/API/VehicleData/UnsubscribeVehicleData/011_UnsubscribeVD_for_2_apps_Expected_Disconnect_different_data.lua +./test_scripts/API/VehicleData/UnsubscribeVehicleData/012_UnsubscribeVD_allowed_and_disallowed_after_PTU.lua diff --git a/test_sets/Defects/Defects_release_7_1.txt b/test_sets/Defects/Defects_release_7_1.txt index 707c5bfe2a..315b5f1404 100644 --- a/test_sets/Defects/Defects_release_7_1.txt +++ b/test_sets/Defects/Defects_release_7_1.txt @@ -1,10 +1,12 @@ ./test_scripts/Defects/7_1/1583_PerformInteraction_UNSUPPORTED_and_ABORTED_response_success.lua +./test_scripts/Defects/7_1/1585_AlertManeuver_UNSUPPORTED_RESOURCE_response_success.lua ./test_scripts/Defects/7_1/1596_1_VRPerformInteraction_UNSUPPORTED_RESOURCE_success.lua ./test_scripts/Defects/7_1/1596_2_UIPerformInteraction_UNSUPPORTED_RESOURCE_success.lua ./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 +./test_scripts/Defects/7_1/1619_AlertManeuer_empty_SoftButtons_missing_Info.lua ./test_scripts/Defects/7_1/1600_SetGlobalProperties_UNSUPPORTED_RESOURCE_response_success.lua ./test_scripts/Defects/7_1/2803_Resumption_of_HMI_level_of_2nd_app.lua ./test_scripts/Defects/7_1/3406_SetAppIcon_spec_chars_in_syncFileName.lua diff --git a/test_sets/Defects/Defects_release_8_0.txt b/test_sets/Defects/Defects_release_8_0.txt index eb3721801f..a1a70a8dbb 100644 --- a/test_sets/Defects/Defects_release_8_0.txt +++ b/test_sets/Defects/Defects_release_8_0.txt @@ -25,6 +25,7 @@ ./test_scripts/Defects/8_0/3226_SDL_crashes_if_HMI_sends_UI_OnTouchEvent_and_ts_has_value_greater_than_maxvalue.lua ./test_scripts/Defects/8_0/3541_Resumption_of_MenuLayout.lua ./test_scripts/Defects/8_0/3698_SDL_rejects_invalid_PTU.lua +./test_scripts/Defects/8_0/2957_Consent_func_group.lua ./test_scripts/Defects/8_0/2845/2845_1_SDL_does_not_ignore_accessMode_in_OnRemoteControlSettings_no_allowed_RC_disabled.lua ./test_scripts/Defects/8_0/2845/2845_2_SDL_does_not_ignore_accessMode_in_OnRemoteControlSettings_no_allowed_RC_enabled.lua ./test_scripts/Defects/8_0/2845/2845_3_SDL_does_not_ignore_accessMode_in_OnRemoteControlSettings_on_RC_disabling.lua @@ -34,3 +35,7 @@ ./test_scripts/Defects/8_0/3788_2_allow_RC_permission_for_App_after_PTU_with_REMOTE_CONTROL_appHMIType.lua ./test_scripts/Defects/8_0/3788_3_revoke_RC_permission_for_App_after_PTU_with_MEDIA_appHMIType.lua ./test_scripts/Defects/8_0/3797_3798_HMI_sends_SetAppProperties_and_tries_to_ActivateApp.lua +./test_scripts/Defects/8_0/3783_crash_during_vr_langchange.lua +./test_scripts/Defects/8_0/2810_1_unexpected_disconnect_during_audio_streaming.lua +./test_scripts/Defects/8_0/2810_2_unexpected_disconnect_during_video_streaming.lua +./test_scripts/Defects/8_0/2810_3_unexpected_disconnect_during_video_and_audio_streaming.lua diff --git a/test_sets/Defects/Defects_release_8_1.txt b/test_sets/Defects/Defects_release_8_1.txt new file mode 100644 index 0000000000..99104e86ef --- /dev/null +++ b/test_sets/Defects/Defects_release_8_1.txt @@ -0,0 +1,28 @@ +./test_scripts/Defects/8_1/980_SDL_responds_INVALID_DATA_in_case_soft_button_has_Type_Image_or_Both_and_Text_has_specific_string.lua +./test_scripts/Defects/8_1/994_SDL_sends_appName_in_vrSynonyms_and_ttsName_in_case_of_separated_structure_in_json_file.lua +./test_scripts/Defects/8_1/1883_1_PerformInteraction_REJECTED_for_being_deleted_InteractionChoceSet.lua +./test_scripts/Defects/8_1/1883_2_PerformInteraction_REJECTED_for_being_deleted_InteractionChoceSet_after_resumption.lua +./test_scripts/Defects/8_1/2989_RC_RPCs_and_disabled_policies.lua +./test_scripts/Defects/8_1/3346_Core_sends_redundant_UpdateAppList_and_UpdateDeviceList.lua +./test_scripts/Defects/8_1/3800_Send_GetSystemCapability_during_OnSystemCapabilityUpdated.lua +./test_scripts/Defects/8_1/3804_1_RAI_use_hmiCapabilities_from_cache_file.lua +./test_scripts/Defects/8_1/3804_2_RAI_use_hmiCapabilities_from_cache_file_with_different_value.lua +./test_scripts/Defects/8_1/3805_crash_during_langchange.lua +./test_scripts/Defects/8_1/994_SDL_sends_appName_in_vrSynonyms_and_ttsName_in_case_of_separated_structure_in_json_file.lua +./test_scripts/Defects/8_1/2448_Master_Reset_Removes_AppInfo_Dat.lua +./test_scripts/Defects/8_1/980_SDL_responds_INVALID_DATA_in_case_soft_button_has_Type_Image_or_Both_and_Text_has_specific_string.lua +./test_scripts/Defects/8_1/3831_SDL_calculates_playback_time_based_on_data_provided_by_HMI.lua +./test_scripts/Defects/8_1/3832_HMI_PTU_after_Ignition_cycle.lua +./test_scripts/Defects/8_1/3838/3838_1_SDL_does_not_send_UI.ClosePopUp_in_case_VR.PerformInteraction_TIME_OUT.lua +./test_scripts/Defects/8_1/3838/3838_2_SDL_does_not_send_UI.ClosePopUp_in_case_VR.PerformInteraction_SUCCESS.lua +./test_scripts/Defects/8_1/3838/3838_3_SDL_does_not_send_UI.ClosePopUp_in_case_two_PerformInteraction_requests.lua +./test_scripts/Defects/8_1/3838/3838_4_SDL_sends_UI.ClosePopUp_VR_ONLY_mode_in_case_VR.PerformInteraction_without_choiceID.lua +./test_scripts/Defects/8_1/3838/3838_5_SDL_does_not_send_UI.ClosePopUp_BOTH_mode_in_case_VR.PerformInteraction_without_choiceID.lua +./test_scripts/Defects/8_1/3845/3845_1_PerformAudioPassThru_custom_success_codes_to_ui.lua +./test_scripts/Defects/8_1/3845/3845_2_PerformAudioPassThru_custom_success_codes_to_tts.lua +./test_scripts/Defects/8_1/3845/3845_3_PerformAudioPassThru_custom_success_codes_to_tts_and_ui.lua +./test_scripts/Defects/8_1/3845/3845_4_PerformAudioPassThru_custom_success_codes_in_error_structure_to_ui.lua +./test_scripts/Defects/8_1/3845/3845_5_PerformAudioPassThru_custom_success_codes_in_error_structure_to_tts.lua +./test_scripts/Defects/8_1/3845/3845_6_PerformAudioPassThru_custom_success_codes_in_error_structure_to_tts_and_ui.lua +./test_scripts/Defects/8_1/3880_1_PTU_Empty_endpoint_properties.lua +./test_scripts/Defects/8_1/3880_2_PTU_Omitted_endpoint_properties.lua diff --git a/test_sets/Defects/Defects_releases_4_x_and_5_x.txt b/test_sets/Defects/Defects_releases_4_x_and_5_x.txt index 33af935424..bd8dd2f3a5 100644 --- a/test_sets/Defects/Defects_releases_4_x_and_5_x.txt +++ b/test_sets/Defects/Defects_releases_4_x_and_5_x.txt @@ -63,6 +63,7 @@ ./test_scripts/Defects/5_1/2862_SDL_sends_UnsubscribeWayPoint_request_to_HMI.lua ./test_scripts/Defects/5_1/2874_SDL_sends_system_request_with_correlationid_-1_and_INAVLID_DATA.lua ./test_scripts/Defects/5_1/1002_SDL_sends_StopAudioStream_in_case_User_Exit_during_Audio_Video_streaming.lua +./test_scripts/Defects/5_1/1393_ListFiles_from_enumerating_through_the_file_system.lua ;Streaming ./test_scripts/Defects/4_5/1912_Video_service_start_via_2_protocol.lua ./test_scripts/Defects/5_0/2479_SDL_does_not_respond_NACK_to_second_request/2479_1_SDL_does_not_respond_NACK_Navi_Type.lua @@ -75,6 +76,7 @@ ./test_scripts/Defects/4_5/1893_ATF_HeartBeat_App_does_not_send_HB_and_does_not_respond.lua ./test_scripts/Defects/4_5/1892_HB_from_SDL_after_receiving_HB_from_mobile.lua ;Remote Controol +./test_scripts/Defects/5_0/2664_SDL_cut_off_parameters_related_to_RADIO_from_request_SetInteriorVD_CLIMATE.lua ./test_scripts/Defects/5_0/2670_GetInteriorVD_after_ignition_off.lua ./test_scripts/Defects/5_0/2670_2_GetInteriorVD_after_ignition_off.lua ./test_scripts/Defects/5_0/2670_3_GetInteriorVD_after_ignition_off.lua diff --git a/test_sets/Deleted_from_CI.txt b/test_sets/Deleted_from_CI.txt index 3020df2e34..6bf9f064c8 100644 --- a/test_sets/Deleted_from_CI.txt +++ b/test_sets/Deleted_from_CI.txt @@ -45,7 +45,6 @@ policies_happy_paths_EXTERNAL_PROPRIETARY ./test_scripts/Polices/appID_Management/163_ATF_P_TC_HMI_Status_Value_Of_AppId_In_PT_Is_Null.lua APPLINK-31377 ./test_scripts/Polices/Validation_of_PolicyTables/233_ATF_preloaded_pt_requesttype_parameters_all_are_invalid.lua locally_PASS_Unstable_Due_to_specific_workaround_in_case_of_SDL_shutdown ./test_scripts/Polices/build_options/ATF_For_PTU_use_consented_device_only.lua APPLINK-31603 -./test_scripts/Polices/Validation_of_PolicyTables/292_ATF_P_Memory_Kb_Constraints_Ignoring.lua APPLINK-31600 ./test_scripts/Polices/Validation_of_PolicyTables/Check_count_of_removals_for_bad_behavior_REQUEST_WHILE_IN_NONE_HMI_LEVEL.lua APPLINK-31602 ./test_scripts/Polices/App_Permissions/174_ATF_HP_User_Consent_NO.lua APPLINK-31604 ./test_scripts/Polices/Validation_of_PolicyTables/224_ATF_preloaded_pt_invalid_required_param.lua Verifies_SDL_shut_down_ATF_aborts_script diff --git a/test_sets/policies_all_flows.txt b/test_sets/policies_all_flows.txt index bae21eb15e..9ec9fc44f3 100644 --- a/test_sets/policies_all_flows.txt +++ b/test_sets/policies_all_flows.txt @@ -402,7 +402,6 @@ ./test_scripts/Policies/Validation_of_PolicyTables/296_ATF_Validate_preDataConsent_and_stealFocus_true.lua ./test_scripts/Policies/Validation_of_PolicyTables/297_ATF_Validate_preDataConsent_and_keepContext_false.lua ./test_scripts/Policies/Validation_of_PolicyTables/298_ATF_Validate_preDataConsent_and_keepContext_true.lua -./test_scripts/Policies/Validation_of_PolicyTables/299_ATF_Memory_Kb_Constraints_Ignoring.lua ./test_scripts/Policies/Validation_of_PolicyTables/300_ATF_HP_Applying_Heart_Beat_Timeout_Ms_From_PT.lua ./test_scripts/Policies/Validation_of_PolicyTables/301_ATF_usage_and_error_counts_update_app_registration_language_vui.lua ./test_scripts/Policies/Validation_of_PolicyTables/302_ATF_HP_Applying_Heart_Beat_Timeout_Ms_After_PTU.lua @@ -417,3 +416,7 @@ ./test_scripts/Policies/Validation_of_PolicyTables/312_ATF_Check_count_of_removals_for_bad_behavior_too_many_requests.lua ./test_scripts/Policies/Validation_of_PolicyTables/313_ATF_Check_count_of_rpcs_sent_in_hmi_none.lua ./test_scripts/Policies/Validation_of_PolicyTables/314_ATF_Check_count_of_user_selections.lua +./test_scripts/Policies/Policy_Table_Update/173_PTU_when_not_UPDATING.lua +./test_scripts/Policies/Policy_Table_Update/174_PTU_from_wrong_app.lua +./test_scripts/Policies/Policy_Table_Update/176_PTU_is_performed_if_HMI_sends_BC_OnSystemRequest_with_url_parameter.lua +./test_scripts/Policies/Policy_Table_Update/177_PTU_is_performed_for_several_Apps_if_HMI_sends_BC_OnSystemRequest_with_url_parameter.lua diff --git a/test_sets/policies_happy_paths_EXTERNAL_PROPRIETARY.txt b/test_sets/policies_happy_paths_EXTERNAL_PROPRIETARY.txt index c05345ad18..9091248ce8 100644 --- a/test_sets/policies_happy_paths_EXTERNAL_PROPRIETARY.txt +++ b/test_sets/policies_happy_paths_EXTERNAL_PROPRIETARY.txt @@ -222,7 +222,6 @@ ./test_scripts/Policies/Validation_of_PolicyTables/296_ATF_Validate_preDataConsent_and_stealFocus_true.lua ./test_scripts/Policies/Validation_of_PolicyTables/297_ATF_Validate_preDataConsent_and_keepContext_false.lua ./test_scripts/Policies/Validation_of_PolicyTables/298_ATF_Validate_preDataConsent_and_keepContext_true.lua -./test_scripts/Policies/Validation_of_PolicyTables/299_ATF_Memory_Kb_Constraints_Ignoring.lua ./test_scripts/Policies/Validation_of_PolicyTables/300_ATF_HP_Applying_Heart_Beat_Timeout_Ms_From_PT.lua ./test_scripts/Policies/Validation_of_PolicyTables/301_ATF_usage_and_error_counts_update_app_registration_language_vui.lua ./test_scripts/Policies/Validation_of_PolicyTables/302_ATF_HP_Applying_Heart_Beat_Timeout_Ms_After_PTU.lua diff --git a/test_sets/policies_happy_paths_HTTP.txt b/test_sets/policies_happy_paths_HTTP.txt index 0701174f06..e57e016079 100644 --- a/test_sets/policies_happy_paths_HTTP.txt +++ b/test_sets/policies_happy_paths_HTTP.txt @@ -40,3 +40,4 @@ ./test_scripts/Policies/build_options/116_ATF_DEXTENDED_POLICY_OFF_HTTP.lua ./test_scripts/Policies/build_options/117_ATF_DEXTENDED_POLICY_No_Flag_HTTP.lua ./test_scripts/Policies/build_options/118_ATF_Request_PTU_Trigger_App_Excluded_PT_HTTP.lua +./test_scripts/Policies/Policy_Table_Update/175_PTU_from_wrong_app_HTTP.lua diff --git a/test_sets/security.txt b/test_sets/security.txt index 9608186036..b6e9643f11 100644 --- a/test_sets/security.txt +++ b/test_sets/security.txt @@ -33,6 +33,9 @@ ./test_scripts/Security/SecurityQueryErrorHandling/001_Invalid_query_size.lua ./test_scripts/Security/SecurityQueryErrorHandling/002_Invalid_query_id.lua ./test_scripts/Security/SecurityQueryErrorHandling/003_Service_not_protected.lua +./test_scripts/Security/SecurityQueryErrorHandling/004_SendInternalError_during_handshake_process.lua +./test_scripts/Security/SecurityQueryErrorHandling/005_Malformed_SendInternalError_during_handshake.lua +./test_scripts/Security/SecurityQueryErrorHandling/006_Invalid_SendInternalError_during_handshake.lua ./test_scripts/Security/SSLHandshakeFlow/001_Navi_Predefined_cert_valid_SUCCESS.lua ./test_scripts/Security/SSLHandshakeFlow/002_Navi_Predefined_cert_expired_PTU_cert_valid_SUCCESS.lua ./test_scripts/Security/SSLHandshakeFlow/003_Navi_Predefined_cert_expired_PTU_cert_missing_NACK.lua diff --git a/user_modules/hmi_values.lua b/user_modules/hmi_values.lua index 6614a41c7a..fe9c62e3db 100644 --- a/user_modules/hmi_values.lua +++ b/user_modules/hmi_values.lua @@ -369,8 +369,8 @@ function module.getDefaultHMITable() } }, pcmStreamCapabilities = { - samplingRate = "44KHZ", - bitsPerSample = "8_BIT", + samplingRate = "16KHZ", + bitsPerSample = "16_BIT", audioType = "PCM" }, hmiZoneCapabilities = "FRONT", diff --git a/user_modules/sequences/actions.lua b/user_modules/sequences/actions.lua index e056fe0dc4..d21e5305ee 100644 --- a/user_modules/sequences/actions.lua +++ b/user_modules/sequences/actions.lua @@ -115,7 +115,7 @@ end --! @parameters: none --! @return: PTU table --]] -local function getPTUFromPTS() +function m.getPTUFromPTS() local pTbl = m.sdl.getPTS() if pTbl == nil then utils.cprint(35, "PTS file was not found, PreloadedPT is used instead") @@ -624,7 +624,7 @@ function m.ptu.expectStart() if d3.payload.requestType == "HTTP" then utils.cprint(35, "App ".. appNum .. " will be used for PTU") ptuAppNum = appNum - if d3.binaryData ~= nil then + if d3.binaryData ~= nil and #d3.binaryData > 0 then pts = m.json.decode(d3.binaryData) end raisePtuEvent() @@ -644,7 +644,7 @@ local function policyTableUpdateProprietary(pPTUpdateFunc, pExpNotificationFunc) :Do(function() m.hmi.getConnection():SendNotification("BasicCommunication.OnSystemRequest", { requestType = "PROPRIETARY", fileName = m.sdl.getPTSFilePath() }) - local ptuTable = getPTUFromPTS() + local ptuTable = m.getPTUFromPTS() for i, _ in pairs(m.mobile.getApps()) do ptuTable.policy_table.app_policies[m.app.getPolicyAppId(i)] = m.ptu.getAppData(i) end @@ -680,7 +680,7 @@ end local function policyTableUpdateHttp(pPTUpdateFunc, pExpNotificationFunc) local ptuFileName = os.tmpname() - local ptuTable = getPTUFromPTS() + local ptuTable = m.getPTUFromPTS() for i, _ in pairs(m.mobile.getApps()) do ptuTable.policy_table.app_policies[m.app.getPolicyAppId(i)] = m.ptu.getAppData(i) end diff --git a/user_modules/shared_testcases/testCasesForPolicyTableSnapshot.lua b/user_modules/shared_testcases/testCasesForPolicyTableSnapshot.lua index 61840cc445..af6a064d8d 100644 --- a/user_modules/shared_testcases/testCasesForPolicyTableSnapshot.lua +++ b/user_modules/shared_testcases/testCasesForPolicyTableSnapshot.lua @@ -158,11 +158,9 @@ function testCasesForPolicyTableSnapshot:verify_PTS(is_created, app_IDs, device_ { name = "consumer_friendly_messages.version", elem_required = "required"}, { name = "app_policies.default.priority", elem_required = "required"}, - { name = "app_policies.default.memory_kb", elem_required = "optional"}, { name = "app_policies.default.heart_beat_timeout_ms", elem_required = "optional"}, { name = "app_policies.default.RequestType", elem_required = "optional"}, { name = "app_policies.pre_DataConsent.priority", elem_required = "required"}, - { name = "app_policies.pre_DataConsent.memory_kb", elem_required = "optional"}, { name = "app_policies.pre_DataConsent.heart_beat_timeout_ms", elem_required = "optional"}, { name = "app_policies.pre_DataConsent.RequestType", elem_required = "optional"}, -- RC @@ -187,7 +185,6 @@ function testCasesForPolicyTableSnapshot:verify_PTS(is_created, app_IDs, device_ { name = "app_policies.default.groups_primaryRC.2", elem_required = "optional"}, { name = "app_policies.default.moduleType.1", elem_required = "optional"}, { name = "app_policies.default.moduleType.2", elem_required = "optional"}, - { name = "app_policies.pre_consent_passengersRC.memory_kb", elem_required = "optional"}, { name = "app_policies.pre_consent_passengersRC.heart_beat_timeout_ms", elem_required = "optional"}, { name = "app_policies.pre_consent_passengersRC.RequestType", elem_required = "optional"}, { name = "app_policies.pre_consent_passengersRC.certificate", elem_required = "optional"}, @@ -414,7 +411,6 @@ function testCasesForPolicyTableSnapshot:verify_PTS(is_created, app_IDs, device_ --TODO(istoimenova): should be updated in future, due to luck of time data_dictionary[#data_dictionary + 1] = { name = "usage_and_error_counts.app_level."..tostring(app_IDs[i])..".AppHMIType", value = nil, elem_required = "optional" } - data_dictionary[#data_dictionary + 1] = { name = "usage_and_error_counts.app_level."..tostring(app_IDs[i])..".memory_kb", value = nil, elem_required = "optional" } data_dictionary[#data_dictionary + 1] = { name = "usage_and_error_counts.app_level."..tostring(app_IDs[i])..".heart_beat_timeout_ms", value = nil, elem_required = "optional" } data_dictionary[#data_dictionary + 1] = { name = "usage_and_error_counts.app_level."..tostring(app_IDs[i])..".RequestType", value = nil, elem_required = "optional" } data_dictionary[#data_dictionary + 1] = { name = "app_policies."..tostring(app_IDs[i]), value = nil, elem_required = "optional" } @@ -424,7 +420,6 @@ function testCasesForPolicyTableSnapshot:verify_PTS(is_created, app_IDs, device_ -- data_dictionary[#data_dictionary + 1] = { name = "app_policies."..tostring(app_IDs[i])..".priority", value = nil, elem_required = "required" } -- data_dictionary[#data_dictionary + 1 + 19] = { name = "app_policies."..tostring(app_IDs[i])..".groups", value = nil, elem_required = "required" } data_dictionary[#data_dictionary + 1] = { name = "app_policies."..tostring(app_IDs[i])..".AppHMIType", value = nil, elem_required = "optional" } - data_dictionary[#data_dictionary + 1] = { name = "app_policies."..tostring(app_IDs[i])..".memory_kb", value = nil, elem_required = "optional" } data_dictionary[#data_dictionary + 1] = { name = "app_policies."..tostring(app_IDs[i])..".heart_beat_timeout_ms", value = nil, elem_required = "optional" } data_dictionary[#data_dictionary + 1] = { name = "app_policies."..tostring(app_IDs[i])..".RequestType", value = nil, elem_required = "optional" } data_dictionary[#data_dictionary + 1] = { name = "app_policies."..tostring(app_IDs[i]), value = nil, elem_required = "optional" } diff --git a/user_modules/utils.lua b/user_modules/utils.lua index 14e78e5e16..7f36223792 100644 --- a/user_modules/utils.lua +++ b/user_modules/utils.lua @@ -300,7 +300,10 @@ function m.spairs(pTbl) for k in pairs(pTbl) do keys[#keys+1] = k end - table.sort(keys, function(a, b) return tostring(a) < tostring(b) end) + table.sort(keys, function(a, b) + if type(a) == "number" and type(b) == "number" then return a < b end + return tostring(a) < tostring(b) + end) local i = 0 return function() i = i + 1