Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SDL 0238] Scripts for Keyboard Enhancements feature #2500

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
----------------------------------------------------------------------------------------------------
-- Proposal:
-- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0238-Keyboard-Enhancements.md
----------------------------------------------------------------------------------------------------
-- Description: Check SDL is able to receive 'KeyboardCapabilities' from HMI and transfer them to App
-- in case all parameters are defined with valid values
--
-- Steps:
-- 1. App is registered
-- 2. HMI provides 'KeyboardCapabilities' within 'OnSystemCapabilityUpdated' notification
-- 3. App requests 'DISPLAYS' system capabilities through 'GetSystemCapability'
-- SDL does:
-- - Provide 'KeyboardCapabilities' to App
----------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local common = require('test_scripts/API/KeyboardEnhancements/common')

--[[ 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.Title("Test")
common.Step("HMI sends OnSystemCapabilityUpdated", common.sendOnSystemCapabilityUpdated)
common.Step("App sends GetSystemCapability", common.sendGetSystemCapability)

common.Title("Postconditions")
common.Step("Stop SDL", common.postconditions)
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
----------------------------------------------------------------------------------------------------
-- Proposal:
-- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0238-Keyboard-Enhancements.md
----------------------------------------------------------------------------------------------------
-- Description: Check SDL is able to receive 'KeyboardCapabilities' from HMI and transfer them to App
-- in case one parameter is defined with valid values (edge scenarios)
--
-- Steps:
-- 1. App is registered
-- 2. HMI provides 'KeyboardCapabilities' within 'OnSystemCapabilityUpdated' notification
-- 3. App requests 'DISPLAYS' system capabilities through 'GetSystemCapability'
-- SDL does:
-- - Provide 'KeyboardCapabilities' to App
----------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local common = require('test_scripts/API/KeyboardEnhancements/common')

--[[ Local Variables ]]
local tcs = {
[01] = { maskInputCharactersSupported = false },
[02] = { maskInputCharactersSupported = true },
[03] = { supportedKeyboards = common.getArrayValue({ { keyboardLayout = "QWERTY", numConfigurableKeys = 1 }}, 1) },
[04] = { supportedKeyboards = common.getArrayValue({ { keyboardLayout = "QWERTY", numConfigurableKeys = 0 }}, 5) },
[05] = { supportedKeyboards = common.getArrayValue({ { keyboardLayout = "QWERTY", numConfigurableKeys = 5 }}, 1000) },
[06] = { supportedKeyboards = common.getArrayValue({ { keyboardLayout = "QWERTY", numConfigurableKeys = 10 }}, 5) }
}

--[[ Local Functions ]]
local function getDispCaps(pTC)
local dispCaps = common.getDispCaps()
dispCaps.systemCapability.displayCapabilities[1].windowCapabilities[1].keyboardCapabilities = pTC
return dispCaps
end

--[[ 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.Title("Test")
for tc, data in common.spairs(tcs) do
common.Title("TC[" .. string.format("%03d", tc) .. "]")
local dispCaps = getDispCaps(data)
common.Step("HMI sends OnSystemCapabilityUpdated", common.sendOnSystemCapabilityUpdated, { dispCaps })
common.Step("App sends GetSystemCapability", common.sendGetSystemCapability, { dispCaps })
end

common.Title("Postconditions")
common.Step("Stop SDL", common.postconditions)
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
----------------------------------------------------------------------------------------------------
-- Proposal:
-- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0238-Keyboard-Enhancements.md
----------------------------------------------------------------------------------------------------
-- Description: Check SDL is still able to receive 'WindowCapabilities' from HMI without 'KeyboardCapabilities'
-- and transfer them to App
--
-- Steps:
-- 1. App is registered
-- 2. HMI provides 'WindowCapabilities' without 'KeyboardCapabilities' within 'OnSystemCapabilityUpdated' notification
-- 3. App requests 'DISPLAYS' system capabilities through 'GetSystemCapability'
-- SDL does:
-- - Provide 'WindowCapabilities' without 'KeyboardCapabilities' to App
----------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local common = require('test_scripts/API/KeyboardEnhancements/common')

--[[ Local Variables ]]
local dispCaps = common.getDispCaps()
dispCaps.systemCapability.displayCapabilities[1].windowCapabilities[1].keyboardCapabilities = nil

--[[ Local Functions ]]
local function check(_, data)
if data.payload.systemCapability.displayCapabilities[1].windowCapabilities[1].keyboardCapabilities ~= nil then
return false, "Unexpected 'keyboardCapabilities' parameter received"
end
return true
end

--[[ 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.Title("Test")
common.Step("HMI sends OnSystemCapabilityUpdated", common.sendOnSystemCapabilityUpdated,
{ dispCaps, common.expected.yes, check })
common.Step("App sends GetSystemCapability", common.sendGetSystemCapability, { dispCaps, common.result.success, check })

common.Title("Postconditions")
common.Step("Stop SDL", common.postconditions)
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
----------------------------------------------------------------------------------------------------
-- Proposal:
-- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0238-Keyboard-Enhancements.md
----------------------------------------------------------------------------------------------------
-- Description: Check SDL is unable to provide 'WindowCapabilities' to App
-- in case if HMI has not sent 'OnSystemCapabilityUpdated' notification
--
-- Steps:
-- 1. App is registered
-- 2. HMI doesn't send 'OnSystemCapabilityUpdated' notification with 'WindowCapabilities'
-- 3. App requests 'DISPLAYS' system capabilities through 'GetSystemCapability'
-- SDL does:
-- - Respond with DATA_NOT_AVAILABLE, success:false to App
----------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local common = require('test_scripts/API/KeyboardEnhancements/common')

--[[ Local Functions ]]
local function check(_, data)
if data.payload.systemCapability ~= nil then
return false, "Unexpected 'systemCapability' parameter received"
end
return true
end

--[[ 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.Title("Test")
common.Step("App sends GetSystemCapability", common.sendGetSystemCapability,
{ { }, common.result.data_not_available, check })

common.Title("Postconditions")
common.Step("Stop SDL", common.postconditions)
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
----------------------------------------------------------------------------------------------------
-- Proposal:
-- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0238-Keyboard-Enhancements.md
----------------------------------------------------------------------------------------------------
-- Description: Check SDL is unable to provide 'WindowCapabilities' to App
-- in case if HMI has sent 'OnSystemCapabilityUpdated' notification with invalid data
--
-- Steps:
-- 1. App is registered
-- 2. HMI provides 'KeyboardCapabilities' with invalid data within 'OnSystemCapabilityUpdated' notification
-- 3. App requests 'DISPLAYS' system capabilities through 'GetSystemCapability'
-- SDL does:
-- - Respond with DATA_NOT_AVAILABLE, success:false to App
----------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local common = require('test_scripts/API/KeyboardEnhancements/common')

--[[ Local Variables ]]
local tcs = {
[01] = { maskInputCharactersSupported = "false" }, --invalid type
[02] = { supportedKeyboards = { { keyboardLayout = "QWERTY", numConfigurableKeys = "0" }} },
[03] = { supportedKeyboards = { { keyboardLayout = true, numConfigurableKeys = 0 }} },
[04] = { supportedKeyboards = { { } } },
[05] = { supportedKeyboards = { { keyboardLayout = "QWERTY", numConfigurableKeys = nil }} },
[06] = { supportedKeyboards = { { keyboardLayout = nil, numConfigurableKeys = 0 }} },
[07] = { supportedKeyboards = common.getArrayValue({ { keyboardLayout = "QWERTY", numConfigurableKeys = 0 }}, 1001) },
[08] = { supportedKeyboards = { { keyboardLayout = "QWERTY", numConfigurableKeys = 11 }} },
[09] = { supportedKeyboards = common.json.EMPTY_ARRAY }
}

--[[ Local Functions ]]
local function getDispCaps(pTC)
local dispCaps = common.getDispCaps()
dispCaps.systemCapability.displayCapabilities[1].windowCapabilities[1].keyboardCapabilities = pTC
return dispCaps
end

local function check(_, data)
if data.payload.systemCapability ~= nil then
return false, "Unexpected 'systemCapability' parameter received"
end
return true
end

--[[ 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.Title("Test")
for tc, data in common.spairs(tcs) do
common.Title("TC[" .. string.format("%03d", tc) .. "]")
local dispCaps = getDispCaps(data)
common.Step("HMI sends OnSystemCapabilityUpdated", common.sendOnSystemCapabilityUpdated,
{ dispCaps, common.expected.no })
common.Step("App sends GetSystemCapability", common.sendGetSystemCapability,
{ { }, common.result.data_not_available, check })
end

common.Title("Postconditions")
common.Step("Stop SDL", common.postconditions)
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
----------------------------------------------------------------------------------------------------
-- Proposal:
-- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0238-Keyboard-Enhancements.md
----------------------------------------------------------------------------------------------------
-- Description: Check SDL is able to transfer 'OnKeyboardInput' notification from HMI to App
-- with new values for 'event'
--
-- Steps:
-- 1. App is registered
-- 2. HMI provides 'KeyboardCapabilities' within 'OnSystemCapabilityUpdated' notification
-- 3. App sends 'SetGlobalProperties' with 'maskInputCharacters=USER_CHOICE_INPUT_KEY_MASK'
-- 4. HMI sends 'OnKeyboardInput' notification with specific values for 'event':
-- - INPUT_KEY_MASK_ENABLED
-- - INPUT_KEY_MASK_DISABLED
-- SDL does:
-- - Transfer 'OnKeyboardInput' notification to App
----------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local common = require('test_scripts/API/KeyboardEnhancements/common')

--[[ Local Variables ]]
local sgpParams = {
keyboardProperties = {
keyboardLayout = "NUMERIC",
maskInputCharacters = "USER_CHOICE_INPUT_KEY_MASK"
}
}

--[[ Local Functions ]]
local function ptUpd(pTbl)
pTbl.policy_table.app_policies[common.getPolicyAppId()].groups = { "Base-4", "OnKeyboardInputOnlyGroup" }
end

--[[ 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("PTU", common.policyTableUpdate, { ptUpd })
common.Step("Activate App", common.activateApp)

common.Title("Test")
common.Step("HMI sends OnSystemCapabilityUpdated", common.sendOnSystemCapabilityUpdated)
common.Step("App sends SetGlobalProperties", common.sendSetGlobalProperties, { sgpParams, common.result.success })
common.Step("HMI sends OnKeyboardInput", common.sendOnKeyboardInput, { { event = "INPUT_KEY_MASK_ENABLED" } })
common.Step("HMI sends OnKeyboardInput", common.sendOnKeyboardInput, { { event = "INPUT_KEY_MASK_DISABLED" } })

common.Title("Postconditions")
common.Step("Stop SDL", common.postconditions)
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
----------------------------------------------------------------------------------------------------
-- Proposal:
-- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0238-Keyboard-Enhancements.md
----------------------------------------------------------------------------------------------------
-- Description: Check App is able to reset previously defined 'KeyboardProperties' to default values
--
-- Steps:
-- 1. App is registered
-- 2. HMI provides 'KeyboardCapabilities' within 'OnSystemCapabilityUpdated' notification
-- 3. App sends 'SetGlobalProperties' with some non-default values for 'KeyboardProperties'
-- 4. App sends 'ResetGlobalProperties' for 'KEYBOARDPROPERTIES'
-- SDL does:
-- - Send default values for 'KeyboardProperties' to HMI within 'UI.SetGlobalProperties' request
-- - By receiving successful response from HMI transfer it to App
----------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local common = require('test_scripts/API/KeyboardEnhancements/common')

--[[ Local Variables ]]
local sgpParams = {
keyboardProperties = {
language = "EN-US",
keyboardLayout = "NUMERIC",
keypressMode = "SINGLE_KEYPRESS",
limitedCharacterList = { "a" },
autoCompleteList = { "Daemon, Freedom" },
maskInputCharacters = "DISABLE_INPUT_KEY_MASK",
customKeys = { "#" }
}
}

--[[ Local Functions ]]
local function sendResetGP()
local params = { properties = { "KEYBOARDPROPERTIES" } }
local dataToHMI = {
keyboardProperties = {
language = "EN-US",
keyboardLayout = "QWERTY",
autoCompleteList = common.json.EMPTY_ARRAY
},
appID = common.getHMIAppId()
}
local cid = common.getMobileSession():SendRPC("ResetGlobalProperties", params)
common.getHMIConnection():ExpectRequest("UI.SetGlobalProperties", dataToHMI)
:Do(function(_, data)
common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", {})
end)
:ValidIf(function(_, data)
if data.params.keyboardProperties.maskInputCharacters then
return false, "Unexpected 'maskInputCharacters' parameter received"
end
if data.params.keyboardProperties.customKeys then
return false, "Unexpected 'customKeys' parameter received"
end
return true
end)
common.getMobileSession():ExpectResponse(cid, { success = true, resultCode = "SUCCESS" })
end

--[[ 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.Title("Test")
common.Step("HMI sends OnSystemCapabilityUpdated", common.sendOnSystemCapabilityUpdated)
common.Step("App sends SetGlobalProperties", common.sendSetGlobalProperties, { sgpParams, common.result.success })
common.Step("App sends ResetGP", sendResetGP)

common.Title("Postconditions")
common.Step("Stop SDL", common.postconditions)
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
----------------------------------------------------------------------------------------------------
-- Proposal:
-- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0238-Keyboard-Enhancements.md
----------------------------------------------------------------------------------------------------
-- Description: Check SDL is able to resume previously defined by App 'KeyboardProperties' after
-- unexpected disconnect
--
-- Steps:
-- 1. App is registered
-- 2. HMI provides 'KeyboardCapabilities' within 'OnSystemCapabilityUpdated' notification
-- 3. App sends 'SetGlobalProperties' with some non-default values for 'KeyboardProperties'
-- 4. App unexpectedly disconnects and reconnects
-- SDL does:
-- - Start data resumption process
-- - Send the values defined by App for 'KeyboardProperties' to HMI within 'UI.SetGlobalProperties' request
----------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local common = require('test_scripts/API/KeyboardEnhancements/common')

--[[ Local Variables ]]
local sgpParams = {
keyboardProperties = {
language = "EN-US",
keyboardLayout = "AZERTY",
keypressMode = "SINGLE_KEYPRESS",
limitedCharacterList = { "a" },
autoCompleteList = { "Daemon, Freedom" },
maskInputCharacters = "DISABLE_INPUT_KEY_MASK",
customKeys = { "#", "$" }
}
}

--[[ 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.Title("Test")
common.Step("HMI sends OnSystemCapabilityUpdated", common.sendOnSystemCapabilityUpdated)
common.Step("App sends SetGlobalProperties", common.sendSetGlobalPropertiesWithHashId,
{ sgpParams, common.result.success })
common.Step("Unexpected disconnect", common.unexpectedDisconnect)
common.Step("Connect mobile", common.connectMobile)
common.Step("Re-register App", common.reRegisterApp, { sgpParams })

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