Skip to content

Commit

Permalink
Merge remote-tracking branch 'smart/develop' into impl/defect_3175
Browse files Browse the repository at this point in the history
  • Loading branch information
dboltovskyi committed Oct 30, 2020
2 parents 4318d65 + dc55b86 commit 5cacff5
Show file tree
Hide file tree
Showing 17 changed files with 718 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ local function setHybridApp(pAppId, pAppNameCode, pHybridAppPreference)
common.getMobileSession():ExpectResponse(cid, { success = true, resultCode = "SUCCESS" })
common.getHMIConnection():ExpectRequest("BasicCommunication.UpdateAppList"):Do(function(_,data)
local apps = data.params.applications
for i,v in ipairs(apps) do
for i,v in ipairs(apps) do
if v.appName == "HybridApp" .. pAppNameCode then
print('Setting HMI App ID '.. pAppNameCode)
hmiAppIDMap[pAppId] = v.appID
Expand Down Expand Up @@ -99,7 +99,7 @@ local function registerApp(pAppId, pConId, pAppNameCode, pResultCode, pActivateC
local cid = session:SendRPC("RegisterAppInterface", params)
session:ExpectResponse(cid, { success = success, resultCode = pResultCode })
session:ExpectNotification("OnPermissionsChange"):Times(occurences)
session:ExpectNotification("OnHMIStatus"):Times(occurences)
session:ExpectNotification("OnHMIStatus"):Times(pActivateCloudApp == true and occurences*2 or occurences)
common.getHMIConnection():ExpectNotification("BasicCommunication.OnAppRegistered"):Times(occurences)
end)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ local function setHybridApp(pAppId, pAppNameCode, pHybridAppPreference)
common.getMobileSession():ExpectResponse(cid, { success = true, resultCode = "SUCCESS" })
common.getHMIConnection():ExpectRequest("BasicCommunication.UpdateAppList"):Do(function(_,data)
local apps = data.params.applications
for i,v in ipairs(apps) do
for i,v in ipairs(apps) do
if v.appName == "HybridApp" .. pAppNameCode then
print('Setting HMI App ID '.. pAppNameCode)
hmiAppIDMap[pAppId] = v.appID
Expand Down Expand Up @@ -94,7 +94,7 @@ local function registerApp(pAppId, pConId, pAppNameCode, pActivateCloudApp, pUnr
local cid = session:SendRPC("RegisterAppInterface", params)
session:ExpectResponse(cid, { success = true, resultCode = "SUCCESS" })
session:ExpectNotification("OnPermissionsChange")
session:ExpectNotification("OnHMIStatus")
session:ExpectNotification("OnHMIStatus"):Times(pActivateCloudApp == true and 2 or 1)
common.getHMIConnection():ExpectNotification("BasicCommunication.OnAppRegistered")
:Do(function(_, d)
common.setHMIAppId(d.params.application.appID, pAppId)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
---------------------------------------------------------------------------------------------------
-- Issue: https://github.com/smartdevicelink/sdl_core/issues/1306
---------------------------------------------------------------------------------------------------
-- Steps:
-- 1. Send SetGlobalProperties from mobile (helpPrompt, timeoutPrompt, vrHelpTitle, vrHelp)
-- 2. Stop smartDeviceLinkCore in terminal (through ctrl+c) and do not exit from mobile app
-- 3. Start smartDeviceLinkCore and HMI
-- 4. Mobile App is registered and activated
-- 5. Send SetGlobalProperties from mobile (helpPrompt, timeoutPrompt, vrHelpTitle, vrHelp)
-- 6. Send ResetGlobalProperties from mobile (helpPrompt, timeoutPrompt, vrHelpTitle, vrHelp)
--
-- SDL does:
-- - send to HMI UI.SetGlobalProperties("vrHelpTitle", "vrHelp") with default values
-- - send to HMI TTS.SetGlobalProperties with "helpPrompt" parameter that should be reset to default value
-- (smartDeviceLink.ini file contains default values for "helpPrompt"
---------------------------------------------------------------------------------------------------
--[[ 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 requestParams = {
helpPrompt = {{ text = "Help prompt", type = "TEXT" }},
timeoutPrompt = {{ text = "Timeout prompt", type = "TEXT" }},
vrHelpTitle = "VR help title",
vrHelp = {{ position = 1, text = "VR help item" }}
}

local UiParams = {
vrHelpTitle = requestParams.vrHelpTitle,
vrHelp = requestParams.vrHelp,
}

local TtsParams = {
timeoutPrompt = requestParams.timeoutPrompt,
helpPrompt = requestParams.helpPrompt
}

local allParams = {
requestParams = requestParams,
UiParams = UiParams,
TtsParams = TtsParams
}

--[[ Local Functions ]]
local function splitString(pInputStr, pSep)
if pSep == nil then
pSep = "%s"
end
local out, i = {}, 1
for str in string.gmatch(pInputStr, "([^" .. pSep .. "]+)") do
out[i] = str
i = i + 1
end
return out
end

local function getResetGlobalPropertiesParams()
local uiParams = {
vrHelpTitle = common.sdl.getSDLIniParameter("HelpTitle"),
vrHelp = {{ position = 1, text = common.getConfigAppParams().appName }}
}

local delimiter = common.sdl.getSDLIniParameter("TTSDelimiter")
local paramHP = splitString(common.sdl.getSDLIniParameter("HelpPromt"), delimiter)
local paramTP = splitString(common.sdl.getSDLIniParameter("TimeOutPromt"), delimiter)
local helpPromptArray = {}
local timeoutPromptArray = {}

if next(paramHP) then
for i = 1, #paramHP do
helpPromptArray[i] = { text = paramHP[i] .. delimiter, type = "TEXT" }
end
end

if next(paramTP) then
for i = 1, #paramTP do
timeoutPromptArray[i] = { text = paramTP[i] .. delimiter, type = "TEXT" }
end
end

local ttsParams = {
helpPrompt = helpPromptArray,
timeoutPrompt = timeoutPromptArray
}
return uiParams, ttsParams
end

local function sendSetGlobalProperties(pParams)
local cid = common.mobile.getSession():SendRPC("SetGlobalProperties", pParams.requestParams)

pParams.UiParams.appID = common.getHMIAppId()
common.hmi.getConnection():ExpectRequest("UI.SetGlobalProperties", pParams.UiParams)
:Do(function(_,data)
common.hmi.getConnection():SendResponse(data.id, data.method, "SUCCESS", {})
end)

pParams.TtsParams.appID = common.getHMIAppId()
common.hmi.getConnection():ExpectRequest("TTS.SetGlobalProperties", pParams.TtsParams)
: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")
end

local function sendResetGlobalProperties()
local requesUIparams, requesTTSparams = getResetGlobalPropertiesParams()

local cid = common.mobile.getSession():SendRPC("ResetGlobalProperties", {
properties = { "VRHELPTITLE", "HELPPROMPT", "TIMEOUTPROMPT", "VRHELPITEMS" }
})

common.hmi.getConnection():ExpectRequest("UI.SetGlobalProperties", requesUIparams)
:Do(function(_,data)
common.hmi.getConnection():SendResponse(data.id, data.method, "SUCCESS", {})
end)

common.hmi.getConnection():ExpectRequest("TTS.SetGlobalProperties", requesTTSparams)
: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")
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, PTU", common.app.register)
runner.Step("Activate App", common.app.activate)

runner.Title("Test")
runner.Step("Send SetGlobalProperties", sendSetGlobalProperties, { allParams })
runner.Step("Stop SDL", StopSDL)
runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start)
runner.Step("RAI, PTU", common.app.registerNoPTU)
runner.Step("Activate App", common.app.activate)
runner.Step("Send SetGlobalProperties", sendSetGlobalProperties, { allParams })
runner.Step("Send ResetGlobalProperties", sendResetGlobalProperties)

runner.Title("Postconditions")
runner.Step("Stop SDL", common.postconditions)
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---------------------------------------------------------------------------------------------------
-- Issue: https://github.com/smartdevicelink/sdl_core/issues/3547
---------------------------------------------------------------------------------------------------
-- Steps:
-- 1. Navigation app is registered
-- 2. App try to start Audio service
-- SDL does
-- - send `Navi.StartAudioStream` request to HMI
-- 3. HMI responds with 'REJECTED'
-- SDL does:
-- - re-sends `Navi.StartAudioStream` requests to HMI a few times
-- (equal to `StartStreamRetry` .ini parameter)
-- 4. HMI responds with 'SUCCESS' to the last request
-- SDL does:
-- - not send any new requests to HMI
-- - not unregister App
---------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local common = require('test_scripts/Defects/7_0/common_3547')

--[[ Local Variables ]]
local expNumOfAttempts = 3

--[[ Local Functions ]]
local function startAudioVideoService(pServiceId)
common.mobile.getSession():StartService(pServiceId)
common.hmi.getConnection():ExpectRequest(common.requestNames[pServiceId].start)
:Do(function(exp, data)
if exp.occurences == expNumOfAttempts + 1 then
common.sendSuccessResponse(data, 500)
else
common.sendErrorResponse(data, 500)
end
end)
:Times(expNumOfAttempts + 1)
common.hmi.getConnection():ExpectNotification("BasicCommunication.OnAppUnregistered")
:Times(0)
common.mobile.getSession():ExpectNotification("OnAppInterfaceUnregistered")
:Times(0)
common.run.wait(4000)
end

--[[ Scenario ]]
common.Title("Preconditions")
common.Step("Clean environment", common.preconditions)
common.Step("SetNewRetryValue", common.setSDLIniParameter, { "StartStreamRetry", expNumOfAttempts .. ", 1000" })
common.Step("Start SDL, HMI, connect Mobile, start Session", common.start)
common.Step("RAI, PTU", common.registerApp)
common.Step("Activate App", common.activateApp)

common.Title("Test")
common.Step("Retry sequence start AUDIO streaming", startAudioVideoService, { 10 })

common.Title("Postconditions")
common.Step("Stop SDL", common.postconditions)
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---------------------------------------------------------------------------------------------------
-- Issue: https://github.com/smartdevicelink/sdl_core/issues/3547
---------------------------------------------------------------------------------------------------
-- Steps:
-- 1. Navigation app is registered
-- 2. App try to start Video service
-- SDL does
-- - send `Navi.StartStream` request to HMI
-- 3. HMI responds with 'REJECTED'
-- SDL does:
-- - re-sends `Navi.StartStream` requests to HMI a few times
-- (equal to `StartStreamRetry` .ini parameter)
-- 4. HMI responds with 'SUCCESS' to the last request
-- SDL does:
-- - not send any new requests to HMI
-- - not unregister App
---------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local common = require('test_scripts/Defects/7_0/common_3547')

--[[ Local Variables ]]
local expNumOfAttempts = 3

--[[ Local Functions ]]
local function startAudioVideoService(pServiceId)
common.mobile.getSession():StartService(pServiceId)
common.hmi.getConnection():ExpectRequest(common.requestNames[pServiceId].start)
:Do(function(exp, data)
if exp.occurences == expNumOfAttempts + 1 then
common.sendSuccessResponse(data, 500)
else
common.sendErrorResponse(data, 500)
end
end)
:Times(expNumOfAttempts + 1)
common.hmi.getConnection():ExpectNotification("BasicCommunication.OnAppUnregistered")
:Times(0)
common.mobile.getSession():ExpectNotification("OnAppInterfaceUnregistered")
:Times(0)
common.run.wait(4000)
end

--[[ Scenario ]]
common.Title("Preconditions")
common.Step("Clean environment", common.preconditions)
common.Step("SetNewRetryValue", common.setSDLIniParameter, { "StartStreamRetry", expNumOfAttempts .. ", 1000" })
common.Step("Start SDL, HMI, connect Mobile, start Session", common.start)
common.Step("RAI, PTU", common.registerApp)
common.Step("Activate App", common.activateApp)

common.Title("Test")
common.Step("Retry sequence start VIDEO streaming", startAudioVideoService, { 11 })

common.Title("Postconditions")
common.Step("Stop SDL", common.postconditions)
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---------------------------------------------------------------------------------------------------
-- Issue: https://github.com/smartdevicelink/sdl_core/issues/3547
---------------------------------------------------------------------------------------------------
-- Steps:
-- 1. Navigation app is registered
-- 2. App try to start Audio service
-- SDL does
-- - send `Navi.StartAudioStream` request to HMI
-- 3. HMI responds with 'REJECTED'
-- SDL does:
-- - re-sends `Navi.StartAudioStream` requests to HMI a few times
-- (equal to `StartStreamRetry` .ini parameter)
-- 4. HMI responds with 'REJECTED' to all requests
-- SDL does:
-- - not send new `Navi.StartAudioStream` requests to HMI
-- - unregister App once last response is received
---------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local common = require('test_scripts/Defects/7_0/common_3547')

--[[ Local Variables ]]
local expNumOfAttempts = 3

--[[ Local Functions ]]
local function startAudioVideoService(pServiceId)
common.mobile.getSession():StartService(pServiceId)
common.hmi.getConnection():ExpectRequest(common.requestNames[pServiceId].start)
:Do(function(_, data)
common.sendErrorResponse(data, 500)
end)
:Times(expNumOfAttempts + 1)
common.mobile.getSession():ExpectEndService(pServiceId)
common.hmi.getConnection():ExpectRequest(common.requestNames[pServiceId].stop)
common.hmi.getConnection():ExpectNotification("BasicCommunication.OnAppUnregistered")
common.mobile.getSession():ExpectNotification("OnAppInterfaceUnregistered", { reason = "PROTOCOL_VIOLATION" })
common.run.wait(4000)
end

--[[ Scenario ]]
common.Title("Preconditions")
common.Step("Clean environment", common.preconditions)
common.Step("SetNewRetryValue", common.setSDLIniParameter, { "StartStreamRetry", expNumOfAttempts .. ", 1000" })
common.Step("Start SDL, HMI, connect Mobile, start Session", common.start)
common.Step("RAI, PTU", common.registerApp)
common.Step("Activate App", common.activateApp)

common.Title("Test")
common.Step("Retry sequence start AUDIO streaming", startAudioVideoService, { 10 })

common.Title("Postconditions")
common.Step("Stop SDL", common.postconditions)

Loading

0 comments on commit 5cacff5

Please sign in to comment.