diff --git a/test_scripts/Defects/8_2/3906/001_PTU_via_PutFile_during_start_PTU.lua b/test_scripts/Defects/8_2/3906/001_PTU_via_PutFile_during_start_PTU.lua new file mode 100644 index 0000000000..856ee2c50c --- /dev/null +++ b/test_scripts/Defects/8_2/3906/001_PTU_via_PutFile_during_start_PTU.lua @@ -0,0 +1,38 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/SmartDeviceLink/sdl_core/issues/3906 +--------------------------------------------------------------------------------------------------- +-- Description: SDL does not apply PTU provided via PutFile from mobile app during start PTU +-- +-- Preconditions: +-- 1. SDL and HMI are started +-- 2. Mobile app is registered and activated +-- SDL does: +-- - start PTU and sends SDL.OnStatusUpdate(UPDATE_NEEDED, UPDATING) to HMI +-- Steps: +-- 1. App sends PutFile request with updated policy table includes "HapticGroup" functional group +-- SDL does: +-- - not send SDL.OnStatusUpdate notification to HMI +-- - not send SDL.OnPermissionsChange notification to HMI +-- - not send SDL.OnAppPermissionChanged notification to HMI +-- - send BasicCommunication.OnPutFile notification to HMI +-- - respond PutFile(success = true, resultCode = "SUCCESS") to app +-- 2. App sends SendHapticData request +-- SDL does: +-- - respond SendHapticData(success = false, resultCode = "DISALLOWED") to app +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local common = require("test_scripts/Defects/8_2/3906/common_3906") + +--[[ 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.Title("Test") +common.Step("App sends PutFile with updated policy table", common.putFile, { common.ptuFuncHapticGroup }) +common.Step("App sends SendHapticData DISALLOWED", common.sendHapticDataDisallowed) + +common.Title("Postconditions") +common.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/Defects/8_2/3906/002_PTU_via_PutFile_during_PTU_sequence.lua b/test_scripts/Defects/8_2/3906/002_PTU_via_PutFile_during_PTU_sequence.lua new file mode 100644 index 0000000000..c04c5b9417 --- /dev/null +++ b/test_scripts/Defects/8_2/3906/002_PTU_via_PutFile_during_PTU_sequence.lua @@ -0,0 +1,58 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/SmartDeviceLink/sdl_core/issues/3906 +--------------------------------------------------------------------------------------------------- +-- Description: SDL does not apply PTU provided via PutFile from mobile app during PTU sequence +-- +-- Preconditions: +-- 1. SDL and HMI are started +-- 2. Mobile app is registered and activated +-- SDL does: +-- - start PTU and sends SDL.OnStatusUpdate(UPDATE_NEEDED, UPDATING) to HMI +-- 3. SDL sends OnSystemRequest(PROPRIETARY) request to App +-- Steps: +-- 1. App sends PutFile request with updated policy table includes "HapticGroup" functional group +-- SDL does: +-- - not send SDL.OnStatusUpdate notification to HMI +-- - not send SDL.OnPermissionsChange notification to HMI +-- - not send SDL.OnAppPermissionChanged notification to HMI +-- - send BasicCommunication.OnPutFile notification to HMI +-- - respond PutFile(success = true, resultCode = "SUCCESS") to app +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local common = require("test_scripts/Defects/8_2/3906/common_3906") + +--[[ Test Configuration ]] +common.testSettings.restrictions.sdlBuildOptions = {{ extendedPolicy = { "PROPRIETARY", "EXTERNAL_PROPRIETARY" }}} + +--[[ Local Functions ]] +local function policyTableUpdateProprietary(pPTUpdateFunc) + local requestId = common.getHMIConnection():SendRequest("SDL.GetPolicyConfigurationData", + { policyType = "module_config", property = "endpoints" }) + common.getHMIConnection():ExpectResponse(requestId) + :Do(function() + common.getHMIConnection():SendNotification("BasicCommunication.OnSystemRequest", + { requestType = "PROPRIETARY", fileName = common.getPTSFilePath() }) + local event = common.createEvent() + common.getHMIConnection():ExpectEvent(event, "PTU event") + common.getMobileSession():ExpectNotification("OnSystemRequest", { requestType = "PROPRIETARY" }) + :Do(function() + common.putFile(pPTUpdateFunc) + common.getHMIConnection():RaiseEvent(event, "PTU event") + end) + :Times(AtMost(1)) + end) +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.Title("Test") +common.Step("App sends PutFile with updated policy table", policyTableUpdateProprietary, { common.ptuFuncHapticGroup }) +common.Step("App sends SendHapticData DISALLOWED", common.sendHapticDataDisallowed) + +common.Title("Postconditions") +common.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/Defects/8_2/3906/003_PTU_via_PutFile.lua b/test_scripts/Defects/8_2/3906/003_PTU_via_PutFile.lua new file mode 100644 index 0000000000..201bb8fea3 --- /dev/null +++ b/test_scripts/Defects/8_2/3906/003_PTU_via_PutFile.lua @@ -0,0 +1,52 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/SmartDeviceLink/sdl_core/issues/3906 +--------------------------------------------------------------------------------------------------- +-- Description: SDL does not apply PTU provided via PutFile from mobile app +-- +-- Preconditions: +-- 1. SDL and HMI are started +-- 2. Mobile app is registered and activated +-- 3. PTU is performed with "HapticGroup" group +-- Steps: +-- 1. App sends PutFile request with updated policy table without "HapticGroup" functional group +-- SDL does: +-- - not send SDL.OnStatusUpdate notification to HMI +-- - not send SDL.OnPermissionsChange notification to HMI +-- - not send SDL.OnAppPermissionChanged notification to HMI +-- - send BasicCommunication.OnPutFile notification to HMI +-- - respond with PutFile(success = true, resultCode = "SUCCESS") to app +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local common = require("test_scripts/Defects/8_2/3906/common_3906") + +--[[ Local Functions ]] +local function ptuFunc(tbl) + tbl.policy_table.app_policies[common.getParams().fullAppID].groups = { "Base-4" } +end + +local function sendHapticData() + local hapticDataParam = { hapticRectData = {{ id = 1, rect = { x = 1, y = 1.5, width = 1, height = 1.5 }}}} + local cid = common.getMobileSession():SendRPC("SendHapticData", hapticDataParam) + hapticDataParam.appID = common.getHMIAppId() + common.getHMIConnection():ExpectRequest("UI.SendHapticData", hapticDataParam) + :Do(function(_, data) + common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS") + end) + common.getMobileSession():ExpectResponse(cid, { success = true, resultCode = "SUCCESS" }) +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("Policy Table Update", common.policyTableUpdate, { common.ptuFuncHapticGroup }) +common.Step("App sends SendHapticData SUCCESS", sendHapticData) + +common.Title("Test") +common.Step("App sends PutFile with updated policy table", common.putFile, { ptuFunc }) +common.Step("App sends SendHapticData SUCCESS", sendHapticData) + +common.Title("Postconditions") +common.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/Defects/8_2/3906/004_PTU_via_PutFile_with_diferent_params_during_start_PTU.lua b/test_scripts/Defects/8_2/3906/004_PTU_via_PutFile_with_diferent_params_during_start_PTU.lua new file mode 100644 index 0000000000..68c40568f0 --- /dev/null +++ b/test_scripts/Defects/8_2/3906/004_PTU_via_PutFile_with_diferent_params_during_start_PTU.lua @@ -0,0 +1,55 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/SmartDeviceLink/sdl_core/issues/3906 +--------------------------------------------------------------------------------------------------- +-- Description: +-- SDL does not apply PTU provided via PutFile with different from mobile app during start PTU +-- +-- Preconditions: +-- 1. SDL and HMI are started +-- 2. Mobile app is registered and activated +-- SDL does: +-- - start PTU and sends SDL.OnStatusUpdate(UPDATE_NEEDED, UPDATING) to HMI +-- Steps: +-- 1. App sends PutFile request with updated policy table includes "HapticGroup" functional group and : +-- - only mandatory parameters +-- - persistentFile = true; +-- - systemFile = true; +-- - persistentFile = true, systemFile = true; +-- SDL does: +-- - not send SDL.OnStatusUpdate notification to HMI +-- - not send SDL.OnPermissionsChange notification to HMI +-- - not send SDL.OnAppPermissionChanged notification to HMI +-- - send BasicCommunication.OnPutFile notification to HMI +-- - respond PutFile(success = true, resultCode = "SUCCESS") to app +-- 2. App sends SendHapticData request +-- SDL does: +-- - respond SendHapticData(success = false, resultCode = "DISALLOWED") to app +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local common = require("test_scripts/Defects/8_2/3906/common_3906") + +--[[ Local Variables ]] +local putFileParams = { + [1] = { syncFileName = 'ptu.json', fileType = "JSON" }, + [2] = { syncFileName = 'ptu.json', fileType = "JSON", persistentFile = true }, + [3] = { syncFileName = 'ptu.json', fileType = "JSON", systemFile = true }, + [4] = { syncFileName = 'ptu.json', fileType = "JSON", persistentFile = true, systemFile = true } +} + +--[[ Scenario ]] +for tc, params in ipairs(putFileParams) do + common.Title("Test case [" .. string.format("%02d", tc) .. "]") + 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.Title("Test") + common.Step("App sends PutFile with updated policy table", common.putFile, { common.ptuFuncHapticGroup, params }) + common.Step("App sends SendHapticData DISALLOWED", common.sendHapticDataDisallowed) + + common.Title("Postconditions") + common.Step("Clean sessions", common.cleanSessions) + common.Step("Stop SDL", common.postconditions) +end diff --git a/test_scripts/Defects/8_2/3906/common_3906.lua b/test_scripts/Defects/8_2/3906/common_3906.lua new file mode 100644 index 0000000000..cd64072965 --- /dev/null +++ b/test_scripts/Defects/8_2/3906/common_3906.lua @@ -0,0 +1,67 @@ +--------------------------------------------------------------------------------------------------- +-- Common module for tests of https://github.com/SmartDeviceLink/sdl_core/issues/3906 issue +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local actions = require("user_modules/sequences/actions") +local utils = require('user_modules/utils') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Module ]] +local m = { } + +--[[ Proxy Functions ]] +m.testSettings = runner.testSettings +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.policyTableUpdate = actions.policyTableUpdate +m.getParams = actions.app.getParams +m.getPTSFilePath = actions.sdl.getPTSFilePath +m.createEvent = actions.run.createEvent +m.getHMIAppId = actions.getHMIAppId +m.cleanSessions = actions.mobile.closeSession +m.tableToJsonFile = utils.tableToJsonFile + +--[[ Common Functions ]] +function m.ptuFuncHapticGroup(tbl) + tbl.policy_table.app_policies[actions.app.getParams().fullAppID].groups = { "Base-4", "HapticGroup" } +end + +function m.sendHapticDataDisallowed() + local hapticDataParam = { hapticRectData = {{ id = 1, rect = { x = 1, y = 1.5, width = 1, height = 1.5 }}}} + local cid = m.getMobileSession():SendRPC("SendHapticData", hapticDataParam) + m.getHMIConnection():ExpectRequest("UI.SendHapticData") + :Times(0) + m.getMobileSession():ExpectResponse(cid, { success = false, resultCode = "DISALLOWED" }) +end + +function m.putFile(pPTUpdateFunc, pParams) + local putFileParams = { syncFileName = 'ptu.json', fileType = "JSON" } + if not pParams then pParams = putFileParams end + local ptuFileName = os.tmpname() + local ptuTable = actions.getPTUFromPTS() + ptuTable.policy_table.app_policies[actions.app.getPolicyAppId()] = actions.ptu.getAppData() + if pPTUpdateFunc then + pPTUpdateFunc(ptuTable) + end + utils.tableToJsonFile(ptuTable, ptuFileName) + m.getHMIConnection():ExpectRequest("VehicleInfo.GetVehicleData"):Times(0) + m.getHMIConnection():ExpectNotification("SDL.OnStatusUpdate"):Times(0) + m.getMobileSession():ExpectNotification("OnPermissionsChange"):Times(0) + m.getMobileSession():ExpectNotification("SDL.OnAppPermissionChanged"):Times(0) + local cid = m.getMobileSession():SendRPC("PutFile", pParams, ptuFileName) + m.getHMIConnection():ExpectNotification("BasicCommunication.OnPutFile") + m.getMobileSession():ExpectResponse(cid, { success = true, resultCode = "SUCCESS" }) + :Do(function() os.remove(ptuFileName) end) +end + +return m diff --git a/test_sets/Defects/Defects_release_8_2.txt b/test_sets/Defects/Defects_release_8_2.txt index 6cf3286444..be37253020 100644 --- a/test_sets/Defects/Defects_release_8_2.txt +++ b/test_sets/Defects/Defects_release_8_2.txt @@ -1 +1,5 @@ -./test_scripts/Defects/8_2/3912_PTS_With_WSS_App_Content_Length.lua \ No newline at end of file +./test_scripts/Defects/8_2/3906/001_PTU_via_PutFile_during_start_PTU.lua +./test_scripts/Defects/8_2/3906/002_PTU_via_PutFile_during_PTU_sequence.lua +./test_scripts/Defects/8_2/3906/003_PTU_via_PutFile.lua +./test_scripts/Defects/8_2/3906/004_PTU_via_PutFile_with_diferent_params_during_start_PTU.lua +./test_scripts/Defects/8_2/3912_PTS_With_WSS_App_Content_Length.lua