Skip to content

Commit

Permalink
Feature/GPS Shift support (#2144)
Browse files Browse the repository at this point in the history
* Initial scripts for GPS Shift feature

* Update in description

* Update regarding to cutting of the unnecessary gps params

* Update in stationLocation expectation regarding the parameter cutting

* Update of the description according to review comments

* Added script with subscription

* Update test_scripts/API/VehicleData/GpsShiftSupport/005_GetInteriorVehicleData_stationLocation_shift.lua

Co-Authored-By: Shobhit Adlakha <ShobhitAd@users.noreply.github.com>

* Update test_scripts/API/VehicleData/GpsShiftSupport/006_GetInteriorVehicleData_stationLocation_without_shift.lua

Co-Authored-By: Shobhit Adlakha <ShobhitAd@users.noreply.github.com>

* Update test_scripts/API/VehicleData/GpsShiftSupport/007_OnInteriorVehicleData_stationLocation_shift.lua

Co-Authored-By: Shobhit Adlakha <ShobhitAd@users.noreply.github.com>

* Update test_scripts/API/VehicleData/GpsShiftSupport/008_OnInteriorVehicleData_stationLocation_without_shift.lua

Co-Authored-By: Shobhit Adlakha <ShobhitAd@users.noreply.github.com>

* Update test_scripts/API/VehicleData/GpsShiftSupport/009_GetInteriorVehicleData_stationLocation_shift_after_subscription.lua

Co-Authored-By: Shobhit Adlakha <ShobhitAd@users.noreply.github.com>
  • Loading branch information
dboltovskyi and ShobhitAd committed Jun 28, 2019
1 parent a24b574 commit d83e701
Show file tree
Hide file tree
Showing 11 changed files with 525 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---------------------------------------------------------------------------------------------------
-- Proposal:
-- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0199-Adding-GPS-Shift-support.md
-- Description:
-- In case:
-- 1) Mobile sends GetVehicleData (gps) request
-- 2) SDL transfers this request to HMI
-- 3) HMI sends VehicleData response with "shifted" item
-- SDL does:
-- 1) Send GetVehicleData response to mobile with "shifted" item in "gps" parameter
-- with the same value as those from HMI
---------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local common = require('test_scripts/API/VehicleData/GpsShiftSupport/commonGpsShift')

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

--[[ 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("PTU", common.policyTableUpdate, { common.pTUpdateFunc })
runner.Step("Activate App", common.activateApp)

runner.Title("Test")
for _, v in pairs(common.shiftValue) do
runner.Step("Get GPS VehicleData, gps-shifted " .. tostring(v), common.getVehicleData, { v })
end

runner.Title("Postconditions")
runner.Step("Stop SDL", common.postconditions)
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---------------------------------------------------------------------------------------------------
-- Proposal:
-- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0199-Adding-GPS-Shift-support.md
-- Description:
-- In case:
-- 1) Mobile sends GetVehicleData (gps) request
-- 2) SDL transfers this request to HMI
-- 3) HMI does not send "shifted" item in "gps" parameter of GetVehicleData response
-- SDL does:
-- 1) Send GetVehicleData response to mobile without "shifted" item in "gps" parameter
----------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local common = require('test_scripts/API/VehicleData/GpsShiftSupport/commonGpsShift')

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

--[[ 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("PTU", common.policyTableUpdate, { common.pTUpdateFunc })
runner.Step("Activate App", common.activateApp)

runner.Title("Test")
runner.Step("Get GPS VehicleData, without shift", common.getVehicleData, { nil })

runner.Title("Postconditions")
runner.Step("Stop SDL", common.postconditions)
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---------------------------------------------------------------------------------------------------
-- Proposal:
-- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0199-Adding-GPS-Shift-support.md
-- Description:
-- In case:
-- 1) App registered and subscribed on vehicle data (gps)
-- 2) HMI sends "shifted" item in "gps" parameter of OnVehicleData notification
-- SDL does:
-- 1) Send OnVehicleData notification to mobile with "shifted" item in "gps" parameter
-- with the same value as those from HMI
---------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local common = require('test_scripts/API/VehicleData/GpsShiftSupport/commonGpsShift')

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

--[[ 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("PTU", common.policyTableUpdate, { common.pTUpdateFunc })
runner.Step("Activate App", common.activateApp)
runner.Step("Subscribe on GPS VehicleData", common.subscribeVehicleData)

runner.Title("Test")
for _, v in pairs(common.shiftValue) do
runner.Step("Send On VehicleData with GpsShift " .. tostring(v), common.sendOnVehicleData, { v })
end

runner.Title("Postconditions")
runner.Step("Stop SDL", common.postconditions)
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---------------------------------------------------------------------------------------------------
-- Proposal:
-- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0199-Adding-GPS-Shift-support.md
-- Description:
-- In case:
-- 1) App registered and subscribed on vehicle data (gps)
-- 2) HMI does not send "shifted" item in "gps" parameter of OnVehicleData notification
-- SDL does:
-- 1) Send OnVehicleData notification to mobile without "shifted" item in "gps" parameter
---------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local common = require('test_scripts/API/VehicleData/GpsShiftSupport/commonGpsShift')

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

--[[ 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("PTU", common.policyTableUpdate, { common.pTUpdateFunc })
runner.Step("Activate App", common.activateApp)
runner.Step("Subscribe on GPS VehicleData", common.subscribeVehicleData)

runner.Title("Test")
runner.Step("Send On VehicleData without shift", common.sendOnVehicleData, { nil })

runner.Title("Postconditions")
runner.Step("Stop SDL", common.postconditions)
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---------------------------------------------------------------------------------------------------
-- Proposal:
-- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0199-Adding-GPS-Shift-support.md
-- Description:
-- In case:
-- 1) Mobile sends GetInteriorVehicleData request
-- 2) SDL transfers this request to HMI
-- 3) HMI sends "shifted" item in "stationLocation" parameter of "moduleData" parameter of GetInteriorVehicleData
-- response
-- 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
---------------------------------------------------------------------------------------------------
--[[ 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 = false
})
EXPECT_HMICALL("RC.GetInteriorVehicleData", {
moduleType = "RADIO"
})
:Do(function(_, data)
common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", {
moduleData = common.radioData,
isSubscribed = false
})
end)

local expectedRadioData = common.cloneTable(common.radioData)
expectedRadioData.radioControlData.sisData.stationLocation.shifted = nil
common.getMobileSession():ExpectResponse(cid, { success = true, resultCode = "SUCCESS",
isSubscribed = false,
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")
for _, v in pairs(common.shiftValue) do
runner.Step("GetInteriorVehicleData RADIO module, shifted " .. tostring(v), getInteriorVehicleData, { v })
end

runner.Title("Postconditions")
runner.Step("Stop SDL", commonRC.postconditions)
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---------------------------------------------------------------------------------------------------
-- Proposal:
-- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0199-Adding-GPS-Shift-support.md
-- Description:
-- In case:
-- 1) Mobile sends GetInteriorVehicleData request
-- 2) SDL transfers this request to HMI
-- 3) HMI does not send "shifted" item in "stationLocation" parameter of "moduleData" parameter of GetInteriorVehicleData
-- response
-- SDL does:
-- 1) Send GetInteriorVehicleData response to mobile without "shifted" item in "stationLocation" parameter of
-- "moduleData" parameter
---------------------------------------------------------------------------------------------------
--[[ 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

--[[ 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 RADIO module, without shifted", common.getInteriorVehicleData, { nil })

runner.Title("Postconditions")
runner.Step("Stop SDL", commonRC.postconditions)
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---------------------------------------------------------------------------------------------------
-- Proposal:
-- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0199-Adding-GPS-Shift-support.md
-- Description:
-- In case:
-- 1) App registered and subscribed on RADIO
-- 2) HMI sends "shifted" item in "stationLocation" parameter of "moduleData" parameter of OnInteriorVehicleData
-- notification
-- SDL does:
-- 1) Cut all parameters except longitudeDegrees, latitudeDegrees, altitude from stationLocation and send
-- OnInteriorVehicleData notification to mobile without "shifted" item in "stationLocation" structure
-- of "moduleData" parameter
---------------------------------------------------------------------------------------------------
--[[ 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 onInteriorVehicleData(pShiftValue)
common.radioData.radioControlData.sisData.stationLocation.shifted = pShiftValue
common.getHMIConnection():SendNotification("RC.OnInteriorVehicleData", { moduleData = common.radioData })
local expectedRadioData = common.cloneTable(common.radioData)
expectedRadioData.radioControlData.sisData.stationLocation.shifted = nil
common.getMobileSession():ExpectNotification("OnInteriorVehicleData", { 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.Step("Subscribe on InteriorVehicleData, RADIO module", common.getInteriorVehicleData, { nil, true })

runner.Title("Test")
for _, v in pairs(common.shiftValue) do
runner.Step("OnInteriorVehicleData, RADIO module, shifted " .. tostring(v), onInteriorVehicleData, { v })
end

runner.Title("Postconditions")
runner.Step("Stop SDL", commonRC.postconditions)
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---------------------------------------------------------------------------------------------------
-- Proposal:
-- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0199-Adding-GPS-Shift-support.md
-- Description:
-- In case:
-- 1) App registered and subscribed on RADIO
-- 2) HMI does not send "shifted" item in "stationLocation" parameter of "moduleData" parameter of OnInteriorVehicleData
-- notification
-- SDL does:
-- 1) Send OnInteriorVehicleData notification to mobile without "shifted" item in "stationLocation" parameter
-- of "moduleData" parameter
---------------------------------------------------------------------------------------------------
--[[ 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

--[[ 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.Step("Subscribe on InteriorVehicleData, RADIO module", common.getInteriorVehicleData, { nil, true })

runner.Title("Test")
runner.Step("OnInteriorVehicleData, RADIO module, without shifted ", common.onInteriorVehicleData, { nil })

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

0 comments on commit d83e701

Please sign in to comment.