Skip to content

Commit

Permalink
Merge pull request #2157 from TMyza/feature/open_menu_rpc
Browse files Browse the repository at this point in the history
[WIP] Initial scripts for Open Menu RPC
  • Loading branch information
dboltovskyi committed Dec 11, 2018
2 parents c3bb85f + 52f2d21 commit a65f24d
Show file tree
Hide file tree
Showing 14 changed files with 621 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---------------------------------------------------------------------------------------------------
-- Proposal:
-- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0116-open-menu.md
-- Description:
-- In case:
-- 1) Mobile application is set to appropriate HMI level and System Context MENU, MAIN
-- 2) Mobile application is added SubMenu with menuID = 5
-- 3) Mobile sends ShowAppMenu request with menuID = 5 parameter to SDL
-- 4) SDL sends ShowAppMenu request with menuID parameter to HMI
-- 5) HMI sends ShowAppMenu response with resultCode = SUCCESS to SDL
-- SDL does:
-- 1) send ShowAppMenu response with resultCode = SUCCESS to mobile
---------------------------------------------------------------------------------------------------
-- [[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local common = require('test_scripts/API/OpenMenuRPC/commonOpenMenuRPC')

-- [[ Test Configuration ]]
runner.testSettings.isSelfIncluded = false
config.application1.registerAppInterfaceParams.appHMIType = { "PROJECTION" }

--[[ 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.registerApp)

runner.Title("Test")
runner.Step("App activate, HMI SystemContext MAIN", common.activateApp)
runner.Step("Add menu", common.addSubMenu, { 5 })
runner.Step("Send show app menu, HMI SystemContext MAIN", common.showAppMenuSuccess, { 5 })
runner.Step("Set HMI SystemContext to MENU", common.changeHMISystemContext, { "MENU" })
runner.Step("Show app menu, HMI SystemContext MENU", common.showAppMenuSuccess, { 5 })

runner.Title("Postconditions")
runner.Step("Stop SDL", common.postconditions)
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---------------------------------------------------------------------------------------------------
-- Proposal:
-- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0116-open-menu.md
-- Description:
-- In case:
-- 1) Mobile application is set to appropriate HMI level and System Context MENU, MAIN
-- 2) Mobile sends ShowAppMenu request without menuID parameter to SDL
-- 3) SDL sends ShowAppMenu request without menuID parameter to HMI
-- 4) HMI sends ShowAppMenu response with resultCode = SUCCESS to SDL
-- SDL does:
-- 1) send ShowAppMenu response with resultCode = SUCCESS to mobile
---------------------------------------------------------------------------------------------------
-- [[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local common = require('test_scripts/API/OpenMenuRPC/commonOpenMenuRPC')

-- [[ Test Configuration ]]
runner.testSettings.isSelfIncluded = false
config.application1.registerAppInterfaceParams.appHMIType = { "PROJECTION" }

--[[ 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.registerApp)

runner.Title("Test")
runner.Step("App activate, HMI SystemContext MAIN", common.activateApp)
runner.Step("Send show app menu, HMI SystemContext MAIN", common.showAppMenuSuccess, { nil })
runner.Step("Set HMI SystemContext to MENU", common.changeHMISystemContext, { "MENU" })
runner.Step("Show app menu, HMI SystemContext MENU", common.showAppMenuSuccess, { nil })

runner.Title("Postconditions")
runner.Step("Stop SDL", common.postconditions)
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---------------------------------------------------------------------------------------------------
-- Proposal:
-- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0116-open-menu.md
-- Description:
-- In case:
-- 1) Mobile application is set to appropriate HMI level and System Context MAIN, MENU
-- 2) Mobile sends ShowAppMenu request with menuID = 5 parameter to SDL
-- 3) SDL sends ShowAppMenu request without menuID parameter to HMI
-- 4) HMI sends ShowAppMenu response with resultCode = SUCCESS to SDL
-- SDL does:
-- 1) not send ShowAppMenu request to HMI
-- 2) send ShowAppMenu response to mobile with parameters "success" = false, resultCode = INVALID_ID
---------------------------------------------------------------------------------------------------
-- [[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local common = require('test_scripts/API/OpenMenuRPC/commonOpenMenuRPC')

-- [[ Test Configuration ]]
runner.testSettings.isSelfIncluded = false
config.application1.registerAppInterfaceParams.appHMIType = { "PROJECTION" }

--[[ Local Variables ]]
local resultCode = "INVALID_ID"

--[[ 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.registerApp)

runner.Title("Test")
runner.Step("App activate, HMI SystemContext MAIN", common.activateApp)
runner.Step("Send show app menu, HMI SystemContext MAIN", common.showAppMenuUnsuccess, { 5, resultCode })
runner.Step("Set HMI SystemContext to MENU", common.changeHMISystemContext, { "MENU" })
runner.Step("Send show app menu, HMI SystemContext MENU", common.showAppMenuUnsuccess, { 5, resultCode })

runner.Title("Postconditions")
runner.Step("Stop SDL", common.postconditions)
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---------------------------------------------------------------------------------------------------
-- Proposal:
-- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0116-open-menu.md
-- Description:
-- In case:
-- 1) Mobile application is set to appropriate HMI level and System Context MAIN
-- 2) ShowAppMenu RPC is not allowed by policy
-- 3) Mobile sends ShowAppMenu request without menuID parameter to SDL
-- SDL does:
-- 1) not send ShowAppMenu request to HMI
-- 2) send ShowAppMenu response with resultCode = DISALLOWED to mobile
---------------------------------------------------------------------------------------------------
-- [[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local common = require('test_scripts/API/OpenMenuRPC/commonOpenMenuRPC')

-- [[ Test Configuration ]]
runner.testSettings.isSelfIncluded = false
config.application1.registerAppInterfaceParams.appHMIType = { "PROJECTION" }

--[[ Local Variables ]]
local resultCode = "DISALLOWED"

--[[ 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.registerApp)
runner.Step("PTU", common.policyTableUpdate, { common.pTUpdateFunc })

runner.Title("Test")
runner.Step("Send show App menu, NONE level", common.showAppMenuUnsuccess, { nil, resultCode })
runner.Step("App activate", common.activateApp)
runner.Step("Send show App menu, FULL level", common.showAppMenuUnsuccess, { nil, resultCode })
runner.Step("Set HMI Level to Limited", common.hmiLeveltoLimited, { 1, "MAIN" })
runner.Step("Send show App menu, LIMITED level", common.showAppMenuUnsuccess, { nil, resultCode })
runner.Step("Set HMI Level to BACKGROUND", common.deactivateAppToBackground)
runner.Step("Send show app menu, BACKGROUND level", common.showAppMenuUnsuccess, { nil, resultCode })

runner.Title("Postconditions")
runner.Step("Stop SDL", common.postconditions)
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---------------------------------------------------------------------------------------------------
-- Proposal:
-- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0116-open-menu.md
-- Description:
-- In case:
-- 1) Mobile application is set to appropriate HMI level and System Context VRSESSION
-- 2) ShowAppMenu RPC is not allowed by policy
-- 3) Mobile sends ShowAppMenu request without menuID parameter to SDL
-- SDL does:
-- 1) not send ShowAppMenu request to HMI
-- 2) send ShowAppMenu response with resultCode = DISALLOWED to mobile
---------------------------------------------------------------------------------------------------
-- [[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local common = require('test_scripts/API/OpenMenuRPC/commonOpenMenuRPC')

-- [[ Test Configuration ]]
runner.testSettings.isSelfIncluded = false
config.application1.registerAppInterfaceParams.appHMIType = { "PROJECTION" }

--[[ Local Variables ]]
local resultCode = "DISALLOWED"

--[[ 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.registerApp)
runner.Step("PTU", common.policyTableUpdate, { common.pTUpdateFunc })

runner.Title("Test")
runner.Step("App activate, HMI SystemContext MAIN", common.activateApp)
runner.Step("Set HMI SystemContext to VRSESSION" , common.changeHMISystemContext, { "VRSESSION" })
runner.Step("Set HMI Level to Limited", common.hmiLeveltoLimited, { 1, "VRSESSION" })
runner.Step("Send show App menu, Limited level", common.showAppMenuUnsuccess, { nil, resultCode })
runner.Step("Set HMI Level to BACKGROUND", common.deactivateAppToBackground, { "VRSESSION" })
runner.Step("Send show app menu, BACKGROUND level", common.showAppMenuUnsuccess, { nil, resultCode })

runner.Title("Postconditions")
runner.Step("Stop SDL", common.postconditions)
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---------------------------------------------------------------------------------------------------
-- Proposal:
-- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0116-open-menu.md
-- Description:
-- In case:
-- 1) Mobile application is set to appropriate HMI level and System Context MENU
-- 2) ShowAppMenu RPC is not allowed by policy
-- 3) Mobile sends ShowAppMenu request without menuID parameter to SDL
-- SDL does:
-- 1) not send ShowAppMenu request to HMI
-- 2) send ShowAppMenu response with resultCode = DISALLOWED to mobile
---------------------------------------------------------------------------------------------------
-- [[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local common = require('test_scripts/API/OpenMenuRPC/commonOpenMenuRPC')

-- [[ Test Configuration ]]
runner.testSettings.isSelfIncluded = false
config.application1.registerAppInterfaceParams.appHMIType = { "PROJECTION" }

--[[ Local Variables ]]
local resultCode = "DISALLOWED"

--[[ 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.registerApp)
runner.Step("PTU", common.policyTableUpdate, { common.pTUpdateFunc })

runner.Title("Test")
runner.Step("App activate, HMI SystemContext MAIN", common.activateApp)
runner.Step("Set HMI SystemContext to MENU" , common.changeHMISystemContext, { "MENU" })
runner.Step("Set HMI Level to Limited", common.hmiLeveltoLimited, { 1, "MENU" })
runner.Step("Send show App menu, Limited level", common.showAppMenuUnsuccess, { nil, resultCode })

runner.Title("Postconditions")
runner.Step("Stop SDL", common.postconditions)
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---------------------------------------------------------------------------------------------------
-- Proposal:
-- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0116-open-menu.md
-- Description:
-- In case:
-- 1) Mobile application is set to appropriate HMI level and System Context HMI_OBSCURED
-- 2) ShowAppMenu RPC is not allowed by policy
-- 3) Mobile sends ShowAppMenu request without menuID parameter to SDL
-- SDL does:
-- 1) not send ShowAppMenu request to HMI
-- 2) send ShowAppMenu response with resultCode = DISALLOWED to mobile
---------------------------------------------------------------------------------------------------
-- [[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local common = require('test_scripts/API/OpenMenuRPC/commonOpenMenuRPC')

-- [[ Test Configuration ]]
runner.testSettings.isSelfIncluded = false
config.application1.registerAppInterfaceParams.appHMIType = { "PROJECTION" }

--[[ Local Variables ]]
local resultCode = "DISALLOWED"

--[[ 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.registerApp)
runner.Step("PTU", common.policyTableUpdate, { common.pTUpdateFunc })

runner.Title("Test")
runner.Step("App activate, HMI SystemContext MAIN", common.activateApp)
runner.Step("Set HMI SystemContext to HMI_OBSCURED" , common.changeHMISystemContext, { "HMI_OBSCURED" })
runner.Step("Set HMI Level to Limited", common.hmiLeveltoLimited, { 1, "HMI_OBSCURED" })
runner.Step("Send show App menu, Limited level", common.showAppMenuUnsuccess, { nil, resultCode })
runner.Step("Set HMI Level to BACKGROUND", common.deactivateAppToBackground, { "HMI_OBSCURED" })
runner.Step("Send show app menu, BACKGROUND level", common.showAppMenuUnsuccess, { nil, resultCode })

runner.Title("Postconditions")
runner.Step("Stop SDL", common.postconditions)
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---------------------------------------------------------------------------------------------------
-- Proposal:
-- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0116-open-menu.md
-- Description:
-- In case:
-- 1) Mobile application is set to appropriate HMI level and System Context ALERT
-- 2) ShowAppMenu RPC is not allowed by policy
-- 3) Mobile sends ShowAppMenu request without menuID parameter to SDL
-- SDL does:
-- 1) not send ShowAppMenu request to HMI
-- 2) send ShowAppMenu response with resultCode = DISALLOWED to mobile
---------------------------------------------------------------------------------------------------
-- [[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local common = require('test_scripts/API/OpenMenuRPC/commonOpenMenuRPC')

-- [[ Test Configuration ]]
runner.testSettings.isSelfIncluded = false
config.application1.registerAppInterfaceParams.appHMIType = { "PROJECTION" }

--[[ Local Variables ]]
local resultCode = "DISALLOWED"

--[[ Local Function ]]
local function pTUpdateFunc(pTbl)
pTbl.policy_table.functional_groupings["Base-4"].rpcs.ShowAppMenu = nil
pTbl.policy_table.functional_groupings["Base-4"].rpcs["Alert"].hmi_levels = {
"FULL",
"BACKGROUND",
"LIMITED"
}
pTbl.policy_table.module_config.notifications_per_minute_by_priority.NONE = 10
end

local function sendAlertSuccess()
local cid = common.getMobileSession():SendRPC("Alert", {
alertText1 = "a",
alertText2 = "1",
alertText3 = "_",
duration = 6000
})
common.getHMIConnection():ExpectRequest("UI.Alert", {
alertStrings = {
{fieldName = "alertText1", fieldText = "a"},
{fieldName = "alertText2", fieldText = "1"},
{fieldName = "alertText3", fieldText = "_"}
}
})
:Do(function(_,data)
common.showAppMenuUnsuccess(nil, resultCode)
local function alertResponse()
common.getHMIConnection():SendResponse(data.id, "UI.Alert", "SUCCESS", { })
end
RUN_AFTER(alertResponse, 2000)
end)
common.getMobileSession():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("App registration", common.registerApp)
runner.Step("PTU", common.policyTableUpdate, { pTUpdateFunc })
runner.Step("App activate", common.activateApp)

runner.Title("Test")
runner.Step("Set HMI Level to Limited", common.hmiLeveltoLimited, { 1, "MAIN" })
runner.Step("Send show App menu, SystemContext ALERT", sendAlertSuccess)
runner.Step("Set HMI Level to BACKGROUND", common.deactivateAppToBackground)
runner.Step("Send show App menu, SystemContext ALERT", sendAlertSuccess)

runner.Title("Postconditions")
runner.Step("Stop SDL", common.postconditions)
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---------------------------------------------------------------------------------------------------
-- Proposal:
-- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0116-open-menu.md
-- Description:
-- In case:
-- 1) Mobile application is set to FULL HMI level and System Context MAIN
-- 2) Mobile sends ShowAppMenu request to SDL
-- 3) SDL sends ShowAppMenu request to HMI
-- 4) HMI doesn't send ShowAppMenu response to SDL (timeout expired)
-- SDL does:
-- 1) send ShowAppMenu response to mobile with parameters "success" = false, resultCode = GENERIC_ERROR
---------------------------------------------------------------------------------------------------
-- [[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local common = require('test_scripts/API/OpenMenuRPC/commonOpenMenuRPC')

-- [[ Test Configuration ]]
runner.testSettings.isSelfIncluded = false
config.application1.registerAppInterfaceParams.appHMIType = { "PROJECTION" }

--[[ 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.registerApp)
runner.Step("App activate, HMI SystemContext MAIN", common.activateApp)

runner.Title("Test")
runner.Step("Send show app menu", common.showAppMenuHMIwithoutResponse, { nil })

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

0 comments on commit a65f24d

Please sign in to comment.