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 0244 - Custom Playback Rate #2498

Merged
merged 3 commits into from
Jan 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---------------------------------------------------------------------------------------------------
-- User story: API
-- Use case: SetMediaClockTimer
-- Item: Happy path, default countRate
--
-- Requirement summary:
-- [SetMediaClockTimer] SUCCESS: getting SUCCESS:UI.SetMediaClockTimer()
--
-- Description:
-- Mobile application sends valid SetMediaClockTimer request and gets UI.SetMediaClockTimer "SUCCESS" response from HMI

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

-- Steps:
-- appID requests SetMediaClockTimer with valid parameters and without countRate

-- Expected:
-- SDL validates parameters of the request
-- SDL checks if UI interface is available on HMI
-- SDL checks if SetMediaClockTimer is allowed by Policies
-- SDL checks if all parameters are allowed by Policies
-- SDL transfers the UI part of request with allowed parameters along with a default countRate of 1.0 to HMI
-- 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 requestParams = {
startTime = {
hours = 0,
minutes = 1,
seconds = 33
},
endTime = {
hours = 0,
minutes = 1,
seconds = 35
},
updateMode = "COUNTUP",
audioStreamingIndicator = "PAUSE"
}

--[[ Local Functions ]]
local function sendRPC(pParams)
local params = utils.cloneTable(pParams)
local cid = common.getMobileSession():SendRPC("SetMediaClockTimer", params)
params.appID = common.getHMIAppId()
params.countRate = 1.0
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")
runner.Step("SetMediaClockTimer Positive Case", sendRPC, { requestParams })

runner.Title("Postconditions")
runner.Step("Stop SDL", common.postconditions)
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---------------------------------------------------------------------------------------------------
-- User story: API
-- Use case: SetMediaClockTimer
-- Item: Happy path, custom countRate
--
-- Requirement summary:
-- [SetMediaClockTimer] SUCCESS: getting SUCCESS:UI.SetMediaClockTimer()
--
-- Description:
-- Mobile application sends valid SetMediaClockTimer request and gets UI.SetMediaClockTimer "SUCCESS" response from HMI

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

-- Steps:
-- appID requests SetMediaClockTimer with valid parameters including a custom countRate

-- Expected:
-- SDL validates parameters of the request
-- SDL checks if UI interface is available on HMI
-- SDL checks if SetMediaClockTimer is allowed by Policies
-- SDL checks if all parameters are allowed by Policies
-- SDL transfers the UI part of request with allowed parameters to HMI
-- 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 requestParams = {
startTime = {
hours = 0,
minutes = 1,
seconds = 33
},
updateMode = "COUNTUP",
audioStreamingIndicator = "PLAY_PAUSE",
ShobhitAd marked this conversation as resolved.
Show resolved Hide resolved
countRate = 2.0
}

--[[ Local Functions ]]
local function sendRPC(pParams)
local params = utils.cloneTable(pParams)
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")
runner.Step("SetMediaClockTimer Positive Case with custom countRate", sendRPC, { requestParams })

runner.Title("Postconditions")
runner.Step("Stop SDL", common.postconditions)
74 changes: 74 additions & 0 deletions test_scripts/API/SetMediaClockTimer/003_Non_media_app_REJECTED.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---------------------------------------------------------------------------------------------------
-- User story: API
-- Use case: SetMediaClockTimer
-- Item: REJECTED case, non-media app
--
-- Requirement summary:
-- [SetMediaClockTimer] REJECTED: getting SetMediaClockTimer request from non-media app
--
-- Description:
-- Non-media mobile application sends valid SetMediaClockTimer request

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

-- Steps:
-- app1 requests SetMediaClockTimer with valid parameters

-- Expected:
-- SDL validates parameters of the request
-- SDL checks if UI interface is available on HMI
-- SDL checks if SetMediaClockTimer is allowed by Policies
-- SDL checks if all parameters are allowed by Policies
-- SDL does not transfer the UI part of request with allowed parameters to HMI
-- SDL responds with (resultCode: REJECTED, success:false) to mobile application
---------------------------------------------------------------------------------------------------

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

--[[ Test Configuration ]]
runner.testSettings.isSelfIncluded = false
config.application1.registerAppInterfaceParams.isMediaApplication = false
config.application1.registerAppInterfaceParams.appHMIType = { "DEFAULT" }

--[[ Local Variables ]]
local requestParams = {
startTime = {
hours = 0,
minutes = 1,
seconds = 33
},
endTime = {
hours = 0,
minutes = 1,
seconds = 35
},
updateMode = "COUNTUP",
audioStreamingIndicator = "PAUSE",
countRate = 1.1
}

--[[ Local Functions ]]
local function sendRPC(pParams)
local cid = common.getMobileSession():SendRPC("SetMediaClockTimer", pParams)
common.getHMIConnection():ExpectRequest("UI.SetMediaClockTimer")
:Times(0)
common.getMobileSession():ExpectResponse(cid, { success = false, resultCode = "REJECTED" })
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 REJECTED", sendRPC, { requestParams })

runner.Title("Postconditions")
runner.Step("Stop SDL", common.postconditions)
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---------------------------------------------------------------------------------------------------
-- User story: API
-- Use case: SetMediaClockTimer
-- Item: INVALID_DATA case, missing startTime in COUNTUP mode
--
-- Requirement summary:
-- [SetMediaClockTimer] INVALID_DATA: getting SetMediaClockTimer(COUNTUP) without required startTime parameter
--
-- Description:
-- Mobile application sends SetMediaClockTimer(COUNTUP) request without startTime parameter

-- 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 COUNTUP mode and without startTime parameter

-- 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")

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

--[[ Local Variables ]]
local requestParams = {
endTime = {
hours = 0,
minutes = 1,
seconds = 35
},
updateMode = "COUNTUP",
audioStreamingIndicator = "PAUSE",
countRate = 0.5
}

--[[ Local Functions ]]
local function sendRPC(pParams)
local cid = common.getMobileSession():SendRPC("SetMediaClockTimer", pParams)
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", sendRPC, { requestParams })

runner.Title("Postconditions")
runner.Step("Stop SDL", common.postconditions)
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---------------------------------------------------------------------------------------------------
-- User story: API
-- Use case: SetMediaClockTimer
-- Item: INVALID_DATA case, endTime before startTime in COUNTUP mode
--
-- Requirement summary:
-- [SetMediaClockTimer] INVALID_DATA: getting SetMediaClockTimer(COUNTUP) with endTime earlier than startTime
--
-- Description:
-- Mobile application sends SetMediaClockTimer(COUNTUP) request with invalid timer bounds

-- 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 COUNTUP mode and with endTime earlier than startTime

-- 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")

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

--[[ Local Variables ]]
local requestParams = {
startTime = {
hours = 0,
minutes = 1,
seconds = 35
},
endTime = {
hours = 0,
minutes = 1,
seconds = 33
},
updateMode = "COUNTUP",
audioStreamingIndicator = "PAUSE"
}

--[[ Local Functions ]]
local function sendRPC(pParams)
local cid = common.getMobileSession():SendRPC("SetMediaClockTimer", pParams)
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", sendRPC, { requestParams })

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