diff --git a/test_scripts/Defects/4_5/1880/1880_1_DefaultAndRPCTimeoutGENERIC_ERROR.lua b/test_scripts/Defects/4_5/1880/1880_1_DefaultAndRPCTimeoutGENERIC_ERROR.lua new file mode 100644 index 0000000000..e72da1228a --- /dev/null +++ b/test_scripts/Defects/4_5/1880/1880_1_DefaultAndRPCTimeoutGENERIC_ERROR.lua @@ -0,0 +1,109 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/smartDeviceLink/sdl_core/issues/1880 +--------------------------------------------------------------------------------------------------- +-- In case +-- SDL transfers *RPC with own timeout from mobile app to HMI (please see list with impacted *RPCs below) +-- and HMI does NOT respond during + <*RPCs_own_timeout> (please see APPLINK-27495) +-- SDL must: +-- respond 'GENERIC_ERROR, success:false' to mobile app +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require("test_scripts/Defects/4_5/1880/common") + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local imageName = "icon.png" + +local AlertRequestParams = { + alertText1 = "alertText1", + duration = 7000 +} +local AlertRequestParamsWithoutDuration = { + alertText1 = "alertText1", + ttsChunks = { + { + text = "TTSChunk", + type = "TEXT", + } + }, +} + +local SliderRequetsParams = { + numTicks = 3, + position = 2, + sliderHeader ="sliderHeader", + sliderFooter = {"1", "2", "3"}, + timeout = 7000 +} +local SliderRequetsParamsWithoutTimeout = { + numTicks = 3, + position = 2, + sliderHeader ="sliderHeader", + sliderFooter = {"1", "2", "3"}, +} + +local ScrollableMessageRequestParamsWithSoftButtons = { + scrollableMessageBody = "abc", + softButtons = { + { + softButtonID = 1, + text = "Button1", + type = "IMAGE", + image = + { + value = imageName, + imageType = "DYNAMIC" + }, + isHighlighted = false, + systemAction = "DEFAULT_ACTION" + }, + { + softButtonID = 2, + text = "Button2", + type = "IMAGE", + image = + { + value = imageName, + imageType = "DYNAMIC" + }, + isHighlighted = false, + systemAction = "DEFAULT_ACTION" + } + }, + timeout = 7000 +} +local ScrollableMessageRequestParamsWithoutSoftButtons = { + scrollableMessageBody = "abc", + timeout = 3000 +} +local ScrollableMessageRequestParamsWithoutTimeout = { + scrollableMessageBody = "abc", +} + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerNoPTU) +runner.Step("Activate App", common.activate) +runner.Step("Upload file", common.putFile, { imageName }) + +runner.Title("Test") +runner.Step("Alert_default_timeout_and_Alert_timeout", common.alert, { AlertRequestParams }) +runner.Step("Alert_default_timeout", common.alert, { AlertRequestParamsWithoutDuration }) + +runner.Step("Slider_default_timeout_and_Slider_timeout", common.slider, { SliderRequetsParams }) +runner.Step("Slider_default_timeout", common.slider, { SliderRequetsParamsWithoutTimeout }) + +runner.Step("ScrollableMessage_default_timeout_and_ScrMes_timeout_with_softButtons", common.scrollableMessage, + { ScrollableMessageRequestParamsWithSoftButtons }) +runner.Step("ScrollableMessage_default_timeout_and_ScrMes_timeout_without_softButtons", common.scrollableMessage, + { ScrollableMessageRequestParamsWithoutSoftButtons }) +runner.Step("ScrollableMessage_default_timeout", common.scrollableMessage, + { ScrollableMessageRequestParamsWithoutTimeout }) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/Defects/4_5/1880/1880_2_PerformInteraction_BOTH_DefaultAndRPCTimeoutGENERIC_ERROR.lua b/test_scripts/Defects/4_5/1880/1880_2_PerformInteraction_BOTH_DefaultAndRPCTimeoutGENERIC_ERROR.lua new file mode 100644 index 0000000000..d7af5d7e83 --- /dev/null +++ b/test_scripts/Defects/4_5/1880/1880_2_PerformInteraction_BOTH_DefaultAndRPCTimeoutGENERIC_ERROR.lua @@ -0,0 +1,66 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/smartDeviceLink/sdl_core/issues/1880 +--------------------------------------------------------------------------------------------------- +-- Description: In case SDL transfers PerformInteraction(BOTH) with own timeout from mobile app to HMI +-- and HMI does NOT respond during + <*RPCs_own_timeout> +-- SDL must respond 'GENERIC_ERROR, success:false' to mobile app +-- +-- Steps: +-- 1. HMI and SDL are started +-- 2. Mobile app is registered and activated +-- 3. CreateInteractionChoiceSet is added +-- 4. Mobile app requests PerformInteraction(BOTH) +-- SDL does: +-- - request VR.PerformInteraction and UI.PerformInteraction to HMI +-- - start timeout + <*RPCs_own_timeout> for expecting VR response +-- 5. HMI does not respond to UI and VR requests during + <*RPCs_own_timeout> +-- SDL does: +-- - respond 'GENERIC_ERROR, success:false' to mobile app after + <*RPCs_own_timeout> is expired +-- 6. Mobile app requests PerformInteraction(BOTH) +-- SDL does: +-- - request VR.PerformInteraction and UI.PerformInteraction to HMI +-- - start timeout + <*RPCs_own_timeout> for expecting VR response +-- 7. HMI responds to VR request in 2 seconds +-- SDL does: +-- - start timeout + <*RPCs_own_timeout> for expecting UI response +-- 8. HMI does not respond to UI request during + <*RPCs_own_timeout> +-- SDL does: +-- - respond 'GENERIC_ERROR, success:false' to mobile app after expiration of + <*RPCs_own_timeout> +-- started after VR response receiving +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require("user_modules/script_runner") +local common = require("test_scripts/Defects/4_5/1880/common") + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local params_with_timeout = { + interactionMode = "BOTH", + timeout = 7000 +} +local params_without_timeout = { + interactionMode = "BOTH" +} + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerNoPTU) +runner.Step("Activate App", common.activate) +runner.Step("CreateInteractionChoiceSet", common.createInteractionChoiceSet) + +runner.Title("Test") +runner.Step("PerformInteraction_default_timeout_and_PI_timeout", common.performInteraction, + { params_with_timeout, common.notSendUIresp, common.notSendVRresp, common.noAdditionalTimeout }) +runner.Step("PerformInteraction_default_timeout_and_PI_timeout_with_VR_response", common.performInteraction, + { params_without_timeout, common.notSendUIresp, common.sendVRresp, common.timeToSendResp }) +runner.Step("PerformInteraction_default_timeout_and_PI_default_timeout", common.performInteraction, + { params_with_timeout, common.notSendUIresp, common.notSendVRresp, common.noAdditionalTimeout }) +runner.Step("PerformInteraction_default_timeout_and_PI_default_timeout_with_VR_response", common.performInteraction, + { params_without_timeout, common.notSendUIresp, common.sendVRresp, common.timeToSendResp }) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/Defects/4_5/1880/1880_3_PerformInteraction_VR_ONLY_DefaultAndRPCTimeoutGENERIC_ERROR.lua b/test_scripts/Defects/4_5/1880/1880_3_PerformInteraction_VR_ONLY_DefaultAndRPCTimeoutGENERIC_ERROR.lua new file mode 100644 index 0000000000..b8571ee0b4 --- /dev/null +++ b/test_scripts/Defects/4_5/1880/1880_3_PerformInteraction_VR_ONLY_DefaultAndRPCTimeoutGENERIC_ERROR.lua @@ -0,0 +1,63 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/smartDeviceLink/sdl_core/issues/1880 +--------------------------------------------------------------------------------------------------- +-- Description: In case SDL transfers PerformInteraction(VR_ONLY) with own timeout from mobile app to HMI +-- and HMI does NOT respond during + <*RPCs_own_timeout> +-- SDL must respond 'GENERIC_ERROR, success:false' to mobile app +-- +-- Steps: +-- 1. HMI and SDL are started +-- 2. Mobile app is registered and activated +-- 3. CreateInteractionChoiceSet is added +-- 4. Mobile app requests PerformInteraction(VR_ONLY) +-- SDL does: +-- - request VR.PerformInteraction and UI.PerformInteraction to HMI +-- - start timeout + <*RPCs_own_timeout> for expecting VR response +-- 5. HMI does not respond to UI and VR requests during + <*RPCs_own_timeout> +-- SDL does: +-- - respond 'GENERIC_ERROR, success:false' to mobile app after + <*RPCs_own_timeout> is expired +-- 6. Mobile app requests PerformInteraction(VR_ONLY) +-- SDL does: +-- - request VR.PerformInteraction and UI.PerformInteraction to HMI +-- - start timeout + <*RPCs_own_timeout> for expecting VR response +-- 7. HMI responds to UI request in 2 seconds +-- 8. HMI does not respond to VR request during + <*RPCs_own_timeout> +-- SDL does: +-- - respond 'GENERIC_ERROR, success:false' to mobile app after + <*RPCs_own_timeout> is expired +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require("user_modules/script_runner") +local common = require("test_scripts/Defects/4_5/1880/common") + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local params_with_timeout = { + interactionMode = "VR_ONLY", + timeout = 12000 +} +local params_without_timeout = { + interactionMode = "VR_ONLY" +} + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerNoPTU) +runner.Step("Activate App", common.activate) +runner.Step("CreateInteractionChoiceSet", common.createInteractionChoiceSet) + +runner.Title("Test") +runner.Step("PerformInteraction_timeout_VR", common.performInteraction, + { params_with_timeout, common.notSendUIresp, common.notSendVRresp, common.noAdditionalTimeout }) +runner.Step("PerformInteraction_default_timeout_VR", common.performInteraction, + { params_without_timeout, common.notSendUIresp, common.notSendVRresp, common.noAdditionalTimeout }) +runner.Step("PerformInteraction_timeout_VR_with_UI_response", common.performInteraction, + { params_with_timeout, common.sendUIresp, common.notSendVRresp, common.noAdditionalTimeout }) +runner.Step("PerformInteraction_default_timeout_VR_with_UI_response", common.performInteraction, + { params_without_timeout, common.sendUIresp, common.notSendVRresp, common.noAdditionalTimeout }) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/Defects/4_5/1880/1880_4_PerformInteraction_MANUAL_ONLY_DefaultAndRPCTimeoutGENERIC_ERROR.lua b/test_scripts/Defects/4_5/1880/1880_4_PerformInteraction_MANUAL_ONLY_DefaultAndRPCTimeoutGENERIC_ERROR.lua new file mode 100644 index 0000000000..ca1596eba7 --- /dev/null +++ b/test_scripts/Defects/4_5/1880/1880_4_PerformInteraction_MANUAL_ONLY_DefaultAndRPCTimeoutGENERIC_ERROR.lua @@ -0,0 +1,63 @@ +--------------------------------------------------------------------------------------------------- +-- Issue: https://github.com/smartDeviceLink/sdl_core/issues/1880 +--------------------------------------------------------------------------------------------------- +-- Description: In case SDL transfers PerformInteraction(MANUAL_ONLY) with own timeout from mobile app to HMI +-- and HMI does NOT respond during + <*RPCs_own_timeout> +-- SDL must respond 'GENERIC_ERROR, success:false' to mobile app +-- +-- Steps: +-- 1. HMI and SDL are started +-- 2. Mobile app is registered and activated +-- 3. CreateInteractionChoiceSet is added +-- 4. Mobile app requests PerformInteraction(MANUAL_ONLY) +-- SDL does: +-- - request VR.PerformInteraction and UI.PerformInteraction to HMI +-- - start timeout + <*RPCs_own_timeout> for expecting UI response +-- 5. HMI does not respond to UI and VR requests during + <*RPCs_own_timeout> +-- SDL does: +-- - respond 'GENERIC_ERROR, success:false' to mobile app after + <*RPCs_own_timeout> is expired +-- 6. Mobile app requests PerformInteraction(MANUAL_ONLY) +-- SDL does: +-- - request VR.PerformInteraction and UI.PerformInteraction to HMI +-- - start timeout + <*RPCs_own_timeout> for expecting UI response +-- 7. HMI responds to VR request in 2 seconds +-- 8. HMI does not respond to UI request during + <*RPCs_own_timeout> +-- SDL does: +-- - respond 'GENERIC_ERROR, success:false' to mobile app after + <*RPCs_own_timeout> is expired +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require("user_modules/script_runner") +local common = require("test_scripts/Defects/4_5/1880/common") + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local params_with_timeout = { + interactionMode = "MANUAL_ONLY", + timeout = 8000 +} +local params_without_timeout = { + interactionMode = "MANUAL_ONLY" +} + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerNoPTU) +runner.Step("Activate App", common.activate) +runner.Step("CreateInteractionChoiceSet", common.createInteractionChoiceSet) + +runner.Title("Test") +runner.Step("PerformInteraction_default_timeout_and_PI_timeout_with_VR_response", common.performInteraction, + { params_with_timeout, common.notSendUIresp, common.sendVRresp, common.noAdditionalTimeout }) +runner.Step("PerformInteraction_default_timeout_and_PI_default_timeout_with_VR_response", common.performInteraction, + { params_without_timeout, common.notSendUIresp, common.sendVRresp, common.noAdditionalTimeout }) +runner.Step("PerformInteraction_default_timeout_and_PI_timeout", common.performInteraction, + { params_with_timeout, common.notSendUIresp, common.notSendVRresp, common.noAdditionalTimeout }) +runner.Step("PerformInteraction_default_timeout_and_PI_default_timeout", common.performInteraction, + { params_without_timeout, common.notSendUIresp, common.notSendVRresp, common.noAdditionalTimeout }) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/Defects/4_5/1880/common.lua b/test_scripts/Defects/4_5/1880/common.lua new file mode 100644 index 0000000000..1a4cabbb8f --- /dev/null +++ b/test_scripts/Defects/4_5/1880/common.lua @@ -0,0 +1,249 @@ +--------------------------------------------------------------------------------------------------- +-- Common module +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local actions = require("user_modules/sequences/actions") +local apiLoader = require("modules/api_loader") +local api = apiLoader.init("data/MOBILE_API.xml") +local schema = api.interface[next(api.interface)] + +--[[ Module ]] +local m = {} + +--[[ Proxy Functions ]] +m.preconditions = actions.preconditions +m.start = actions.start +m.registerNoPTU = actions.app.registerNoPTU +m.activate = actions.app.activate +m.postconditions = actions.postconditions + +--[[ Local Variables ]] +local DefaultTimeout = actions.sdl.getSDLIniParameter("DefaultTimeout") +local DefaultTimeoutCompensation = actions.sdl.getSDLIniParameter("DefaultTimeoutCompensation") +local GeneralTimeout = DefaultTimeout + DefaultTimeoutCompensation +local respTimeoutCompensation = 3000 +local calcAccuracy = 1000 + +--[[ Common Variables ]] +m.timeToSendResp = 2000 +m.sendUIresp = true +m.sendVRresp = true +m.notSendUIresp = false +m.notSsendVRresp = false +m.noAdditionalTimeout = 0 + +--[[ Local Functions ]] +local function getDefaultValueFromAPI(pFunctionName, pParamName) + local defvalue = schema.type["request"].functions[pFunctionName].param[pParamName].defvalue + if not defvalue then + print("Default value was not found in API for function '" .. pFunctionName + .. "' and parameter '" .. pParamName .. "'") + defvalue = 0 + end + print("Default value: " .. defvalue) + return defvalue +end + +--[[ Common Functions ]] +function m.putFile(pFileName) + local cid = actions.mobile.getSession():SendRPC( + "PutFile", + {syncFileName = pFileName, fileType = "GRAPHIC_PNG", persistentFile = false, systemFile = false}, + "files/icon.png") + + actions.mobile.getSession():ExpectResponse(cid, { success = true, resultCode = "SUCCESS"}) +end + +function m.alert(params) + local AlertDuration + if params.duration then + AlertDuration = params.duration + else + AlertDuration = getDefaultValueFromAPI("Alert", "duration") + end + local RespTimeout = GeneralTimeout + AlertDuration + local RequestTime + local RespTime + local TimeBetweenReqRes + + if params.ttsChunks then + actions.hmi.getConnection():ExpectRequest("TTS.Speak") + :Do(function(_,data) + local function SpeakResp() + actions.hmi.getConnection():SendResponse(data.id, data.method, "SUCCESS", {}) + end + RUN_AFTER(SpeakResp, m.timeToSendResp) + end) + end + + local cid = actions.mobile.getSession():SendRPC("Alert", params) + RequestTime = timestamp() + + actions.hmi.getConnection():ExpectRequest("UI.Alert") + + actions.mobile.getSession():ExpectResponse(cid, { success = false, resultCode = "GENERIC_ERROR" }) + :Timeout(RespTimeout + respTimeoutCompensation) + :ValidIf(function() + RespTime = timestamp() + TimeBetweenReqRes = RespTime - RequestTime + if TimeBetweenReqRes > RespTimeout - calcAccuracy and TimeBetweenReqRes < RespTimeout + calcAccuracy then + return true + else + return false, "SDL triggers timeout earlier then expected(" + .. tostring(RespTimeout) .." sec), after " .. tostring(TimeBetweenReqRes) + .. " sec.\n SDL must use Alert duration + default timeout in case of absence softButtons." + end + end) +end + +function m.slider(params) + local SliderDuration + if params.timeout then + SliderDuration = params.timeout + else + SliderDuration = getDefaultValueFromAPI("Slider", "timeout") + end + local RespTimeout = GeneralTimeout + SliderDuration + local RequestTime + local RespTime + local TimeBetweenReqRes + local cid = actions.mobile.getSession():SendRPC("Slider", params) + RequestTime = timestamp() + actions.hmi.getConnection():ExpectRequest("UI.Slider") + actions.mobile.getSession():ExpectResponse(cid, {success = false, resultCode = "GENERIC_ERROR"}) + :Timeout(RespTimeout + respTimeoutCompensation) + :ValidIf(function() + RespTime = timestamp() + TimeBetweenReqRes = RespTime - RequestTime + if TimeBetweenReqRes > RespTimeout - calcAccuracy and TimeBetweenReqRes < RespTimeout + calcAccuracy then + return true + else + return false, "SDL triggers timeout earlier then expected(".. tostring(RespTimeout) .." sec), after " + .. tostring(TimeBetweenReqRes) .. " sec. \n SDL must use Slider timeout + default timeout." + end + end) +end + +function m.scrollableMessage(params) + local ScrMesDuration + if params.timeout then + ScrMesDuration = params.timeout + else + ScrMesDuration = getDefaultValueFromAPI("ScrollableMessage", "timeout") + end + local RespTimeout = GeneralTimeout + ScrMesDuration + local RequestTime + local RespTime + local TimeBetweenReqRes + local cid = actions.mobile.getSession():SendRPC("ScrollableMessage", params) + RequestTime = timestamp() + actions.hmi.getConnection():ExpectRequest("UI.ScrollableMessage") + actions.mobile.getSession():ExpectResponse(cid, {success = false, resultCode = "GENERIC_ERROR"}) + :Timeout(RespTimeout + respTimeoutCompensation) + :ValidIf(function() + RespTime = timestamp() + TimeBetweenReqRes = RespTime - RequestTime + if TimeBetweenReqRes > RespTimeout - calcAccuracy and TimeBetweenReqRes < RespTimeout + calcAccuracy then + return true + else + return false, "SDL triggers timeout earlier then expected(".. tostring(RespTimeout) .." sec), after " + .. tostring(TimeBetweenReqRes) .. " sec. \n SDL must use ScrollableMessage timeout + default timeout." + end + end) +end + +function m.createInteractionChoiceSet() + local cid = actions.mobile.getSession():SendRPC("CreateInteractionChoiceSet", { + interactionChoiceSetID = 100, + choiceSet = { + { + choiceID = 100, + menuName ="Choice100", + vrCommands = { + "Choice100", + } + } + } + }) + actions.hmi.getConnection():ExpectRequest("VR.AddCommand") + :Do(function(_,data) + actions.hmi.getConnection():SendResponse(data.id, data.method, "SUCCESS", {}) + end) + actions.mobile.getSession():ExpectResponse(cid, {success = true, resultCode = "SUCCESS"}) +end + +function m.performInteraction(params, isUIrespSent, isVRrespSent, additionalTimeout) + local PIDuration + local RequestTime + local RespTime + local TimeBetweenReqRes + local RespTimeout + local mainParams = { + initialText = "StartPerformInteraction", + initialPrompt = { + { + text = "Make your choice", + type = "TEXT" + } + }, + interactionChoiceSetIDList = { 100 }, + helpPrompt = { + { + text = "Help Prompt", + type = "TEXT", + } + }, + timeoutPrompt = { + { + text = "Time out", + type = "TEXT", + } + }, + interactionLayout = "ICON_ONLY" + } + + for param, value in pairs(params) do + mainParams[param] = value + end + + PIDuration = params.timeout or getDefaultValueFromAPI("PerformInteraction", "timeout") + RespTimeout = GeneralTimeout + PIDuration + additionalTimeout + local cid = actions.mobile.getSession():SendRPC("PerformInteraction", mainParams) + RequestTime = timestamp() + actions.hmi.getConnection():ExpectRequest("VR.PerformInteraction") + :Do(function(_,data) + if isVRrespSent == true then + local function RespVR() + if mainParams.interactionMode == "BOTH" then + actions.hmi.getConnection():SendError(data.id, data.method, "ABORTED", "error message") + else + actions.hmi.getConnection():SendResponse(data.id, data.method, "SUCCESS", {}) + end + end + RUN_AFTER(RespVR, m.timeToSendResp) + end + end) + actions.hmi.getConnection():ExpectRequest("UI.PerformInteraction") + :Do(function(_,data) + if isUIrespSent == true then + local function RespUI() + actions.hmi.getConnection():SendResponse(data.id, data.method, "SUCCESS", {}) + end + RUN_AFTER(RespUI, m.timeToSendResp) + end + end) + actions.mobile.getSession():ExpectResponse(cid, {success = false, resultCode = "GENERIC_ERROR"}) + :Timeout(RespTimeout + respTimeoutCompensation) + :ValidIf(function() + RespTime = timestamp() + TimeBetweenReqRes = RespTime - RequestTime + if TimeBetweenReqRes > RespTimeout - calcAccuracy and TimeBetweenReqRes < RespTimeout + calcAccuracy then + return true + else + return false, "SDL triggers timeout earlier then expected(".. tostring(RespTimeout) .." sec), after " + .. tostring(TimeBetweenReqRes) .. " sec. \n SDL must use PI timeout + default timeout." + end + end) +end + +return m diff --git a/test_scripts/Defects/4_5/1880_DefaultAndRPCTimeoutGENERIC_ERROR.lua b/test_scripts/Defects/4_5/1880_DefaultAndRPCTimeoutGENERIC_ERROR.lua deleted file mode 100644 index af7469e661..0000000000 --- a/test_scripts/Defects/4_5/1880_DefaultAndRPCTimeoutGENERIC_ERROR.lua +++ /dev/null @@ -1,405 +0,0 @@ ---------------------------------------------------------------------------------------------- --- In case --- SDL transfers *RPC with own timeout from mobile app to HMI (please see list with impacted *RPCs below) --- and HMI does NOT respond during + <*RPCs_own_timeout> (please see APPLINK-27495) --- SDL must: --- respond 'GENERIC_ERROR, success:false' to mobile app ---------------------------------------------------------------------------------------------------- ---[[ Required Shared libraries ]] -local runner = require('user_modules/script_runner') -local commonDefects = require("test_scripts/Defects/4_5/commonDefects") -local apiLoader = require("modules/api_loader") -local api = apiLoader.init("data/MOBILE_API.xml") -local schema = api.interface[next(api.interface)] - ---[[ Test Configuration ]] -runner.testSettings.restrictions.sdlBuildOptions = { { extendedPolicy = { "PROPRIETARY", "EXTERNAL_PROPRIETARY" } } } - ---[[ Local Variables ]] -local DefaultTimeout = runner.testSettings.defaultTimeout - -local AlertRequestParams = { - alertText1 = "alertText1", - duration = 7000 -} - -local AlertRequestParamsWithoutDuration = { - alertText1 = "alertText1", - ttsChunks = { - { - text = "TTSChunk", - type = "TEXT", - } - }, -} - -local SliderRequetsParams = { - numTicks = 3, - position = 2, - sliderHeader ="sliderHeader", - sliderFooter = {"1", "2", "3"}, - timeout = 7000 -} - -local SliderRequetsParamsWithoutTimeout = { - numTicks = 3, - position = 2, - sliderHeader ="sliderHeader", - sliderFooter = {"1", "2", "3"}, -} - -local ScrollableMessageRequestParamsWithSoftButtons = { - scrollableMessageBody = "abc", - softButtons = { - { - softButtonID = 1, - text = "Button1", - type = "IMAGE", - image = - { - value = "icon.png", - imageType = "DYNAMIC" - }, - isHighlighted = false, - systemAction = "DEFAULT_ACTION" - }, - { - softButtonID = 2, - text = "Button2", - type = "IMAGE", - image = - { - value = "icon.png", - imageType = "DYNAMIC" - }, - isHighlighted = false, - systemAction = "DEFAULT_ACTION" - } - }, - timeout = 7000 -} - -local ScrollableMessageRequestParamsWithoutSoftButtons = { - scrollableMessageBody = "abc", - timeout = 3000 -} - -local ScrollableMessageRequestParamsWithoutTimeout = { - scrollableMessageBody = "abc", -} - -local PerformInteractionRequestParamsBOTH = { - initialText = "StartPerformInteraction", - initialPrompt = { - { - text = "Make your choice", - type = "TEXT" - } - }, - interactionMode = "BOTH", - interactionChoiceSetIDList = {100}, - helpPrompt = { - { - text = "Help Prompt", - type = "TEXT", - } - }, - timeoutPrompt = { - { - text = " Time out ", - type = "TEXT", - } - }, - timeout = 7000, - vrHelp = { - { - text = " New VRHelp ", - position = 1, - image = { - value = "icon.png", - imageType = "STATIC", - } - } - }, - interactionLayout = "ICON_ONLY" -} - -local PerformInteractionRequestParamsMANUAL = { - initialText = "StartPerformInteraction", - interactionMode = "MANUAL_ONLY", - initialPrompt = { - { - text = "Make your choice", - type = "TEXT" - } - }, - interactionChoiceSetIDList = {100}, - timeout = 8000, - interactionLayout = "LIST_ONLY" -} - -local PerformInteractionRequestParamsVR = { - initialText = "StartPerformInteraction", - initialPrompt = { - { - text = "Make your choice", - type = "TEXT" - } - }, - interactionMode = "VR_ONLY", - interactionChoiceSetIDList = {100}, - helpPrompt = { - { - text = "Help Prompt", - type = "TEXT", - } - }, - timeoutPrompt = { - { - text = "Time out", - type = "TEXT", - } - }, - timeout = 12000, - vrHelp = { - { - text = "New VRHelp", - position = 1, - image = { - value = "icon.png", - imageType = "STATIC", - } - } - }, - interactionLayout = "ICON_ONLY" -} - ---[[ Local Functions ]] -local function getDefaultValueFromAPI(pFunctionName, pParamName) - local defvalue = schema.type["request"].functions[pFunctionName].param[pParamName].defvalue - if not defvalue then - print("Default value was not found in API for function '" .. pFunctionName - .. "' and parameter '" .. pParamName .. "'") - defvalue = 0 - end - print("Default value: " .. defvalue) - return defvalue -end - -local function Alert(params, self) - local AlertDuration - if params.duration then - AlertDuration = params.duration - else - AlertDuration = getDefaultValueFromAPI("Alert", "duration") - end - local RespTimeout = DefaultTimeout + AlertDuration - local RequestTime - local RespTime - local TimeBetweenReqRes - - if params.ttsChunks then - EXPECT_HMICALL("TTS.Speak") - :Do(function(_,data) - local function SpeakResp() - self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", {}) - end - RUN_AFTER(SpeakResp, 2000) - end) - end - - local cid = self.mobileSession1:SendRPC("Alert", params) - RequestTime = timestamp() - - EXPECT_HMICALL("UI.Alert") - - self.mobileSession1:ExpectResponse(cid, { success = false, resultCode = "GENERIC_ERROR" }) - :Timeout(RespTimeout + 1000) - :ValidIf(function() - RespTime = timestamp() - TimeBetweenReqRes = RespTime - RequestTime - if TimeBetweenReqRes > RespTimeout - 1000 and TimeBetweenReqRes < RespTimeout + 1000 then - return true - else - return false, "SDL triggers timeout earlier then expected(" - .. tostring(RespTimeout) .." sec), after " .. tostring(TimeBetweenReqRes) - .. " sec.\n SDL must use Alert duration + default timeout in case of absence softButtons." - end - end) -end - -local function Slider(params, self) - local SliderDuration - if params.timeout then - SliderDuration = params.timeout - else - SliderDuration = getDefaultValueFromAPI("Slider", "timeout") - end - local RespTimeout = DefaultTimeout + SliderDuration - local RequestTime - local RespTime - local TimeBetweenReqRes - local cid = self.mobileSession1:SendRPC("Slider", params) - RequestTime = timestamp() - EXPECT_HMICALL("UI.Slider") - self.mobileSession1:ExpectResponse(cid, {success = false, resultCode = "GENERIC_ERROR"}) - :Timeout(RespTimeout + 1000) - :ValidIf(function() - RespTime = timestamp() - TimeBetweenReqRes = RespTime - RequestTime - if TimeBetweenReqRes > RespTimeout - 1000 and TimeBetweenReqRes < RespTimeout + 1000 then - return true - else - return false, "SDL triggers timeout earlier then expected(".. tostring(RespTimeout) .." sec), after " - .. tostring(TimeBetweenReqRes) .. " sec. \n SDL must use Slider timeout + default timeout." - end - end) -end - -local function ScrollableMessage(params, self) - local ScrMesDuration - if params.timeout then - ScrMesDuration = params.timeout - else - ScrMesDuration = getDefaultValueFromAPI("ScrollableMessage", "timeout") - end - local RespTimeout = DefaultTimeout + ScrMesDuration - local RequestTime - local RespTime - local TimeBetweenReqRes - local cid = self.mobileSession1:SendRPC("ScrollableMessage", params) - RequestTime = timestamp() - EXPECT_HMICALL("UI.ScrollableMessage") - self.mobileSession1:ExpectResponse(cid, {success = false, resultCode = "GENERIC_ERROR"}) - :Timeout(RespTimeout + 1000) - :ValidIf(function() - RespTime = timestamp() - TimeBetweenReqRes = RespTime - RequestTime - if TimeBetweenReqRes > RespTimeout - 1000 and TimeBetweenReqRes < RespTimeout + 1000 then - return true - else - return false, "SDL triggers timeout earlier then expected(".. tostring(RespTimeout) .." sec), after " - .. tostring(TimeBetweenReqRes) .. " sec. \n SDL must use ScrollableMessage timeout + default timeout." - end - end) -end - -local function CreateInteractionChoiceSet(self) - local cid = self.mobileSession1:SendRPC("CreateInteractionChoiceSet", { - interactionChoiceSetID = 100, - choiceSet = { - { - choiceID = 100, - menuName ="Choice100", - vrCommands = { - "Choice100", - } - } - } - }) - EXPECT_HMICALL("VR.AddCommand") - :Do(function(_,data) - self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", {}) - end) - self.mobileSession1:ExpectResponse(cid, {success = true, resultCode = "SUCCESS"}) -end - -local function PerformInteraction(params, self) - local PIDuration - local RequestTime - local RespTime - local TimeBetweenReqRes - local TimeToResponseForVR = 2000 - local RespTimeout - if params.timeout then - PIDuration = params.timeout - RespTimeout = DefaultTimeout + 2*PIDuration - else - PIDuration = getDefaultValueFromAPI("PerformInteraction", "timeout") - RespTimeout = DefaultTimeout + 2*PIDuration - end - local cid = self.mobileSession1:SendRPC("PerformInteraction", params) - EXPECT_HMICALL("VR.PerformInteraction") - :Do(function(_,data) - local function RespVR() - self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", {}) - RequestTime = timestamp() - end - RUN_AFTER(RespVR, TimeToResponseForVR) - end) - EXPECT_HMICALL("UI.PerformInteraction") - self.mobileSession1:ExpectResponse(cid, {success = false, resultCode = "GENERIC_ERROR"}) - :Timeout(RespTimeout + 3000) - :ValidIf(function() - RespTime = timestamp() - TimeBetweenReqRes = RespTime - RequestTime - if TimeBetweenReqRes > RespTimeout - 1000 and TimeBetweenReqRes < RespTimeout + 1000 then - return true - else - return false, "SDL triggers timeout earlier then expected(".. tostring(RespTimeout) .." sec), after " - .. tostring(TimeBetweenReqRes) .. " sec. \n SDL must use PI timeout + default timeout." - end - end) -end - -local function PerformInteractionVR(params, self) - local RequestTime - local RespTime - local TimeBetweenReqRes - local TimeToResponseForUI = 2000 - local RespTimeout = DefaultTimeout + params.timeout - local cid = self.mobileSession1:SendRPC("PerformInteraction", params) - RequestTime = timestamp() - EXPECT_HMICALL("UI.PerformInteraction") - :Do(function(_,data) - local function RespUI() - self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", {}) - end - RUN_AFTER(RespUI, TimeToResponseForUI) - end) - EXPECT_HMICALL("VR.PerformInteraction") - self.mobileSession1:ExpectResponse(cid, {success = false, resultCode = "GENERIC_ERROR"}) - :Timeout(RespTimeout + 1000) - :ValidIf(function() - RespTime = timestamp() - TimeBetweenReqRes = RespTime - RequestTime - if TimeBetweenReqRes > RespTimeout - 1000 and TimeBetweenReqRes < RespTimeout + 1000 then - return true - else - return false, "SDL triggers timeout earlier then expected(".. tostring(RespTimeout) .." sec), after " - .. tostring(TimeBetweenReqRes) .. " sec. \n SDL must use PI timeout + default timeout." - end - end) -end - ---[[ Scenario ]] -runner.Title("Preconditions") -runner.Step("Clean environment", commonDefects.preconditions) -runner.Step("Start SDL, HMI, connect Mobile, start Session", commonDefects.start) -runner.Step("RAI, PTU", commonDefects.rai_ptu) -runner.Step("Activate App", commonDefects.activate_app) -runner.Step("Upload file", commonDefects.putFile, {"icon.png"}) - -runner.Title("Test") -runner.Step("Alert_default_timeout_and_Alert_timeout", Alert, { AlertRequestParams }) -runner.Step("Alert_default_timeout", Alert, { AlertRequestParamsWithoutDuration }) - -runner.Step("Slider_default_timeout_and_Slider_timeout", Slider, { SliderRequetsParams }) -runner.Step("Slider_default_timeout", Slider, { SliderRequetsParamsWithoutTimeout }) - -runner.Step("ScrollableMessage_default_timeout_and_ScrMes_timeout_with_softButtons", ScrollableMessage, - { ScrollableMessageRequestParamsWithSoftButtons }) -runner.Step("ScrollableMessage_default_timeout_and_ScrMes_timeout_without_softButtons", ScrollableMessage, - { ScrollableMessageRequestParamsWithoutSoftButtons }) -runner.Step("ScrollableMessage_default_timeout", ScrollableMessage, - { ScrollableMessageRequestParamsWithoutTimeout }) - -runner.Step("CreateInteractionChoiceSet", CreateInteractionChoiceSet) -runner.Step("PerformInteraction_default_timeout_and_PI_timeout_BOTH", PerformInteraction, - { PerformInteractionRequestParamsBOTH }) -runner.Step("PerformInteraction_default_timeout_and_PI_timeout_MANUAL", PerformInteraction, - { PerformInteractionRequestParamsMANUAL }) -runner.Step("PerformInteraction_timeout_VR", PerformInteractionVR, { PerformInteractionRequestParamsVR }) - -runner.Title("Postconditions") -runner.Step("Stop SDL", commonDefects.postconditions) 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 bd8dd2f3a5..6dd9c891ce 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 @@ -46,7 +46,10 @@ ./test_scripts/Defects/5_0/1901_Navigation_app_must_be_resumed_to_FULL_or_LIMITED_and_AUDIBLE_in_case_of_active_embedded_audio_source.lua ;RPC ./test_scripts/Defects/4_5/1211_ATF_Check_count_of_removals_for_bad_behavior_REQUEST_WHILE_IN_NONE_HMI_LEVEL.lua -./test_scripts/Defects/4_5/1880_DefaultAndRPCTimeoutGENERIC_ERROR.lua +./test_scripts/Defects/4_5/1880/1880_1_DefaultAndRPCTimeoutGENERIC_ERROR.lua +./test_scripts/Defects/4_5/1880/1880_2_PerformInteraction_BOTH_DefaultAndRPCTimeoutGENERIC_ERROR.lua +./test_scripts/Defects/4_5/1880/1880_3_PerformInteraction_VR_ONLY_DefaultAndRPCTimeoutGENERIC_ERROR.lua +./test_scripts/Defects/4_5/1880/1880_4_PerformInteraction_MANUAL_ONLY_DefaultAndRPCTimeoutGENERIC_ERROR.lua ./test_scripts/Defects/4_5/1881_OnDriverDistraction_After_changing_HMIlevel_from_NONE.lua ./test_scripts/Defects/5_0/2457_Needed_fixes_sending_of_UpdateDeviceList_notification_on_device_connect.lua ./test_scripts/Defects/5_0/1031_SDL_transfer_OnKeyboardInput_notification_to_not_active_App_when_there_is_no_active_PerformInteraction_KEYBOARD.lua