Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---------------------------------------------------------------------------------------------------
-- Issue: https://github.com/smartdevicelink/sdl_core/issues/3868
---------------------------------------------------------------------------------------------------
-- Description: Check that SDL transfers succeed result code in result structure from HMI to the mobile app
-- during processing of CreateWindow

-- Precondition:
-- 1. SDL and HMI are started
-- 2. Mobile app is registered and activated
-- 3. Policy Table Update is performed and "WidgetSupport" functional group is assigned for the app
--
-- Steps:
-- 1. Mobile app requests CreateWindow RPC
-- 2. SDL sends UI.CreateWindow request to the HMI
-- 3. HMI responds with succeed result code in result structure to UI.CreateWindow
--
-- SDL does:
-- - send CreateWindow(success = true, resultCode = <code received from HMI>) response to the mobile app
---------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local common = require('test_scripts/Defects/8_2/3868/common_3868')

--[[ 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("Policy Table Update", common.policyTableUpdate, { common.ptUpdate })
common.Step("Activate App", common.activateApp)

common.Title("Test")
for windowId, resultCode in ipairs(common.tcs) do
local response = { code = resultCode, structure = common.responsesStructures.result }
common.Title("Test case: '" .. tostring(resultCode) .. "'" )
common.Step("App sends CreateWindow RPC", common.createWindow,{ windowId, response })
end

common.Title("Postconditions")
common.Step("Stop SDL", common.postconditions)
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---------------------------------------------------------------------------------------------------
-- Issue: https://github.com/smartdevicelink/sdl_core/issues/3868
---------------------------------------------------------------------------------------------------
-- Description: Check that SDL transfers succeed result code in error structure from HMI to the mobile app
-- during processing of CreateWindow

-- Precondition:
-- 1. SDL and HMI are started
-- 2. Mobile app is registered and activated
-- 3. Policy Table Update is performed and "WidgetSupport" functional group is assigned for the app
--
-- Steps:
-- 1. Mobile app requests CreateWindow RPC
-- 2. SDL sends UI.CreateWindow request to the HMI
-- 3. HMI responds with succeed result code in error structure to UI.CreateWindow
--
-- SDL does:
-- - send CreateWindow(success = true, resultCode = <code received from HMI>) response to the mobile app
---------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local common = require('test_scripts/Defects/8_2/3868/common_3868')

--[[ 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("Policy Table Update", common.policyTableUpdate, { common.ptUpdate })
common.Step("Activate App", common.activateApp)

common.Title("Test")
for windowId, resultCode in ipairs(common.tcs) do
local response = { code = resultCode, structure = common.responsesStructures.error }
common.Title("Test case: '" .. tostring(resultCode) .. "'" )
common.Step("App sends CreateWindow RPC", common.createWindow,{ windowId, response })
end

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

70 changes: 70 additions & 0 deletions test_scripts/Defects/8_2/3868/common_3868.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---------------------------------------------------------------------------------------------------
-- Common module
---------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local actions = require("user_modules/sequences/actions")

--[[ Module ]]
local m = {}

--[[ Proxy Functions ]]
m.Title = runner.Title
m.Step = runner.Step
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.getHMIAppId = actions.app.getHMIId
m.policyTableUpdate = actions.policyTableUpdate

--[[ Test Configuration ]]
runner.testSettings.isSelfIncluded = false

--[[ Common Variables ]]
m.tcs = {
[01] = "WARNINGS",
[02] = "TRUNCATED_DATA",
[03] = "RETRY",
[04] = "SAVED",
[05] = "WRONG_LANGUAGE",
[06] = "UNSUPPORTED_RESOURCE"
}

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 Functions ]]
local function getCreateWindowParam(windowID)
local createWindowParam = {
windowID = windowID,
windowName = "Name_" .. windowID,
type = "WIDGET"
}
return createWindowParam
end

--[[ Common Functions ]]
function m.ptUpdate(pTbl)
pTbl.policy_table.app_policies[actions.getConfigAppParams().fullAppID].groups = { "Base-4", "WidgetSupport" }
end

function m.createWindow(pWindowID, response)
local params = getCreateWindowParam(pWindowID)
local cid = m.getMobileSession():SendRPC("CreateWindow", params)
params.appID = m.getHMIAppId()
m.getHMIConnection():ExpectRequest("UI.CreateWindow", params)
:Do(function(_, data)
response.structure(data, response.code)
end)
m.getMobileSession():ExpectResponse(cid, { success = true, resultCode = response.code })
m.getMobileSession():ExpectNotification("OnHMIStatus", { hmiLevel = "NONE", windowID = params.windowID })
m.getMobileSession():ExpectNotification("OnHashChange")
end

return m
2 changes: 2 additions & 0 deletions test_sets/Defects/Defects_release_8_2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
./test_scripts/Defects/8_2/3868/3868_1_CreateWindow_custom_success_codes_result_structure.lua
./test_scripts/Defects/8_2/3868/3868_2_CreateWindow_custom_success_codes_error_structure.lua