|
| 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) |
0 commit comments