Skip to content

Commit d5edd84

Browse files
SDL 0198 - Media Skip Indicators (#2513)
* 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>
1 parent 915f889 commit d5edd84

File tree

4 files changed

+180
-1
lines changed

4 files changed

+180
-1
lines changed
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
---------------------------------------------------------------------------------------------------
2+
-- User story: API
3+
-- Use case: SetMediaClockTimer
4+
-- Item: Happy path case, forward and back seek indicators
5+
--
6+
-- Requirement summary:
7+
-- [SetMediaClockTimer] SUCCESS: getting SUCCESS:UI.SetMediaClockTimer()
8+
--
9+
-- Description:
10+
-- Mobile application sends SetMediaClockTimer(COUNTDOWN) request with forwardSeekIndicator and backSeekIndicator
11+
12+
-- Pre-conditions:
13+
-- a. HMI and SDL are started
14+
-- b. app1 is registered and activated on SDL
15+
-- c. app1 is currently in Background, Full or Limited HMI level
16+
17+
-- Steps:
18+
-- app1 requests SetMediaClockTimer with COUNTDOWN mode and with valid forwardSeekIndicator and backSeekIndicator values
19+
20+
-- Expected:
21+
-- SDL validates parameters of the request
22+
-- SDL checks if SetMediaClockTimer is allowed by Policies
23+
-- SDL checks if all parameters are allowed by Policies
24+
-- SDL checks special validation rules for SetMediaClockTimer
25+
-- SDL receives UI part of response from HMI with "SUCCESS" result code
26+
-- SDL responds with (resultCode: SUCCESS, success:true) to mobile application
27+
---------------------------------------------------------------------------------------------------
28+
29+
--[[ Required Shared libraries ]]
30+
local runner = require('user_modules/script_runner')
31+
local common = require("user_modules/sequences/actions")
32+
local utils = require("user_modules/utils")
33+
34+
--[[ Test Configuration ]]
35+
runner.testSettings.isSelfIncluded = false
36+
37+
--[[ Local Variables ]]
38+
local indicatorValues = {
39+
{ type = "TRACK" },
40+
{ type = "TIME" },
41+
{ type = "TIME", seekTime = 30 }
42+
}
43+
44+
local requestParams = {
45+
startTime = {
46+
hours = 0,
47+
minutes = 1,
48+
seconds = 33
49+
},
50+
updateMode = "COUNTDOWN",
51+
audioStreamingIndicator = "STOP"
52+
}
53+
54+
--[[ Local Functions ]]
55+
local function getTestName(forwardIndicator, backIndicator)
56+
local test_name = "forward_" .. forwardIndicator.type
57+
if (forwardIndicator.seekTime ~= nil) then
58+
test_name = test_name .. "_" .. forwardIndicator.seekTime
59+
end
60+
test_name = test_name .. "_back_" .. backIndicator.type
61+
if (backIndicator.seekTime ~= nil) then
62+
test_name = test_name .. "_" .. backIndicator.seekTime
63+
end
64+
return test_name
65+
end
66+
67+
local function sendRPC(pParams, forwardIndicator, backIndicator)
68+
local params = utils.cloneTable(pParams)
69+
params.forwardSeekIndicator = forwardIndicator
70+
params.backSeekIndicator = backIndicator
71+
72+
local cid = common.getMobileSession():SendRPC("SetMediaClockTimer", params)
73+
params.appID = common.getHMIAppId()
74+
common.getHMIConnection():ExpectRequest("UI.SetMediaClockTimer", params)
75+
:Do(function(_, data)
76+
common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", {})
77+
end)
78+
common.getMobileSession():ExpectResponse(cid, { success = true, resultCode = "SUCCESS" })
79+
end
80+
81+
--[[ Scenario ]]
82+
runner.Title("Preconditions")
83+
runner.Step("Clean environment", common.preconditions)
84+
runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start)
85+
runner.Step("Register App", common.registerApp)
86+
runner.Step("Activate App", common.activateApp)
87+
88+
runner.Title("Test")
89+
for _, v1 in pairs(indicatorValues) do
90+
for _, v2 in pairs(indicatorValues) do
91+
runner.Step("SetMediaClockTimer " .. getTestName(v1, v2), sendRPC, { requestParams, v1, v2 })
92+
end
93+
end
94+
95+
runner.Title("Postconditions")
96+
runner.Step("Stop SDL", common.postconditions)
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
---------------------------------------------------------------------------------------------------
2+
-- User story: API
3+
-- Use case: SetMediaClockTimer
4+
-- Item: INVALID_DATA case, seek Indicator with type TRACK and seekTime
5+
--
6+
-- Requirement summary:
7+
-- [SetMediaClockTimer] INVALID_DATA: getting SetMediaClockTimer(COUNTDOWN)
8+
--
9+
-- Description:
10+
-- Mobile application sends SetMediaClockTimer(COUNTDOWN) with forward or back seek indicator with type TRACK and seekTime defined
11+
12+
-- Pre-conditions:
13+
-- a. HMI and SDL are started
14+
-- b. app1 is registered and activated on SDL
15+
-- c. app1 is currently in Background, Full or Limited HMI level
16+
17+
-- Steps:
18+
-- app1 requests SetMediaClockTimer with COUNTDOWN mode with fowardSeekIndicator and backSeekIndicator params
19+
20+
-- Expected:
21+
-- SDL validates parameters of the request
22+
-- SDL checks if SetMediaClockTimer is allowed by Policies
23+
-- SDL checks if all parameters are allowed by Policies
24+
-- SDL checks special validation rules for SetMediaClockTimer
25+
-- SDL does not transfer the UI part of request with allowed parameters to HMI
26+
-- SDL responds with (resultCode: INVALID_DATA, success:false) to mobile application
27+
---------------------------------------------------------------------------------------------------
28+
29+
--[[ Required Shared libraries ]]
30+
local runner = require('user_modules/script_runner')
31+
local common = require("user_modules/sequences/actions")
32+
local utils = require("user_modules/utils")
33+
34+
--[[ Test Configuration ]]
35+
runner.testSettings.isSelfIncluded = false
36+
37+
--[[ Local Variables ]]
38+
local requestParams = {
39+
startTime = {
40+
hours = 0,
41+
minutes = 1,
42+
seconds = 33
43+
},
44+
endTime = {
45+
hours = 0,
46+
minutes = 1,
47+
seconds = 35
48+
},
49+
updateMode = "COUNTUP",
50+
audioStreamingIndicator = "PAUSE"
51+
}
52+
local validIndicator = { type = "TIME" }
53+
local invalidIndicator = { type = "TRACK", seekTime = 90 }
54+
55+
--[[ Local Functions ]]
56+
local function sendRPC(pParams, forwardIndicator, backIndicator)
57+
local params = utils.cloneTable(pParams)
58+
params.forwardSeekIndicator = forwardIndicator
59+
params.backSeekIndicator = backIndicator
60+
local cid = common.getMobileSession():SendRPC("SetMediaClockTimer", params)
61+
common.getHMIConnection():ExpectRequest("UI.SetMediaClockTimer")
62+
:Times(0)
63+
common.getMobileSession():ExpectResponse(cid, { success = false, resultCode = "INVALID_DATA" })
64+
end
65+
66+
--[[ Scenario ]]
67+
runner.Title("Preconditions")
68+
runner.Step("Clean environment", common.preconditions)
69+
runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start)
70+
runner.Step("Register App", common.registerApp)
71+
runner.Step("Activate App", common.activateApp)
72+
73+
runner.Title("Test")
74+
runner.Step("SetMediaClockTimer INVALID_DATA forward_TRACK_30_back_TIME", sendRPC, { requestParams, validIndicator, invalidIndicator })
75+
runner.Step("SetMediaClockTimer INVALID_DATA forward_TIME_back_TRACK_30", sendRPC, { requestParams, invalidIndicator, validIndicator })
76+
runner.Step("SetMediaClockTimer INVALID_DATA forward_TRACK_30_back_TRACK_30", sendRPC, { requestParams, invalidIndicator, invalidIndicator })
77+
78+
runner.Title("Postconditions")
79+
runner.Step("Stop SDL", common.postconditions)

test_sets/API/API_Tests.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
./test_scripts/API/SetMediaClockTimer/004_COUNTUP_no_startTime_INVALID_DATA.lua
1616
./test_scripts/API/SetMediaClockTimer/005_COUNTUP_endTime_before_startTime_INVALID_DATA.lua
1717
./test_scripts/API/SetMediaClockTimer/006_COUNTDOWN_startTime_before_endTime_INVALID_DATA.lua
18+
./test_scripts/API/SetMediaClockTimer/007_PositiveCase_media_skip_indicators.lua
19+
./test_scripts/API/SetMediaClockTimer/008_TRACK_Indicator_type_with_seektime_INVALID_DATA.lua
1820
./test_scripts/API/ShowAppMenu/001_Show_App_Menu_RPC_with_Sub_MenuID_SUCCESS.lua
1921
./test_scripts/API/ShowAppMenu/002_Show_App_Menu_RPC_without_Sub_MenuID_SUCCESS.lua
2022
./test_scripts/API/ShowAppMenu/003_Show_App_Menu_RPC_with_invalid_MenuID_INVALID_ID.lua

test_sets/API/SetMediaClockTimer_RPC.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@
33
./test_scripts/API/SetMediaClockTimer/003_Non_media_app_REJECTED.lua
44
./test_scripts/API/SetMediaClockTimer/004_COUNTUP_no_startTime_INVALID_DATA.lua
55
./test_scripts/API/SetMediaClockTimer/005_COUNTUP_endTime_before_startTime_INVALID_DATA.lua
6-
./test_scripts/API/SetMediaClockTimer/006_COUNTDOWN_startTime_before_endTime_INVALID_DATA.lua
6+
./test_scripts/API/SetMediaClockTimer/006_COUNTDOWN_startTime_before_endTime_INVALID_DATA.lua
7+
./test_scripts/API/SetMediaClockTimer/007_PositiveCase_media_skip_indicators.lua
8+
./test_scripts/API/SetMediaClockTimer/008_TRACK_Indicator_type_with_seektime_INVALID_DATA.lua

0 commit comments

Comments
 (0)