Skip to content

Commit

Permalink
Initial scripts for SDL Passenger Mode feature
Browse files Browse the repository at this point in the history
  • Loading branch information
dboltovskyi committed Dec 18, 2018
1 parent 5a103d0 commit f6589a4
Show file tree
Hide file tree
Showing 10 changed files with 488 additions and 0 deletions.
40 changes: 40 additions & 0 deletions test_scripts/API/SDL_Passenger_Mode/001_OnDD_PT_true.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---------------------------------------------------------------------------------------------------
-- Proposal: https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0119-SDL-passenger-mode.md
-- Description:
-- In case:
-- 1) OnDriverDistraction notification is allowed by Policy for (FULL, LIMITED, BACKGROUND, NONE) HMILevel
-- 2) In Policy "lock_screen_dismissal_enabled" parameter is defined with correct value (true)
-- 3) App registered (HMI level NONE)
-- 4) HMI sends OnDriverDistraction notification with all mandatory fields
-- SDL does:
-- 1) Send OnDriverDistraction notification to mobile with "lockScreenDismissalEnabled" parameter
-- (value corresponds to the one defined in Policy) and all mandatory fields
--
-- Note: Cover all HMI levels
---------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local common = require('test_scripts/API/SDL_Passenger_Mode/commonPassengerMode')

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

--[[ Local Variables ]]
local lockScreenDismissalEnabled = true

--[[ Scenario ]]
runner.Title("Preconditions")
runner.Step("Clean environment", common.preconditions)
runner.Step("Set LockScreenDismissalEnabled", common.updatePreloadedPT, { lockScreenDismissalEnabled })
runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start)
runner.Step("Register App", common.registerApp)

runner.Title("Test")

for _, level in common.pairs(common.hmiLevel) do
runner.Step("Switch app's HMI level to " .. level.name, level.func)
runner.Step("OnDriverDistraction ON/OFF true", common.onDriverDistraction, { lockScreenDismissalEnabled })
end

runner.Title("Postconditions")
runner.Step("Stop SDL", common.postconditions)
40 changes: 40 additions & 0 deletions test_scripts/API/SDL_Passenger_Mode/002_OnDD_PT_false.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---------------------------------------------------------------------------------------------------
-- Proposal: https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0119-SDL-passenger-mode.md
-- Description:
-- In case:
-- 1) OnDriverDistraction notification is allowed by Policy for (FULL, LIMITED, BACKGROUND, NONE) HMILevel
-- 2) In Policy "lock_screen_dismissal_enabled" parameter is defined with correct value (false)
-- 3) App registered (HMI level NONE)
-- 4) HMI sends OnDriverDistraction notification with all mandatory fields
-- SDL does:
-- 1) Send OnDriverDistraction notification to mobile with "lockScreenDismissalEnabled" parameter
-- (value corresponds to the one defined in Policy) and all mandatory fields
--
-- Note: Cover all HMI levels
---------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local common = require('test_scripts/API/SDL_Passenger_Mode/commonPassengerMode')

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

--[[ Local Variables ]]
local lockScreenDismissalEnabled = false

--[[ Scenario ]]
runner.Title("Preconditions")
runner.Step("Clean environment", common.preconditions)
runner.Step("Set LockScreenDismissalEnabled", common.updatePreloadedPT, { lockScreenDismissalEnabled })
runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start)
runner.Step("Register App", common.registerApp)

runner.Title("Test")

for _, level in common.pairs(common.hmiLevel) do
runner.Step("Switch app's HMI level to " .. level.name, level.func)
runner.Step("OnDriverDistraction ON/OFF false", common.onDriverDistraction, { lockScreenDismissalEnabled })
end

runner.Title("Postconditions")
runner.Step("Stop SDL", common.postconditions)
40 changes: 40 additions & 0 deletions test_scripts/API/SDL_Passenger_Mode/003_OnDD_PT_missing.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---------------------------------------------------------------------------------------------------
-- Proposal: https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0119-SDL-passenger-mode.md
-- Description:
-- In case:
-- 1) OnDriverDistraction notification is allowed by Policy for (FULL, LIMITED, BACKGROUND, NONE) HMILevel
-- 2) In Policy "lock_screen_dismissal_enabled" parameter is missing
-- 3) App registered (HMI level NONE)
-- 4) HMI sends OnDriverDistraction notification with all mandatory fields
-- SDL does:
-- 1) Send OnDriverDistraction notification to mobile without "lockScreenDismissalEnabled" parameter,
-- but with all mandatory fields
--
-- Note: Cover all HMI levels
---------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local common = require('test_scripts/API/SDL_Passenger_Mode/commonPassengerMode')

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

--[[ Local Variables ]]
local lockScreenDismissalEnabled = nil

--[[ Scenario ]]
runner.Title("Preconditions")
runner.Step("Clean environment", common.preconditions)
runner.Step("Set LockScreenDismissalEnabled", common.updatePreloadedPT, { lockScreenDismissalEnabled })
runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start)
runner.Step("Register App", common.registerApp)

runner.Title("Test")

for _, level in common.pairs(common.hmiLevel) do
runner.Step("Switch app's HMI level to " .. level.name, level.func)
runner.Step("OnDriverDistraction ON/OFF missing", common.onDriverDistraction, { lockScreenDismissalEnabled })
end

runner.Title("Postconditions")
runner.Step("Stop SDL", common.postconditions)
43 changes: 43 additions & 0 deletions test_scripts/API/SDL_Passenger_Mode/004_OnDD_PTU_true.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---------------------------------------------------------------------------------------------------
-- Proposal: https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0119-SDL-passenger-mode.md
-- Description:
-- In case:
-- 1) OnDriverDistraction notification is allowed by Policy for (FULL, LIMITED, BACKGROUND, NONE) HMILevel
-- 2) In Policy "lock_screen_dismissal_enabled" parameter is missing
-- 3) App registered (HMI level NONE)
-- 4) HMI sends OnDriverDistraction notification with all mandatory fields
-- 5) Policy Table update ("lock_screen_dismissal_enabled" = true)
-- 6) HMI sends OnDriverDistraction notification with all mandatory fields
-- SDL does:
-- 1) Send OnDriverDistraction notification to mobile without "lockScreenDismissalEnabled" before PTU
-- 2) Send OnDriverDistraction notification to mobile with "lockScreenDismissalEnabled"=true after PTU
---------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local common = require('test_scripts/API/SDL_Passenger_Mode/commonPassengerMode')

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

--[[ Local Variables ]]
local lockScreenDismissalEnabled = true

--[[ Local Functions ]]
local function ptUpdate(pPT)
pPT.policy_table.module_config.lock_screen_dismissal_enabled = lockScreenDismissalEnabled
end

--[[ Scenario ]]
runner.Title("Preconditions")
runner.Step("Clean environment", common.preconditions)
runner.Step("Set LockScreenDismissalEnabled", common.updatePreloadedPT, { nil })
runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start)
runner.Step("Register App", common.registerApp)

runner.Title("Test")
runner.Step("OnDriverDistraction ON/OFF missing", common.onDriverDistraction, { nil })
runner.Step("Policy Table Update", common.policyTableUpdate, { ptUpdate })
runner.Step("OnDriverDistraction ON/OFF true", common.onDriverDistraction, { lockScreenDismissalEnabled })

runner.Title("Postconditions")
runner.Step("Stop SDL", common.postconditions)
43 changes: 43 additions & 0 deletions test_scripts/API/SDL_Passenger_Mode/005_OnDD_PTU_false.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---------------------------------------------------------------------------------------------------
-- Proposal: https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0119-SDL-passenger-mode.md
-- Description:
-- In case:
-- 1) OnDriverDistraction notification is allowed by Policy for (FULL, LIMITED, BACKGROUND, NONE) HMILevel
-- 2) In Policy "lock_screen_dismissal_enabled" parameter is missing
-- 3) App registered (HMI level NONE)
-- 4) HMI sends OnDriverDistraction notification with all mandatory fields
-- 5) Policy Table update ("lock_screen_dismissal_enabled" = false)
-- 6) HMI sends OnDriverDistraction notification with all mandatory fields
-- SDL does:
-- 1) Send OnDriverDistraction notification to mobile without "lockScreenDismissalEnabled" before PTU
-- 2) Send OnDriverDistraction notification to mobile with "lockScreenDismissalEnabled"=false after PTU
---------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local common = require('test_scripts/API/SDL_Passenger_Mode/commonPassengerMode')

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

--[[ Local Variables ]]
local lockScreenDismissalEnabled = false

--[[ Local Functions ]]
local function ptUpdate(pPT)
pPT.policy_table.module_config.lock_screen_dismissal_enabled = lockScreenDismissalEnabled
end

--[[ Scenario ]]
runner.Title("Preconditions")
runner.Step("Clean environment", common.preconditions)
runner.Step("Set LockScreenDismissalEnabled", common.updatePreloadedPT, { nil })
runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start)
runner.Step("Register App", common.registerApp)

runner.Title("Test")
runner.Step("OnDriverDistraction ON/OFF missing", common.onDriverDistraction, { nil })
runner.Step("Policy Table Update", common.policyTableUpdate, { ptUpdate })
runner.Step("OnDriverDistraction ON/OFF false", common.onDriverDistraction, { lockScreenDismissalEnabled })

runner.Title("Postconditions")
runner.Step("Stop SDL", common.postconditions)
43 changes: 43 additions & 0 deletions test_scripts/API/SDL_Passenger_Mode/006_OnDD_PTU_missing.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---------------------------------------------------------------------------------------------------
-- Proposal: https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0119-SDL-passenger-mode.md
-- Description:
-- In case:
-- 1) OnDriverDistraction notification is allowed by Policy for (FULL, LIMITED, BACKGROUND, NONE) HMILevel
-- 2) In Policy "lock_screen_dismissal_enabled" parameter is missing
-- 3) App registered (HMI level NONE)
-- 4) HMI sends OnDriverDistraction notification with all mandatory fields
-- 5) Policy Table update ("lock_screen_dismissal_enabled" = false)
-- 6) HMI sends OnDriverDistraction notification with all mandatory fields
-- SDL does:
-- 1) Send OnDriverDistraction notification to mobile without "lockScreenDismissalEnabled" before PTU
-- 2) Send OnDriverDistraction notification to mobile with "lockScreenDismissalEnabled"=false after PTU
---------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local common = require('test_scripts/API/SDL_Passenger_Mode/commonPassengerMode')

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

--[[ Local Variables ]]
local lockScreenDismissalEnabled = nil

--[[ Local Functions ]]
local function ptUpdate(pPT)
pPT.policy_table.module_config.lock_screen_dismissal_enabled = lockScreenDismissalEnabled
end

--[[ Scenario ]]
runner.Title("Preconditions")
runner.Step("Clean environment", common.preconditions)
runner.Step("Set LockScreenDismissalEnabled", common.updatePreloadedPT, { true })
runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start)
runner.Step("Register App", common.registerApp)

runner.Title("Test")
runner.Step("OnDriverDistraction ON/OFF true", common.onDriverDistraction, { true })
runner.Step("Policy Table Update", common.policyTableUpdate, { ptUpdate })
runner.Step("OnDriverDistraction ON/OFF missing", common.onDriverDistraction, { lockScreenDismissalEnabled })

runner.Title("Postconditions")
runner.Step("Stop SDL", common.postconditions)
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---------------------------------------------------------------------------------------------------
-- Proposal: https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0119-SDL-passenger-mode.md
-- Description:
-- In case:
-- 1) OnDriverDistraction notification is allowed by Policy for (FULL, LIMITED, BACKGROUND) HMILevel
-- 2) In Policy "lock_screen_dismissal_enabled" parameter is defined with "true" value
-- 3) App registered (HMI level NONE)
-- 4) HMI sends OnDriverDistraction notification with all mandatory fields (state = "DD_OFF")
-- 5) App activated (HMI level FULL)
-- 6) HMI sends OnDriverDistraction notification with all mandatory fields
-- SDL does:
-- 1) Not send OnDriverDistraction notification to mobile when (HMI level NONE)
-- 2) Send OnDriverDistraction notification to mobile once app is activated
-- 3) Send OnDriverDistraction notification to mobile with "lockScreenDismissalEnabled"=true once HMI sends it to SDL
-- when app is in FULL
---------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local common = require('test_scripts/API/SDL_Passenger_Mode/commonPassengerMode')

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

--[[ Local Variables ]]
local lockScreenDismissalEnabled = true

--[[ Local Functions ]]
local function updatePreloadedPT()
local function updatePT(pPT)
pPT.policy_table.functional_groupings["Base-4"].rpcs.OnDriverDistraction.hmi_levels = { "FULL" }
end
common.updatePreloadedPT(lockScreenDismissalEnabled, updatePT)
end

local function registerApp()
common.registerAppWOPTU()
common.getMobileSession():ExpectNotification("OnDriverDistraction")
:Times(0)
end

local function onDriverDistractionUnsuccess()
common.getHMIConnection():SendNotification("UI.OnDriverDistraction", { state = "DD_OFF" })
common.getMobileSession():ExpectNotification("OnDriverDistraction")
:Times(0)
end

local function activateApp()
common.activateApp()
common.getMobileSession():ExpectNotification("OnDriverDistraction",
{ state = "DD_OFF" })
end

--[[ Scenario ]]
runner.Title("Preconditions")
runner.Step("Clean environment", common.preconditions)
runner.Step("Set LockScreenDismissalEnabled", updatePreloadedPT, { lockScreenDismissalEnabled })
runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start)
runner.Step("App registration HMI level NONE", registerApp)

runner.Title("Test")
runner.Step("OnDriverDistraction OFF not transfered", onDriverDistractionUnsuccess)
runner.Step("App activation HMI level FULL", activateApp)
runner.Step("OnDriverDistraction OFF true", common.onDriverDistraction, { lockScreenDismissalEnabled })

runner.Title("Postconditions")
runner.Step("Stop SDL", common.postconditions)
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---------------------------------------------------------------------------------------------------
-- Proposal: https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0119-SDL-passenger-mode.md
-- Description:
-- In case:
-- 1) OnDriverDistraction notification is allowed by Policy for (FULL, LIMITED, BACKGROUND) HMILevel
-- 2) In Policy "lock_screen_dismissal_enabled" parameter is defined with "true" value
-- 3) App registered (HMI level NONE)
-- 4) HMI sends OnDriverDistraction notification with all mandatory fields (state = "DD_ON")
-- 5) App activated (HMI level FULL)
-- 6) HMI sends OnDriverDistraction notification with all mandatory fields
-- SDL does:
-- 1) Not send OnDriverDistraction notification to mobile when (HMI level NONE)
-- 2) Send OnDriverDistraction notification to mobile with "lockScreenDismissalEnabled"=true once app is activated
-- 3) Send OnDriverDistraction notification to mobile with "lockScreenDismissalEnabled"=true once HMI sends it to SDL
-- when app is in FULL
---------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local common = require('test_scripts/API/SDL_Passenger_Mode/commonPassengerMode')

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

--[[ Local Variables ]]
local lockScreenDismissalEnabled = true

--[[ Local Functions ]]
local function updatePreloadedPT()
local function updatePT(pPT)
pPT.policy_table.functional_groupings["Base-4"].rpcs.OnDriverDistraction.hmi_levels = { "FULL" }
end
common.updatePreloadedPT(lockScreenDismissalEnabled, updatePT)
end

local function registerApp()
common.registerAppWOPTU()
common.getMobileSession():ExpectNotification("OnDriverDistraction")
:Times(0)
end

local function onDriverDistractionUnsuccess()
common.getHMIConnection():SendNotification("UI.OnDriverDistraction", { state = "DD_ON" })
common.getMobileSession():ExpectNotification("OnDriverDistraction")
:Times(0)
end

local function activateApp()
common.activateApp()
common.getMobileSession():ExpectNotification("OnDriverDistraction",
{ state = "DD_ON", lockScreenDismissalEnabled = lockScreenDismissalEnabled })
end

--[[ Scenario ]]
runner.Title("Preconditions")
runner.Step("Clean environment", common.preconditions)
runner.Step("Set LockScreenDismissalEnabled", updatePreloadedPT, { lockScreenDismissalEnabled })
runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start)
runner.Step("App registration HMI level NONE", registerApp)

runner.Title("Test")
runner.Step("OnDriverDistraction ON not transfered", onDriverDistractionUnsuccess)
runner.Step("App activation HMI level FULL", activateApp)
runner.Step("OnDriverDistraction ON true", common.onDriverDistraction, { lockScreenDismissalEnabled })

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

0 comments on commit f6589a4

Please sign in to comment.