Skip to content

Commit

Permalink
Initial scripts for Open Menu RPC
Browse files Browse the repository at this point in the history
  • Loading branch information
Myza Taras committed Dec 4, 2018
1 parent c3bb85f commit f752668
Show file tree
Hide file tree
Showing 14 changed files with 630 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.Step("App activate", common.activateApp)

runner.Title("Test")
runner.Step("Add menu", common.addSubMenu, { 5 })
runner.Step("Send show app menu", 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.Step("App activate", common.activateApp)

runner.Title("Test")
runner.Step("Send show app menu", 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 resulCode = "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.Step("App activate", common.activateApp)

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

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 resulCode = "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, resulCode })
runner.Step("App activate", common.activateApp)
runner.Step("Send show App menu, FULL level", common.showAppMenuUnsuccess, { nil, resulCode })
runner.Step("Set HMI Level to Limited", common.hmiLeveltoLimited, { 1, "MAIN" })
runner.Step("Send show App menu, LIMITED level", common.showAppMenuUnsuccess, { nil, resulCode })
runner.Step("Set HMI Level to BACKGROUND", common.deactivateAppToBackground)
runner.Step("Send show app menu, BACKGROUND level", common.showAppMenuUnsuccess, { nil, resulCode })

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 resulCode = "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", 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, resulCode })
runner.Step("Set HMI Level to BACKGROUND", common.deactivateAppToBackground, { "VRSESSION" })
runner.Step("Send show app menu, BACKGROUND level", common.showAppMenuUnsuccess, { nil, resulCode })

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 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 resulCode = "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", 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, resulCode })
runner.Step("Set HMI Level to BACKGROUND", common.deactivateAppToBackground, { "MENU" })
runner.Step("Send show app menu, BACKGROUND level", common.showAppMenuUnsuccess, { nil, resulCode })

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 resulCode = "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", 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, resulCode })
runner.Step("Set HMI Level to BACKGROUND", common.deactivateAppToBackground, { "HMI_OBSCURED" })
runner.Step("Send show app menu, BACKGROUND level", common.showAppMenuUnsuccess, { nil, resulCode })

runner.Title("Postconditions")
runner.Step("Stop SDL", common.postconditions)
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---------------------------------------------------------------------------------------------------
-- 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 resulCode = "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"
}
end

local function sendAlertSuccess()
common.getMobileSession():SendRPC("Alert", {
alertText1 = "a",
alertText2 = "1",
alertText3 = "_",
ttsChunks = {
{
text = "TTSChunk",
type = "TEXT"
}
},
duration = 6000
})
local AlertId
EXPECT_HMICALL("UI.Alert", {
alertStrings =
{
{fieldName = "alertText1", fieldText = "a"},
{fieldName = "alertText2", fieldText = "1"},
{fieldName = "alertText3", fieldText = "_"}
},
})
:Do(function(_,data)
common.showAppMenuUnsuccess(nil, resulCode)
AlertId = data.id
end)
common.getHMIConnection():SendResponse(AlertId, "UI.Alert", "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("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 appropriate HMI level and System Context (see table)
-- 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", 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 f752668

Please sign in to comment.