Skip to content

Commit

Permalink
SDL 0198 - Media Skip Indicators (#2513)
Browse files Browse the repository at this point in the history
* Add general SetMediaClockTimer test cases

* Move RPC-specific test sets to API folder

* Fix lua panics after changing common module

* Add test cases for media skip indicators feature

Co-authored-by: jacobkeeler <jacob.keeler@livioradio.com>
  • Loading branch information
ShobhitAd and jacobkeeler authored Jan 27, 2021
1 parent 915f889 commit d5edd84
Show file tree
Hide file tree
Showing 4 changed files with 180 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
---------------------------------------------------------------------------------------------------
-- User story: API
-- Use case: SetMediaClockTimer
-- Item: Happy path case, forward and back seek indicators
--
-- Requirement summary:
-- [SetMediaClockTimer] SUCCESS: getting SUCCESS:UI.SetMediaClockTimer()
--
-- Description:
-- Mobile application sends SetMediaClockTimer(COUNTDOWN) request with forwardSeekIndicator and backSeekIndicator

-- Pre-conditions:
-- a. HMI and SDL are started
-- b. app1 is registered and activated on SDL
-- c. app1 is currently in Background, Full or Limited HMI level

-- Steps:
-- app1 requests SetMediaClockTimer with COUNTDOWN mode and with valid forwardSeekIndicator and backSeekIndicator values

-- Expected:
-- SDL validates parameters of the request
-- SDL checks if SetMediaClockTimer is allowed by Policies
-- SDL checks if all parameters are allowed by Policies
-- SDL checks special validation rules for SetMediaClockTimer
-- SDL receives UI part of response from HMI with "SUCCESS" result code
-- SDL responds with (resultCode: SUCCESS, success:true) to mobile application
---------------------------------------------------------------------------------------------------

--[[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local common = require("user_modules/sequences/actions")
local utils = require("user_modules/utils")

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

--[[ Local Variables ]]
local indicatorValues = {
{ type = "TRACK" },
{ type = "TIME" },
{ type = "TIME", seekTime = 30 }
}

local requestParams = {
startTime = {
hours = 0,
minutes = 1,
seconds = 33
},
updateMode = "COUNTDOWN",
audioStreamingIndicator = "STOP"
}

--[[ Local Functions ]]
local function getTestName(forwardIndicator, backIndicator)
local test_name = "forward_" .. forwardIndicator.type
if (forwardIndicator.seekTime ~= nil) then
test_name = test_name .. "_" .. forwardIndicator.seekTime
end
test_name = test_name .. "_back_" .. backIndicator.type
if (backIndicator.seekTime ~= nil) then
test_name = test_name .. "_" .. backIndicator.seekTime
end
return test_name
end

local function sendRPC(pParams, forwardIndicator, backIndicator)
local params = utils.cloneTable(pParams)
params.forwardSeekIndicator = forwardIndicator
params.backSeekIndicator = backIndicator

local cid = common.getMobileSession():SendRPC("SetMediaClockTimer", params)
params.appID = common.getHMIAppId()
common.getHMIConnection():ExpectRequest("UI.SetMediaClockTimer", params)
:Do(function(_, data)
common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", {})
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("Register App", common.registerApp)
runner.Step("Activate App", common.activateApp)

runner.Title("Test")
for _, v1 in pairs(indicatorValues) do
for _, v2 in pairs(indicatorValues) do
runner.Step("SetMediaClockTimer " .. getTestName(v1, v2), sendRPC, { requestParams, v1, v2 })
end
end

runner.Title("Postconditions")
runner.Step("Stop SDL", common.postconditions)
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---------------------------------------------------------------------------------------------------
-- User story: API
-- Use case: SetMediaClockTimer
-- Item: INVALID_DATA case, seek Indicator with type TRACK and seekTime
--
-- Requirement summary:
-- [SetMediaClockTimer] INVALID_DATA: getting SetMediaClockTimer(COUNTDOWN)
--
-- Description:
-- Mobile application sends SetMediaClockTimer(COUNTDOWN) with forward or back seek indicator with type TRACK and seekTime defined

-- Pre-conditions:
-- a. HMI and SDL are started
-- b. app1 is registered and activated on SDL
-- c. app1 is currently in Background, Full or Limited HMI level

-- Steps:
-- app1 requests SetMediaClockTimer with COUNTDOWN mode with fowardSeekIndicator and backSeekIndicator params

-- Expected:
-- SDL validates parameters of the request
-- SDL checks if SetMediaClockTimer is allowed by Policies
-- SDL checks if all parameters are allowed by Policies
-- SDL checks special validation rules for SetMediaClockTimer
-- SDL does not transfer the UI part of request with allowed parameters to HMI
-- SDL responds with (resultCode: INVALID_DATA, success:false) to mobile application
---------------------------------------------------------------------------------------------------

--[[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local common = require("user_modules/sequences/actions")
local utils = require("user_modules/utils")

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

--[[ Local Variables ]]
local requestParams = {
startTime = {
hours = 0,
minutes = 1,
seconds = 33
},
endTime = {
hours = 0,
minutes = 1,
seconds = 35
},
updateMode = "COUNTUP",
audioStreamingIndicator = "PAUSE"
}
local validIndicator = { type = "TIME" }
local invalidIndicator = { type = "TRACK", seekTime = 90 }

--[[ Local Functions ]]
local function sendRPC(pParams, forwardIndicator, backIndicator)
local params = utils.cloneTable(pParams)
params.forwardSeekIndicator = forwardIndicator
params.backSeekIndicator = backIndicator
local cid = common.getMobileSession():SendRPC("SetMediaClockTimer", params)
common.getHMIConnection():ExpectRequest("UI.SetMediaClockTimer")
:Times(0)
common.getMobileSession():ExpectResponse(cid, { success = false, resultCode = "INVALID_DATA" })
end

--[[ Scenario ]]
runner.Title("Preconditions")
runner.Step("Clean environment", common.preconditions)
runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start)
runner.Step("Register App", common.registerApp)
runner.Step("Activate App", common.activateApp)

runner.Title("Test")
runner.Step("SetMediaClockTimer INVALID_DATA forward_TRACK_30_back_TIME", sendRPC, { requestParams, validIndicator, invalidIndicator })
runner.Step("SetMediaClockTimer INVALID_DATA forward_TIME_back_TRACK_30", sendRPC, { requestParams, invalidIndicator, validIndicator })
runner.Step("SetMediaClockTimer INVALID_DATA forward_TRACK_30_back_TRACK_30", sendRPC, { requestParams, invalidIndicator, invalidIndicator })

runner.Title("Postconditions")
runner.Step("Stop SDL", common.postconditions)
2 changes: 2 additions & 0 deletions test_sets/API/API_Tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
./test_scripts/API/SetMediaClockTimer/004_COUNTUP_no_startTime_INVALID_DATA.lua
./test_scripts/API/SetMediaClockTimer/005_COUNTUP_endTime_before_startTime_INVALID_DATA.lua
./test_scripts/API/SetMediaClockTimer/006_COUNTDOWN_startTime_before_endTime_INVALID_DATA.lua
./test_scripts/API/SetMediaClockTimer/007_PositiveCase_media_skip_indicators.lua
./test_scripts/API/SetMediaClockTimer/008_TRACK_Indicator_type_with_seektime_INVALID_DATA.lua
./test_scripts/API/ShowAppMenu/001_Show_App_Menu_RPC_with_Sub_MenuID_SUCCESS.lua
./test_scripts/API/ShowAppMenu/002_Show_App_Menu_RPC_without_Sub_MenuID_SUCCESS.lua
./test_scripts/API/ShowAppMenu/003_Show_App_Menu_RPC_with_invalid_MenuID_INVALID_ID.lua
Expand Down
4 changes: 3 additions & 1 deletion test_sets/API/SetMediaClockTimer_RPC.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
./test_scripts/API/SetMediaClockTimer/003_Non_media_app_REJECTED.lua
./test_scripts/API/SetMediaClockTimer/004_COUNTUP_no_startTime_INVALID_DATA.lua
./test_scripts/API/SetMediaClockTimer/005_COUNTUP_endTime_before_startTime_INVALID_DATA.lua
./test_scripts/API/SetMediaClockTimer/006_COUNTDOWN_startTime_before_endTime_INVALID_DATA.lua
./test_scripts/API/SetMediaClockTimer/006_COUNTDOWN_startTime_before_endTime_INVALID_DATA.lua
./test_scripts/API/SetMediaClockTimer/007_PositiveCase_media_skip_indicators.lua
./test_scripts/API/SetMediaClockTimer/008_TRACK_Indicator_type_with_seektime_INVALID_DATA.lua

0 comments on commit d5edd84

Please sign in to comment.