diff --git a/test_scripts/API/VehicleData/GpsShiftSupport/009_GetInteriorVehicleData_stationLocation_shift_after_subscription.lua b/test_scripts/API/VehicleData/GpsShiftSupport/009_GetInteriorVehicleData_stationLocation_shift_after_subscription.lua new file mode 100644 index 0000000000..4d0d255c6f --- /dev/null +++ b/test_scripts/API/VehicleData/GpsShiftSupport/009_GetInteriorVehicleData_stationLocation_shift_after_subscription.lua @@ -0,0 +1,84 @@ +--------------------------------------------------------------------------------------------------- +-- Proposal: +-- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0199-Adding-GPS-Shift-support.md +-- Description: +-- In case: +-- 1) Mobile sends GetInteriorVehicleData request with subscribe=true +-- 2) SDL transfers this request to HMI +-- 3) HMI sends "shifted" item in "stationLocation" parameter of "moduleData" parameter of GetInteriorVehicleData +-- response +-- 4) Mobile sends another GetInteriorVehicleData request without subscribe parameter +-- SDL does: +-- 1) Cut all parameters except longitudeDegrees, latitudeDegrees, altitude from stationLocation and +-- send GetInteriorVehicleData response to mobile without "shifted" item in "stationLocation" structure of +-- "moduleData" parameter for the first request +-- 2) Send a GetInteriorVehicleData response without "shifted" item for the second request +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/VehicleData/GpsShiftSupport/commonGpsShift') +local commonRC = require("test_scripts/RC/commonRC") + +-- [[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +-- [[ Local Functions ]] +local function getInteriorVehicleData(pShiftValue) + common.radioData.radioControlData.sisData.stationLocation.shifted = pShiftValue + local cid = common.getMobileSession():SendRPC("GetInteriorVehicleData", { + moduleType = "RADIO", + subscribe = true + }) + EXPECT_HMICALL("RC.GetInteriorVehicleData", { + moduleType = "RADIO" + }) + :Do(function(_, data) + common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", { + moduleData = common.radioData, + isSubscribed = true + }) + end) + + local expectedRadioData = common.cloneTable(common.radioData) + expectedRadioData.radioControlData.sisData.stationLocation.shifted = nil + common.getMobileSession():ExpectResponse(cid, { success = true, resultCode = "SUCCESS", + isSubscribed = true, + moduleData = expectedRadioData + }) + :ValidIf(function(_, data) + return common.checkShifted(data.payload.moduleData.radioControlData.sisData.stationLocation.shifted, nil) + end) +end + +local function getInteriorVehicleDataSubscribed() + local cid = common.getMobileSession():SendRPC("GetInteriorVehicleData", { + moduleType = "RADIO" + }) + EXPECT_HMICALL("RC.GetInteriorVehicleData", { + moduleType = "RADIO" + }) + :Times(0) + + local expectedRadioData = common.cloneTable(common.radioData) + expectedRadioData.radioControlData.sisData.stationLocation.shifted = nil + common.getMobileSession():ExpectResponse(cid, { success = true, resultCode = "SUCCESS", + moduleData = expectedRadioData + }) + :ValidIf(function(_, data) + return common.checkShifted(data.payload.moduleData.radioControlData.sisData.stationLocation.shifted, nil) + end) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", commonRC.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("Register App", common.registerAppWOPTU) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("GetInteriorVehicleData subscription RADIO module, shifted true", getInteriorVehicleData, { true }) +runner.Step("GetInteriorVehicleData RADIO module subscribed, without shifted", getInteriorVehicleDataSubscribed) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_sets/gps_shift_support.txt b/test_sets/gps_shift_support.txt index 245559d16c..f4d1357690 100644 --- a/test_sets/gps_shift_support.txt +++ b/test_sets/gps_shift_support.txt @@ -6,3 +6,4 @@ ./test_scripts/API/VehicleData/GpsShiftSupport/006_GetInteriorVehicleData_stationLocation_without_shift.lua ./test_scripts/API/VehicleData/GpsShiftSupport/007_OnInteriorVehicleData_stationLocation_shift.lua ./test_scripts/API/VehicleData/GpsShiftSupport/008_OnInteriorVehicleData_stationLocation_without_shift.lua +./test_scripts/API/VehicleData/GpsShiftSupport/009_GetInteriorVehicleData_stationLocation_shift_after_subscription.lua