diff --git a/test_scripts/API/001_Inconsistency_check_between_result_codes_in_APIs.lua b/test_scripts/API/001_Inconsistency_check_between_result_codes_in_APIs.lua new file mode 100644 index 0000000000..a945f87b23 --- /dev/null +++ b/test_scripts/API/001_Inconsistency_check_between_result_codes_in_APIs.lua @@ -0,0 +1,30 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/24 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/TRS/embedded_navi/SendLocation_TRS.md +-- Item: Use Case 1: Main Flow +-- +-- Requirement summary: +-- SDL transfer HMI's result code to Mobile +-- +-- Description: +-- Check that for each result code in HMI API there is corresponding one in Mobile API +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Local Functions ]] +local function checkUnmappedCodes(self) + local unmappedCodes = common.getUnmappedResultCodes() + if #unmappedCodes > 0 then + local msg = "Following unmapped result codes found: " + .. table.concat(common.getKeysFromItemsTable(unmappedCodes, "hmi"), ", ") + self:FailTestCase(msg) + else + print("No unmapped result codes found") + end +end + +--[[ Scenario ]] +runner.Title("Test") +runner.Step("Check presence of unmapped HMI result codes", checkUnmappedCodes) diff --git a/test_scripts/API/Navigation/GetWayPoints/001_GetWayPoints_success_flow.lua b/test_scripts/API/Navigation/GetWayPoints/001_GetWayPoints_success_flow.lua new file mode 100755 index 0000000000..e5d6a8c640 --- /dev/null +++ b/test_scripts/API/Navigation/GetWayPoints/001_GetWayPoints_success_flow.lua @@ -0,0 +1,145 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/25 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Get%20Destination_and_Waypoints.md +-- Item: Use Case 1: Main Flow +-- +-- Requirement summary: +-- [GetWayPoints] As a mobile app I want to send a request to get the details of the destination +-- and waypoints set on the system so that I can get last mile connectivity. +-- +-- Description: +-- In case: +-- 1) mobile application sends valid and allowed by Policies GetWayPoints_request to SDL +-- SDL must: +-- 1) Transfer GetWayPoints_request to HMI +-- 2) Respond with received from HMI to mobile application +-- 3) Provide the requested parameters at the same order as received from HMI +-- to mobile application (in case of successfull response) + +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') +local commonFunctions = require("user_modules/shared_testcases/commonFunctions") + +local response = { + wayPoints = { + { + coordinate = + { + latitudeDegrees = 1.1, + longitudeDegrees = 1.1 + }, + locationName = "Hotel", + addressLines = + { + "Hotel Bora", + "Hotel 5 stars" + }, + locationDescription = "VIP Hotel", + phoneNumber = "Phone39300434", + locationImage = + { + value ="icon.png", + imageType ="DYNAMIC", + }, + searchAddress = + { + countryName = "countryName", + countryCode = "countryCode", + postalCode = "postalCode", + administrativeArea = "administrativeArea", + subAdministrativeArea = "subAdministrativeArea", + locality = "locality", + subLocality = "subLocality", + thoroughfare = "thoroughfare", + subThoroughfare = "subThoroughfare" + } + }, + { + coordinate = + { + latitudeDegrees = 88, + longitudeDegrees = 176 + }, + locationName = "Home", + addressLines = + { + "Street, 36" + }, + locationDescription = "Home", + phoneNumber = "46788974", + locationImage = + { + value ="icon.png", + imageType ="DYNAMIC", + }, + searchAddress = + { + countryName = "countryname", + countryCode = "countrycode", + postalCode = "postalcode", + administrativeArea = "administrativearea", + subAdministrativeArea = "subAdministrativearea", + locality = "locality", + subLocality = "sublocality", + thoroughfare = "thoroughfare", + subThoroughfare = "subthoroughfare" + } + } + } +} + +--[[ Local Functions ]] +local function GetWayPoints(pWayPointType, self) + local params = { + wayPointType = pWayPointType + } + + local cid = self.mobileSession1:SendRPC("GetWayPoints", params) + response.appID = common.getHMIAppId() + + EXPECT_HMICALL("Navigation.GetWayPoints", params) + :ValidIf(function(_, data) + return data.params.appID == common.getHMIAppId() + end) + :Do(function(_,data) + self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", response) + end) + + self.mobileSession1:ExpectResponse(cid, { success = true, resultCode = "SUCCESS" }) + :ValidIf(function(_, data) -- checking order of wayPoints + for k in pairs(data.payload.wayPoints) do + local actualCoordinate = data.payload.wayPoints[k].coordinate + local expectedCoordinate = response.wayPoints[k].coordinate + if (actualCoordinate.latitudeDegrees ~= expectedCoordinate.latitudeDegrees) or + (actualCoordinate.longitudeDegrees ~= expectedCoordinate.longitudeDegrees) then + return false, "WayPoints order is not as expected" + end + end + return true + end) + :ValidIf(function(_, data) -- checking data of wayPoints + for k in pairs(data.payload.wayPoints) do + if not commonFunctions:is_table_equal(data.payload.wayPoints[k], response.wayPoints[k]) then + return false, "Waypoints data is not as expected" + end + end + return true + end) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +for _, wayPointType in pairs({ "ALL", "DESTINATION" }) do + runner.Step("GetWayPoints, wayPointType " .. wayPointType, GetWayPoints, { wayPointType }) +end + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/GetWayPoints/002_GetWayPoints_DISALLOWED_by_policy.lua b/test_scripts/API/Navigation/GetWayPoints/002_GetWayPoints_DISALLOWED_by_policy.lua new file mode 100755 index 0000000000..c3db91defd --- /dev/null +++ b/test_scripts/API/Navigation/GetWayPoints/002_GetWayPoints_DISALLOWED_by_policy.lua @@ -0,0 +1,47 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/25 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Get%20Destination_and_Waypoints.md +-- Item: Use Case 1: Exception 2: request is NOT allowed by Policies +-- +-- Requirement summary: +-- [GetWayPoints] As a mobile app I want to send a request to get the details of the destination +-- and waypoints set on the system so that I can get last mile connectivity. +-- +-- Description: +-- In case: +-- 1) mobile application sends valid GetWayPoints_request to SDL and this request is NOT allowed by Policies +-- SDL must: +-- 1) SDL responds DISALLOWED, success:false to mobile application and doesn't transfer this request to HMI + +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Local Functions ]] +local function getWayPoints(self) + local params = { + wayPointType = "ALL" + } + local cid = self.mobileSession1:SendRPC("GetWayPoints", params) + EXPECT_HMICALL("Navigation.GetWayPoints", params):Times(0) + self.mobileSession1:ExpectResponse(cid, { success = false, resultCode = "DISALLOWED" }) + common:DelayedExp() +end + +local function ptuUpdateFunc(pTbl) + pTbl.policy_table.functional_groupings["WayPoints"].rpcs.GetWayPoints = nil +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerAppWithPTU, { common.appId1, ptuUpdateFunc }) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("GetWayPoints, DISALLOWED by policy", getWayPoints) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/GetWayPoints/003_GetWayPoints_UNSUPPORTED_RESOURCE_getWayPointsEnabled_false.lua b/test_scripts/API/Navigation/GetWayPoints/003_GetWayPoints_UNSUPPORTED_RESOURCE_getWayPointsEnabled_false.lua new file mode 100755 index 0000000000..545d8424fe --- /dev/null +++ b/test_scripts/API/Navigation/GetWayPoints/003_GetWayPoints_UNSUPPORTED_RESOURCE_getWayPointsEnabled_false.lua @@ -0,0 +1,50 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/25 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Get%20Destination_and_Waypoints.md +-- Item: Use Case 3: Exception 4: "getWayPointsEnabled": false in HMI capabilities +-- +-- Requirement summary: +-- [GetWayPoints] As a mobile app I want to send a request to get the details of the destination +-- and waypoints set on the system so that I can get last mile connectivity. +-- +-- Description: +-- In case: +-- 1) mobile application sends valid and allowed by Policies GetWayPoints_request to SDL and "getWayPointsEnabled": false in HMI capabilities +-- SDL must: +-- 1) respond "UNSUPPORTED_RESOURCE, success:false" to mobile application and not transfer this request to HMI + +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') +local hmi_values = require('user_modules/hmi_values') + +--[[ Local Functions ]] +local function disableGetWayPoints() + local params = hmi_values.getDefaultHMITable() + params.UI.GetCapabilities.params.systemCapabilities.navigationCapability.getWayPointsEnabled = false + return params +end + +local function getWayPoints(self) + local params = { + wayPointType = "ALL" + } + local cid = self.mobileSession1:SendRPC("GetWayPoints", params) + EXPECT_HMICALL("Navigation.GetWayPoints", params):Times(0) + self.mobileSession1:ExpectResponse(cid, { success = false, resultCode = "UNSUPPORTED_RESOURCE" }) + common:DelayedExp() +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start, { disableGetWayPoints() }) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("GetWayPoints,\"getWayPointsEnabled\":false", getWayPoints) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/GetWayPoints/004_GetWayPoints_UNSUPPORTED_RESOURCE_Navi_interface_is_not_available.lua b/test_scripts/API/Navigation/GetWayPoints/004_GetWayPoints_UNSUPPORTED_RESOURCE_Navi_interface_is_not_available.lua new file mode 100755 index 0000000000..94a59381fa --- /dev/null +++ b/test_scripts/API/Navigation/GetWayPoints/004_GetWayPoints_UNSUPPORTED_RESOURCE_Navi_interface_is_not_available.lua @@ -0,0 +1,50 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/25 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Get%20Destination_and_Waypoints.md +-- Item: Use Case 3: Exception 3: Navigation interface is not available on HMI +-- +-- Requirement summary: +-- [GetWayPoints] As a mobile app I want to send a request to get the details of the destination +-- and waypoints set on the system so that I can get last mile connectivity. +-- +-- Description: +-- In case: +-- 1) mobile application sends valid and allowed by Policies GetWayPoints_request to SDL and navigation interface is not available on HMI +-- SDL must: +-- 1) respond "UNSUPPORTED_RESOURCE, success:false" to mobile application and not transfer this request to HMI + +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') +local hmi_values = require('user_modules/hmi_values') + +--[[ Local Functions ]] +local function disableNavigationIsReadyResponse() + local params = hmi_values.getDefaultHMITable() + params.Navigation.IsReady.params.available = false + return params +end + +local function getWayPoints(self) + local params = { + wayPointType = "ALL" + } + local cid = self.mobileSession1:SendRPC("GetWayPoints", params) + EXPECT_HMICALL("Navigation.GetWayPoints", params):Times(0) + self.mobileSession1:ExpectResponse(cid, { success = false, resultCode = "UNSUPPORTED_RESOURCE" }) + common:DelayedExp() +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start, { disableNavigationIsReadyResponse() }) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("GetWayPoints, navigation interface is not available on HMI", getWayPoints) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/GetWayPoints/005_GetWayPoints_INVALID_DATA.lua b/test_scripts/API/Navigation/GetWayPoints/005_GetWayPoints_INVALID_DATA.lua new file mode 100644 index 0000000000..7d657988cb --- /dev/null +++ b/test_scripts/API/Navigation/GetWayPoints/005_GetWayPoints_INVALID_DATA.lua @@ -0,0 +1,53 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/25 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/GetWayPoints/detailed_docs/TRS/embedded_navi/GetWayPoints_TRS.md +-- Item: Use Case 1: Exception 1: Request is invalid +-- +-- Requirement summary: +-- [GetWayPoints] As a mobile app I want to send a request to get the details of the destination +-- and waypoints set on the system so that I can get last mile connectivity. +-- +-- Description: +-- In case: +-- 1) mobile application sends invalid request to SDL +-- SDL must: +-- 1) SDL responds INVALID_DATA, success:false to mobile application and doesn't transfer request to HMI + +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Local Variables ]] +local paramsInvalidData = { + { name = "Invalid Name", value = { wayPoinTType = "ALL" } }, + { name = "Invalid Value", value = { wayPointType = "AALL" } }, + { name = "Invalid Type", value = { wayPointType = 55 } }, + { name = "Whitespaces", value = { wayPointType = " " } }, + { name = "Invalid json", value = { wayPointType = { "ALL" } } }, + { name = "Missing mandatory parameter", value = { wayPointType = nil } } +} + +--[[ Local Functions ]] +local function invalidDataSequence(pParams, self) + local cid = self.mobileSession1:SendRPC("GetWayPoints", pParams) + EXPECT_HMICALL("Navigation.GetWayPoints"):Times(0) + self.mobileSession1:ExpectResponse(cid, { success = false, resultCode = "INVALID_DATA" }) + common:DelayedExp() +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") + +for _, p in pairs(paramsInvalidData) do + runner.Step("GetWayPoints " .. p.name, invalidDataSequence, { p.value }) +end + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/GetWayPoints/006_GetWayPoints_GENERIC_ERROR_HMI_did_not_respond.lua b/test_scripts/API/Navigation/GetWayPoints/006_GetWayPoints_GENERIC_ERROR_HMI_did_not_respond.lua new file mode 100755 index 0000000000..291fd74dcc --- /dev/null +++ b/test_scripts/API/Navigation/GetWayPoints/006_GetWayPoints_GENERIC_ERROR_HMI_did_not_respond.lua @@ -0,0 +1,52 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/25 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Get%20Destination_and_Waypoints.md +-- Item: Use Case 1: Exception 5: HMI did not respond during default timeout +-- +-- Requirement summary: +-- [GetWayPoints] As a mobile app I want to send a request to get the details of the destination +-- and waypoints set on the system so that I can get last mile connectivity. +-- +-- Description: +-- In case: +-- 1) mobile application sends valid and allowed by Policies GetWayPoints_request to SDL +-- and HMI did not respond during default timeout +-- SDL must: +-- 1) SDL responds GENERIC_ERROR, success:false to mobile application + +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') +local commonTestCases = require('user_modules/shared_testcases/commonTestCases') + +--[[ Local Functions ]] +local function getWayPoints(self) + local params = { + wayPointType = "ALL" + } + local cid = self.mobileSession1:SendRPC("GetWayPoints", params) + + EXPECT_HMICALL("Navigation.GetWayPoints", params) + :ValidIf(function(_, data) + return data.params.appID == common.getHMIAppId() + end) + :Do(function() + -- HMI does not respond + end) + self.mobileSession1:ExpectResponse(cid, { success = false, resultCode = "GENERIC_ERROR"}) + commonTestCases:DelayedExp(11000) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("GetWayPoints, HMI did not respond", getWayPoints) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/GetWayPoints/007_GetWayPoints_GENERIC_ERROR_response_from_HMI_is_invalid.lua b/test_scripts/API/Navigation/GetWayPoints/007_GetWayPoints_GENERIC_ERROR_response_from_HMI_is_invalid.lua new file mode 100755 index 0000000000..d153b7b866 --- /dev/null +++ b/test_scripts/API/Navigation/GetWayPoints/007_GetWayPoints_GENERIC_ERROR_response_from_HMI_is_invalid.lua @@ -0,0 +1,66 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/25 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Get%20Destination_and_Waypoints.md +-- Item: Use Case 1: Exception 6: Response from HMI is invalid +-- +-- Requirement summary: +-- [GetWayPoints] As a mobile app I want to send a request to get the details of the destination +-- and waypoints set on the system so that I can get last mile connectivity. +-- +-- Description: +-- In case: +-- 1) mobile application sends valid and allowed by Policies GetWayPoints_request to SDL +-- and response from HMI is invalid +-- SDL must: +-- 1) SDL responds GENERIC_ERROR, success:false to mobile application + +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Local Variables ]] +local invalidResponse = { + wayPoints = { + { + coordinate = + { + latitudeDegrees = 0, + longitudeDegrees = 0 + }, + locationName = " ", + addressLines = { " ", " " } + } + } +} + +--[[ Local Functions ]] +local function getWayPoints(self) + local params = { + wayPointType = "ALL" + } + local cid = self.mobileSession1:SendRPC("GetWayPoints", params) + + invalidResponse.appID = common.getHMIAppId() + EXPECT_HMICALL("Navigation.GetWayPoints", params) + :ValidIf(function(_, data) + return data.params.appID == common.getHMIAppId() + end) + :Do(function(_, data) + self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", invalidResponse) + end) + self.mobileSession1:ExpectResponse(cid, { success = false, resultCode = "GENERIC_ERROR"}) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("GetWayPoints, response from HMI is invalid", getWayPoints) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/GetWayPoints/008_GetWayPoints_IN_USE_one_app.lua b/test_scripts/API/Navigation/GetWayPoints/008_GetWayPoints_IN_USE_one_app.lua new file mode 100755 index 0000000000..57ffc8868b --- /dev/null +++ b/test_scripts/API/Navigation/GetWayPoints/008_GetWayPoints_IN_USE_one_app.lua @@ -0,0 +1,124 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/25 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Get%20Destination_and_Waypoints.md +-- Item: Use Case 1: Main Flow +-- +-- Requirement summary: +-- [GetWayPoints] As a mobile app I want to send a request to get the details of the destination +-- and waypoints set on the system so that I can get last mile connectivity. +-- +-- Description: +-- In case: +-- 1) mobile application sends second valid and allowed request during the first one is processing on HMI +-- SDL must: +-- 1) respond "IN_USE, success:false" to mobile application +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') +local atf_logger = require("atf_logger") + +--[[ Local Variables ]] +local positiveReponse = { + wayPoints = { + { + coordinate = + { + latitudeDegrees = 1.1, + longitudeDegrees = 1.1 + }, + locationName = "Hotel", + addressLines = + { + "Hotel Bora", + "Hotel 5 stars" + }, + locationDescription = "VIP Hotel", + phoneNumber = "Phone39300434", + locationImage = + { + value ="icon.png", + imageType ="DYNAMIC", + }, + searchAddress = + { + countryName = "countryName", + countryCode = "countryCode", + postalCode = "postalCode", + administrativeArea = "administrativeArea", + subAdministrativeArea = "subAdministrativeArea", + locality = "locality", + subLocality = "subLocality", + thoroughfare = "thoroughfare", + subThoroughfare = "subThoroughfare" + } + } + } +} + +local emptyReponse = { } + +--[[ Local Functions ]] +local function log(msg) + print("[" .. atf_logger.formated_time(true) .. "] " .. msg) +end + +local function getWayPoints(self) + local request1 = { + wayPointType = "ALL" + } + local request2 = { + wayPointType = "DESTINATION" + } + + positiveReponse.appID = common.getHMIAppId() + emptyReponse.appID = common.getHMIAppId() + + log("App->SDL: 1st request") + local cid = self.mobileSession1:SendRPC("GetWayPoints", request1) + + EXPECT_HMICALL("Navigation.GetWayPoints", request1, request2) + :Do(function(exp, data) + if exp.occurences == 1 then + log("SDL->HMI: 1st request") + local function sendSecondRequest() + log("App->SDL: 2nd request") + local cid2 = self.mobileSession1:SendRPC("GetWayPoints", request2) + self.mobileSession1:ExpectResponse(cid2, { success = false, resultCode = "IN_USE"}) + :Do(function() + log("SDL->App: 2nd response IN_USE") + end) + end + RUN_AFTER(sendSecondRequest, 1000) + + local function sendReponse() + log("HMI->SDL: 1st response_SUCCESS") + self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", positiveReponse) + end + RUN_AFTER(sendReponse, 2000) + else + log("SDL->HMI: 2nd request") + log("HMI->SDL: 2nd response_IN_USE") + self.hmiConnection:SendResponse(data.id, data.method, "IN_USE", emptyReponse) + end + end) + :Times(2) + + self.mobileSession1:ExpectResponse(cid, { success = true, resultCode = "SUCCESS"}) + :Do(function() + log("SDL->App: 1st response SUCCESS") + end) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("GetWayPoints, IN_USE for 2nd request during the 1st one is processing on HMI", getWayPoints) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/GetWayPoints/009_GetWayPoints_IN_USE_two_apps.lua b/test_scripts/API/Navigation/GetWayPoints/009_GetWayPoints_IN_USE_two_apps.lua new file mode 100755 index 0000000000..ab59c3d54c --- /dev/null +++ b/test_scripts/API/Navigation/GetWayPoints/009_GetWayPoints_IN_USE_two_apps.lua @@ -0,0 +1,123 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/25 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Get%20Destination_and_Waypoints.md +-- Item: Use Case 1: Main Flow +-- +-- Requirement summary: +-- [GetWayPoints] As a mobile app I want to send a request to get the details of the destination +-- and waypoints set on the system so that I can get last mile connectivity. +-- +-- Description: +-- In case: +-- 1) app2 sends second valid and allowed request during first one request from app1 is processing on HMI +-- SDL must: +-- 1) process 2nd request successfully +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') +local atf_logger = require("atf_logger") + +--[[ Local Variables ]] +local response = { + wayPoints = { + { + coordinate = + { + latitudeDegrees = 1.1, + longitudeDegrees = 1.1 + }, + locationName = "Hotel", + addressLines = + { + "Hotel Bora", + "Hotel 5 stars" + }, + locationDescription = "VIP Hotel", + phoneNumber = "Phone39300434", + locationImage = + { + value ="icon.png", + imageType ="DYNAMIC", + }, + searchAddress = + { + countryName = "countryName", + countryCode = "countryCode", + postalCode = "postalCode", + administrativeArea = "administrativeArea", + subAdministrativeArea = "subAdministrativeArea", + locality = "locality", + subLocality = "subLocality", + thoroughfare = "thoroughfare", + subThoroughfare = "subThoroughfare" + } + } + } +} + +--[[ Local Functions ]] +local function log(msg) + print("[" .. atf_logger.formated_time(true) .. "] " .. msg) +end + +local function getWayPoints(self) + local request1 = { + wayPointType = "ALL" + } + local request2 = { + wayPointType = "DESTINATION" + } + + log("App1->SDL: 1st request") + local cid = self.mobileSession1:SendRPC("GetWayPoints", request1) + + EXPECT_HMICALL("Navigation.GetWayPoints", request1, request2) + :Do(function(exp, data) + if exp.occurences == 1 then + log("SDL->HMI: 1st request") + local function sendSecondRequest() + log("App2->SDL: 2nd request") + local cid2 = self.mobileSession2:SendRPC("GetWayPoints", request2) + self.mobileSession2:ExpectResponse(cid2, { success = true, resultCode = "SUCCESS" }) + :Do(function() + log("SDL->App2: 2nd response SUCCESS") + end) + end + RUN_AFTER(sendSecondRequest, 1000) + + local function sendReponse() + log("HMI->SDL: 1st response SUCCESS") + response.appID = common.getHMIAppId(1) + self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", response) + end + RUN_AFTER(sendReponse, 2000) + else + log("SDL->HMI: 2nd request") + log("HMI->SDL: 2nd response SUCCESS") + response.appID = common.getHMIAppId(2) + self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", response) + end + end) + :Times(2) + self.mobileSession1:ExpectResponse(cid, { success = true, resultCode = "SUCCESS" }) + :Do(function() + log("SDL->App1: 1st response SUCCESS") + end) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) + +for i = 1, 2 do + runner.Step("RAI, PTU " .. i, common.registerAppWithPTU, { i }) + runner.Step("Activate App " .. i, common.activateApp, { i }) +end + +runner.Title("Test") +runner.Step("GetWayPoints, SUCCESS for 2nd request during the 1st one is processing on HMI", getWayPoints) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/GetWayPoints/010_GetWayPoints_without_wayPoints.lua b/test_scripts/API/Navigation/GetWayPoints/010_GetWayPoints_without_wayPoints.lua new file mode 100755 index 0000000000..524db324c0 --- /dev/null +++ b/test_scripts/API/Navigation/GetWayPoints/010_GetWayPoints_without_wayPoints.lua @@ -0,0 +1,59 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/25 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Get%20Destination_and_Waypoints.md +-- Item: Use Case 1: Main Flow +-- +-- Requirement summary: +-- [GetWayPoints] As a mobile app I want to send a request to get the details of the destination +-- and waypoints set on the system so that I can get last mile connectivity. +-- +-- Description: +-- In case: +-- 1) mobile application sends valid and allowed by Policies GetWayPoints_request to SDL +-- SDL must: +-- 1) Transfer GetWayPoints_request to HMI +-- 2) Respond with received from HMI to mobile application + +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +local response = {} + +--[[ Local Functions ]] +local function getWayPoints(self) + local params = { + wayPointType = "ALL" + } + local cid = self.mobileSession1:SendRPC("GetWayPoints", params) + + response.appID = common.getHMIAppId() + EXPECT_HMICALL("Navigation.GetWayPoints", params) + :ValidIf(function(_, data) + return data.params.appID == common.getHMIAppId() + end) + :Do(function(_,data) + self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", response) + end) + self.mobileSession1:ExpectResponse(cid, { success = true, resultCode = "SUCCESS" }) + :ValidIf(function(_, data) + if data.payload.wayPoints ~= nil then + return false, "wayPoints parameter is not expected" + end + return true + end) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("GetWayPoints, without wayPoints", getWayPoints) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/GetWayPoints/011_GetWayPoints_several_responses.lua b/test_scripts/API/Navigation/GetWayPoints/011_GetWayPoints_several_responses.lua new file mode 100644 index 0000000000..ec886e2cc7 --- /dev/null +++ b/test_scripts/API/Navigation/GetWayPoints/011_GetWayPoints_several_responses.lua @@ -0,0 +1,62 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/25 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Get%20Destination_and_Waypoints.md +-- Item: Use Case 1: Main Flow +-- +-- Requirement summary: +-- [GetWayPoints] As a mobile app I want to send a request to get the details of the destination +-- and waypoints set on the system so that I can get last mile connectivity. +-- +-- Description: +-- In case: +-- 1) mobile application sends valid and allowed by Policies GetWayPoints_request to SDL +-- 2) GetWayPoints_request is transfered to HMI +-- 3) HMI sends several different responses to request +-- SDL must: +-- 1) Process first received response from HMI and responds with success to mobile app + +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +local response = { + wayPoints = { + { + coordinate = + { + latitudeDegrees = 1.1, + longitudeDegrees = 1.1 + } + } + } +} + +--[[ Local Functions ]] +local function GetWayPoints(pWayPointType, self) + local params = { + wayPointType = pWayPointType + } + local cid = self.mobileSession1:SendRPC("GetWayPoints", params) + response.appID = common.getHMIAppId() + EXPECT_HMICALL("Navigation.GetWayPoints", params) + :Do(function(_,data) + self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", response) + self.hmiConnection:SendError(data.id, data.method, "REJECTED", "Error result code") + self.hmiConnection:SendError(data.id, data.method, "INVALID_DATA", "Error result code") + end) + self.mobileSession1: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("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("GetWayPoints_several_responses", GetWayPoints, { "ALL" }) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/GetWayPoints/012_GetWayPoints_boundary_values.lua b/test_scripts/API/Navigation/GetWayPoints/012_GetWayPoints_boundary_values.lua new file mode 100644 index 0000000000..877b3da5c6 --- /dev/null +++ b/test_scripts/API/Navigation/GetWayPoints/012_GetWayPoints_boundary_values.lua @@ -0,0 +1,174 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/25 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Get%20Destination_and_Waypoints.md +-- Item: Use Case 1: Main Flow +-- +-- Requirement summary: +-- [GetWayPoints] As a mobile app I want to send a request to get the details of the destination +-- and waypoints set on the system so that I can get last mile connectivity. +-- +-- Description: +-- In case: +-- 1) mobile application sends valid and allowed by Policies GetWayPoints_request to SDL +-- with boundary value of parameters. +-- SDL must: +-- 1) Transfer GetWayPoints_request to HMI +-- 2) Respond with received from HMI to mobile application +-- 3) Provide the requested parameters at the same order as received from HMI +-- to mobile application (in case of successfull response) +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') +local commonFunctions = require("user_modules/shared_testcases/commonFunctions") +local json = require('modules/json') + +--[[ Local Variables ]] +local response = { + { + coordinate = { + latitudeDegrees = 90, + longitudeDegrees = 180 + }, + locationName = string.rep("a", 500), + addressLines = { + string.rep("b", 500), + string.rep("c", 500), + string.rep("d", 500), + string.rep("e", 500) + }, + locationDescription = string.rep("f", 500), + phoneNumber = string.rep("j", 500), + locationImage = { + value = string.rep("a", 65531) .. ".png", + imageType ="DYNAMIC", + }, + searchAddress = { + countryName = string.rep("a", 200), + countryCode = string.rep("a", 50), + postalCode = string.rep("a", 16), + administrativeArea = string.rep("a", 200), + subAdministrativeArea = string.rep("a", 200), + locality = string.rep("a", 200), + subLocality = string.rep("a", 200), + thoroughfare = string.rep("a", 200), + subThoroughfare = string.rep("a", 200) + } + }, + { + coordinate = { + latitudeDegrees = -90, + longitudeDegrees = -180 + }, + locationName = "a", + addressLines = json.EMPTY_ARRAY, + locationDescription = "a", + phoneNumber = "b", + locationImage = { + value = "a", + imageType ="DYNAMIC", + }, + searchAddress = { + countryName = "", + countryCode = "", + postalCode = "", + administrativeArea = "", + subAdministrativeArea = "", + locality = "", + subLocality = "", + thoroughfare = "", + subThoroughfare = "" + } + } +} + +local WayPointsArray = {} +local WayPointsArrayValue = {} +local WayPointsArraySize = 3 +for i=1, WayPointsArraySize do + WayPointsArray[i] = { + coordinate = { + latitudeDegrees = 10, + longitudeDegrees = 10 + } + } +end +for i=1, WayPointsArraySize do + WayPointsArrayValue[i] = response[1] +end + +--[[ Local Functions ]] +local function GetWayPoints(pWayPointType, responseValue, self) + local params = { + wayPointType = pWayPointType + } + + local cid = self.mobileSession1:SendRPC("GetWayPoints", params) + local HMIresponse = {} + HMIresponse.wayPoints = responseValue + HMIresponse.appID = common.getHMIAppId() + + EXPECT_HMICALL("Navigation.GetWayPoints", params) + :ValidIf(function(_, data) + if data.params.appID == common.getHMIAppId() then + return true + else + return false, "Wrong value of appID in HMI request" + end + end) + :Do(function(_,data) + self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", HMIresponse) + end) + + self.mobileSession1:ExpectResponse(cid, { success = true, resultCode = "SUCCESS" }) + :ValidIf(function(_, data) -- checking order of wayPoints + local ErroMessage = "" + local resultStatus = true + if data.payload.wayPoints then + for k in pairs(data.payload.wayPoints) do + local actualCoordinate = data.payload.wayPoints[k].coordinate + local expectedCoordinate = responseValue[k].coordinate + if (actualCoordinate.latitudeDegrees ~= expectedCoordinate.latitudeDegrees) or + (actualCoordinate.longitudeDegrees ~= expectedCoordinate.longitudeDegrees) then + resultStatus = false + ErroMessage = ErroMessage .. "WayPoints order is not as expected" + end + end + for k in pairs(data.payload.wayPoints) do + if not commonFunctions:is_table_equal(data.payload.wayPoints[k], responseValue[k]) then + resultStatus = false + ErroMessage = ErroMessage .. "Waypoints data is not as expected" + end + end + else + resultStatus = false + ErroMessage = ErroMessage .. "Mobile response does not contain wayPoints array" + end + if resultStatus == true then + return true + else + return false, ErroMessage + end + end) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +for _, wayPointType in pairs({ "ALL", "DESTINATION" }) do + runner.Step("GetWayPoints wayPointType " .. wayPointType .. " boundary values", GetWayPoints, + { wayPointType, response }) +end +runner.Step("GetWayPoints wayPointType array size upper bound", GetWayPoints, + { "ALL", WayPointsArray }) +runner.Step("GetWayPoints wayPointType array size and values upper bound", GetWayPoints, + { "ALL", WayPointsArrayValue }) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/GetWayPoints/013_GetWayPoints_verify_correlationID_parameter.lua b/test_scripts/API/Navigation/GetWayPoints/013_GetWayPoints_verify_correlationID_parameter.lua new file mode 100644 index 0000000000..8a9375acf2 --- /dev/null +++ b/test_scripts/API/Navigation/GetWayPoints/013_GetWayPoints_verify_correlationID_parameter.lua @@ -0,0 +1,140 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/25 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Get%20Destination_and_Waypoints.md +-- Item: Use Case 1: Main Flow +-- +-- Requirement summary: +-- [GetWayPoints] As a mobile app I want to send a request to get the details of the destination +-- and waypoints set on the system so that I can get last mile connectivity. +-- +-- Description: +-- In case: +-- 1) mobile application sends valid and allowed by Policies GetWayPoints_request to SDL +-- Response from HMI contains wrong correlation id +-- SDL must: +-- 1) Respond with success = false, resultCode = "GENERIC_ERROR" +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') +local commonFunctions = require('user_modules/shared_testcases/commonFunctions') + +--[[ Local Variables ]] +local response = { + wayPoints = { + { + coordinate = + { + latitudeDegrees = 1.1, + longitudeDegrees = 1.1 + } + } + } +} + +--[[ Local Functions ]] +local function CorrelationIDMissing(pWayPointType, self) + local params = { + wayPointType = pWayPointType + } + local cid = self.mobileSession1:SendRPC("GetWayPoints", params) + EXPECT_HMICALL("Navigation.GetWayPoints", params) + :ValidIf(function(_, data) + if data.params.appID == common.getHMIAppId() then + return true + else + return false, "Wrong value of appID in HMI request" + end + end) + :Do(function() + self.hmiConnection:Send('{"jsonrpc":"2.0","result":{"method":"Navigation.GetWayPoints", "code":0}}') + end) + self.mobileSession1:ExpectResponse(cid, { success = false, resultCode = "GENERIC_ERROR" }) + :Timeout(11000) + :ValidIf(function(_,data) + if data.payload.wayPoints then + return false, "SDL sends wayPoints in error response" + else + return true + end + end) +end + +local function CorrelationIDWrongType(pWayPointType, self) + local params = { + wayPointType = pWayPointType + } + local cid = self.mobileSession1:SendRPC("GetWayPoints", params) + local lResponse = commonFunctions:cloneTable(response) + lResponse.appID = common.getHMIAppId() + EXPECT_HMICALL("Navigation.GetWayPoints", params) + :ValidIf(function(_, data) + if data.params.appID == common.getHMIAppId() then + return true + else + return false, "Wrong value of appID in HMI request" + end + end) + :Do(function(_,data) + self.hmiConnection:SendResponse(tostring(data.id), data.method, "SUCCESS", lResponse) + end) + self.mobileSession1:ExpectResponse(cid, { success = false, resultCode = "GENERIC_ERROR" }) + :Timeout(11000) + :ValidIf(function(_,data) + if data.payload.wayPoints then + return false, "SDL sends wayPoints in error response" + else + return true + end + end) +end + +local function CorrelationIDNotExisted(pWayPointType, self) + local params = { + wayPointType = pWayPointType + } + local cid = self.mobileSession1:SendRPC("GetWayPoints", params) + local lResponse = commonFunctions:cloneTable(response) + lResponse.appID = common.getHMIAppId() + EXPECT_HMICALL("Navigation.GetWayPoints", params) + :ValidIf(function(_, data) + if data.params.appID == common.getHMIAppId() then + return true + else + return false, "Wrong value of appID in HMI request" + end + end) + :Do(function(_,data) + self.hmiConnection:SendResponse(999, data.method, "SUCCESS", lResponse) + end) + self.mobileSession1:ExpectResponse(cid, { success = false, resultCode = "GENERIC_ERROR" }) + :Timeout(11000) + :ValidIf(function(_,data) + if data.payload.wayPoints then + return false, "SDL sends wayPoints in error response" + else + return true + end + end) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +for _, wayPointType in pairs({ "ALL", "DESTINATION" }) do + runner.Step("GetWayPoints CorrelationIDMissing wayPointType " .. wayPointType, CorrelationIDMissing, + { wayPointType }) + runner.Step("GetWayPoints CorrelationIDWrongType wayPointType " .. wayPointType, CorrelationIDWrongType, + { wayPointType }) + runner.Step("GetWayPoints CorrelationIDNotExisted wayPointType " .. wayPointType, CorrelationIDNotExisted, + { wayPointType }) +end + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/GetWayPoints/014_GetWayPoints_OnResetTimeout.lua b/test_scripts/API/Navigation/GetWayPoints/014_GetWayPoints_OnResetTimeout.lua new file mode 100644 index 0000000000..5c81cbad3b --- /dev/null +++ b/test_scripts/API/Navigation/GetWayPoints/014_GetWayPoints_OnResetTimeout.lua @@ -0,0 +1,102 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/25 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Get%20Destination_and_Waypoints.md +-- Item: Use Case 1: Main Flow +-- +-- Requirement summary: +-- [GetWayPoints] As a mobile app I want to send a request to get the details of the destination +-- and waypoints set on the system so that I can get last mile connectivity. +-- +-- Description: +-- In case: +-- 1) HMI needs more time for processing GetWayPoints request and sends OnResetTimeout to SDL +-- SDL must: +-- 1) renew the default timeout for the GetWayPoints +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Local Variables ]] +local response = { + wayPoints = { + { + coordinate = + { + latitudeDegrees = 1.1, + longitudeDegrees = 1.1 + }, + locationName = "Hotel", + addressLines = + { + "Hotel Bora", + "Hotel 5 stars" + }, + locationDescription = "VIP Hotel", + phoneNumber = "Phone39300434", + locationImage = + { + value ="icon.png", + imageType ="DYNAMIC", + }, + searchAddress = + { + countryName = "countryName", + countryCode = "countryCode", + postalCode = "postalCode", + administrativeArea = "administrativeArea", + subAdministrativeArea = "subAdministrativeArea", + locality = "locality", + subLocality = "subLocality", + thoroughfare = "thoroughfare", + subThoroughfare = "subThoroughfare" + } + } + } +} + +--[[ Local Functions ]] +local function GetWayPoints(pWayPointType, self) + local params = { + wayPointType = pWayPointType + } + local cid = self.mobileSession1:SendRPC("GetWayPoints", params) + response.appID = common.getHMIAppId() + EXPECT_HMICALL("Navigation.GetWayPoints", params) + :ValidIf(function(_, data) + if data.params.appID == common.getHMIAppId() then + return true + else + return false, "Wrong value of appID in HMI request" + end + end) + :Do(function(_,data) + local function SendOnResetTimeout() + self.hmiConnection:SendNotification("UI.OnResetTimeout", + { appID = common.getHMIAppId(), methodName = "Navigation.GetWayPoints" }) + end + RUN_AFTER(SendOnResetTimeout, 8000) + local function sendReponse() + self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", response) + end + RUN_AFTER(sendReponse, 15000) + end) + self.mobileSession1:ExpectResponse(cid, { success = true, resultCode = "SUCCESS" }) + :Timeout(16000) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +for _, wayPointType in pairs({ "ALL", "DESTINATION" }) do + runner.Step("GetWayPoints OnResetTimeout wayPointType " .. wayPointType, GetWayPoints, { wayPointType }) +end + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/GetWayPoints/015_GetWayPoints_empty_wayPoints.lua b/test_scripts/API/Navigation/GetWayPoints/015_GetWayPoints_empty_wayPoints.lua new file mode 100755 index 0000000000..46561e0755 --- /dev/null +++ b/test_scripts/API/Navigation/GetWayPoints/015_GetWayPoints_empty_wayPoints.lua @@ -0,0 +1,54 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/25 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Get%20Destination_and_Waypoints.md +-- Item: Use Case 1: Main Flow +-- +-- Requirement summary: +-- [GetWayPoints] As a mobile app I want to send a request to get the details of the destination +-- and waypoints set on the system so that I can get last mile connectivity. +-- +-- Description: +-- In case: +-- 1) mobile application sends valid and allowed by Policies GetWayPoints_request to SDL +-- SDL must: +-- 1) Transfer GetWayPoints_request to HMI +-- 2) Respond with received from HMI to mobile application +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Local Variables ]] +local response = { wayPoints = {{ }}} + +--[[ Local Functions ]] +local function getWayPoints(self) + local params = { + wayPointType = "ALL" + } + local cid = self.mobileSession1:SendRPC("GetWayPoints", params) + + response.appID = common.getHMIAppId() + EXPECT_HMICALL("Navigation.GetWayPoints", params) + :ValidIf(function(_, data) + return data.params.appID == common.getHMIAppId() + end) + :Do(function(_,data) + self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", response) + end) + self.mobileSession1: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("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("GetWayPoints empty wayPoints element", getWayPoints) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/GetWayPoints/016_GetWayPoints_bound_value_by_parameters.lua b/test_scripts/API/Navigation/GetWayPoints/016_GetWayPoints_bound_value_by_parameters.lua new file mode 100644 index 0000000000..d5d9b9e4b0 --- /dev/null +++ b/test_scripts/API/Navigation/GetWayPoints/016_GetWayPoints_bound_value_by_parameters.lua @@ -0,0 +1,134 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/25 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Get%20Destination_and_Waypoints.md +-- Item: Use Case 1: Main Flow +-- +-- Requirement summary: +-- [GetWayPoints] As a mobile app I want to send a request to get the details of the destination +-- and waypoints set on the system so that I can get last mile connectivity. +-- +-- Description: +-- In case: +-- 1) mobile application sends valid and allowed by Policies GetWayPoints_request to SDL +-- SDL must: +-- 1) Transfer GetWayPoints_request to HMI +-- 2) Respond with received from HMI to mobile application +-- 3) Provide the requested parameters at the same order as received from HMI +-- to mobile application (in case of successfull response) + +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Local Variables ]] +local string65535char = string.rep("a", 65535) +local string500char = string.rep("a", 500) +local string200char = string.rep("a", 200) +local string50char = string.rep("a", 50) +local string16char = string.rep("a", 16) +local minLen = "a" +local wayPointTypeDefault = "ALL" +local imageTypes = { "DYNAMIC", "STATIC" } +local LocationDetailsStringParams = { + "locationName", + "locationDescription", + "phoneNumber" +} +local coordinateParams = { + latitudeDegrees = { lower = -90, upper = 90 }, + longitudeDegrees = { lower = -180, upper = 180 } +} +local OASISAddressParams = { + countryName = { lower = minLen, upper = string200char }, + countryCode = { lower = minLen, upper = string50char }, + postalCode = { lower = minLen, upper = string16char }, + administrativeArea = { lower = minLen, upper = string200char }, + subAdministrativeArea = { lower = minLen, upper = string200char }, + locality = { lower = minLen, upper = string200char }, + subLocality = { lower = minLen, upper = string200char }, + thoroughfare = { lower = minLen, upper = string200char }, + subThoroughfare = { lower = minLen, upper = string200char } +} +local addressLinesArraySize = 4 +local maxAddressLinesArray = {} +for i=1,addressLinesArraySize do + maxAddressLinesArray[i] = "string" +end +local maxAddressLinesArrayValue = {} +for i=1,addressLinesArraySize do + maxAddressLinesArrayValue[i] = string500char +end + +--[[ Local Functions ]] +local function GetWayPoints(parameter, value, self) + local params = { + wayPointType = wayPointTypeDefault + } + + local cid = self.mobileSession1:SendRPC("GetWayPoints", params) + params.appID = common.getHMIAppId() + local lResponse = { } + lResponse.wayPoints = {{ [parameter] = value }} + lResponse.appID = common.getHMIAppId() + + EXPECT_HMICALL("Navigation.GetWayPoints", params) + :Do(function(_,data) + self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", lResponse) + end) + + self.mobileSession1:ExpectResponse(cid, { success = true, resultCode = "SUCCESS", wayPoints = lResponse.wayPoints }) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Title("Lower bound") +for _, value in pairs(LocationDetailsStringParams) do + runner.Step("GetWayPoints_wayPoints_lower_bound_" .. value , GetWayPoints, { value, minLen }) +end +for k, value in pairs(OASISAddressParams) do + runner.Step("GetWayPoints_wayPoints_lower_bound_searchAddress_" .. k , GetWayPoints, + { "searchAddress", { [k] = value.lower }}) +end +runner.Step("GetWayPoints_wayPoints_lower_bound_value_array_addressLines" , GetWayPoints, + { "addressLines", { minLen }}) +runner.Step("GetWayPoints_wayPoints_lower_bound_latitudeDegrees" , GetWayPoints, + { "coordinate", { latitudeDegrees = coordinateParams.latitudeDegrees.lower, longitudeDegrees = 0.1 }}) +runner.Step("GetWayPoints_wayPoints_lower_bound_longitudeDegrees" , GetWayPoints, + { "coordinate", { latitudeDegrees = 0.1, longitudeDegrees = coordinateParams.longitudeDegrees.lower }}) +for _, value in pairs(imageTypes) do + runner.Step("GetWayPoints_wayPoints_lower_bound_locationImage_value_" .. value , GetWayPoints, + { "locationImage", { value = "a", imageType = value }}) +end + +runner.Title("Upper bound") +for _, value in pairs(LocationDetailsStringParams) do + runner.Step("GetWayPoints_wayPoints_upper_bound_" .. value , GetWayPoints, { value, string500char }) +end +for k, value in pairs(OASISAddressParams) do + runner.Step("GetWayPoints_wayPoints_upper_bound_searchAddress_" .. k , GetWayPoints, + { "searchAddress", { [k] = value.upper }}) +end +runner.Step("GetWayPoints_wayPoints_upper_bound_value_addressLines" , GetWayPoints, + { "addressLines", { string500char }}) +runner.Step("GetWayPoints_wayPoints_upper_bound_array_addressLines" , GetWayPoints, + { "addressLines", maxAddressLinesArray }) +runner.Step("GetWayPoints_wayPoints_upper_bound_value_array_addressLines" , GetWayPoints, + { "addressLines", maxAddressLinesArrayValue }) +runner.Step("GetWayPoints_wayPoints_upper_bound_latitudeDegrees" , GetWayPoints, + { "coordinate", { latitudeDegrees = coordinateParams.latitudeDegrees.upper, longitudeDegrees = 0.1 }}) +runner.Step("GetWayPoints_wayPoints_upper_bound_longitudeDegrees" , GetWayPoints, + { "coordinate", { latitudeDegrees = 0.1, longitudeDegrees = coordinateParams.longitudeDegrees.upper }}) +for _, value in pairs(imageTypes) do + runner.Step("GetWayPoints_wayPoints_upper_bound_locationImage_value_" .. value , GetWayPoints, + { "locationImage", { value = string65535char, imageType = value }}) +end + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/GetWayPoints/017_GetWayPoints_out_bound_value_by_parameters.lua b/test_scripts/API/Navigation/GetWayPoints/017_GetWayPoints_out_bound_value_by_parameters.lua new file mode 100644 index 0000000000..0d40223ae3 --- /dev/null +++ b/test_scripts/API/Navigation/GetWayPoints/017_GetWayPoints_out_bound_value_by_parameters.lua @@ -0,0 +1,119 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/25 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Get%20Destination_and_Waypoints.md +-- Item: Use Case 1: Main Flow +-- +-- Requirement summary: +-- [GetWayPoints] As a mobile app I want to send a request to get the details of the destination +-- and waypoints set on the system so that I can get last mile connectivity. +-- +-- Description: +-- In case: +-- 1) mobile application sends valid and allowed by Policies GetWayPoints_request to SDL +-- 2) HMI responds with out of bound values to SDL +-- SDL must: +-- 1) respond to mobile INVALID_DATA, success:false + +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Local Variables ]] +local string65536char = string.rep("a", 65536) +local string501char = string.rep("a", 501) +local string201char = string.rep("a", 201) +local string51char = string.rep("a", 51) +local string17char = string.rep("a", 17) +local wayPointTypeDefault = "ALL" +local imageTypes = { "DYNAMIC", "STATIC" } +local LocationDetailsStringParams = { + "locationName", + "locationDescription", + "phoneNumber" +} +local coordinateParams = { + latitudeDegrees = { lower = -90.1, upper = 90.1 }, + longitudeDegrees = { lower = -180.1, upper = 180.1 } +} +local OASISAddressParams = { + countryName = { upper = string201char }, + countryCode = { upper = string51char }, + postalCode = { upper = string17char }, + administrativeArea = { upper = string201char }, + subAdministrativeArea = { upper = string201char }, + locality = { upper = string201char }, + subLocality = { upper = string201char }, + thoroughfare = { upper = string201char }, + subThoroughfare = { upper = string201char } +} +local addressLinesArraySize = 5 +local maxAddressLinesArray = {} +for i=1,addressLinesArraySize do + maxAddressLinesArray[i] = "string" +end + +--[[ Local Functions ]] +local function GetWayPoints(parameter, value, self) + local params = { + wayPointType = wayPointTypeDefault + } + + local cid = self.mobileSession1:SendRPC("GetWayPoints", params) + params.appID = common.getHMIAppId() + local lResponse = { } + lResponse.wayPoints = {{ [parameter] = value }} + lResponse.appID = common.getHMIAppId() + + EXPECT_HMICALL("Navigation.GetWayPoints", params) + :Do(function(_,data) + self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", lResponse) + end) + + self.mobileSession1:ExpectResponse(cid, { success = false, resultCode = "INVALID_DATA" }) + :ValidIf(function(_,data) + if data.payload.wayPoints then + return false, "SDL sends wayPoints in error response" + else + return true + end + end) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Title("Out lower bound") +runner.Step("GetWayPoints_wayPoints_lower_bound_latitudeDegrees" , GetWayPoints, + { "coordinate", { latitudeDegrees = coordinateParams.latitudeDegrees.lower, longitudeDegrees = 0.1 }}) +runner.Step("GetWayPoints_wayPoints_lower_bound_longitudeDegrees" , GetWayPoints, + { "coordinate", { latitudeDegrees = 0.1, longitudeDegrees = coordinateParams.longitudeDegrees.lower }}) + +runner.Title("Out upper bound") +for _, value in pairs(LocationDetailsStringParams) do + runner.Step("GetWayPoints_wayPoints_upper_bound_" .. value , GetWayPoints, { value, string501char }) +end +for k, value in pairs(OASISAddressParams) do + runner.Step("GetWayPoints_wayPoints_upper_bound_searchAddress_" .. k , GetWayPoints, + { "searchAddress", { [k] = value.upper }}) +end +runner.Step("GetWayPoints_wayPoints_upper_bound_value_addressLines" , GetWayPoints, + { "addressLines", { string501char }}) +runner.Step("GetWayPoints_wayPoints_upper_bound_array_addressLines" , GetWayPoints, + { "addressLines", maxAddressLinesArray }) +runner.Step("GetWayPoints_wayPoints_upper_bound_latitudeDegrees" , GetWayPoints, + { "coordinate", { latitudeDegrees = coordinateParams.latitudeDegrees.upper, longitudeDegrees = 0.1 }}) +runner.Step("GetWayPoints_wayPoints_upper_bound_longitudeDegrees" , GetWayPoints, + { "coordinate", { latitudeDegrees = 0.1, longitudeDegrees = coordinateParams.longitudeDegrees.upper }}) +for _, value in pairs(imageTypes) do + runner.Step("GetWayPoints_wayPoints_upper_bound_locationImage_value_" .. value , GetWayPoints, + { "locationImage", { value = string65536char, imageType = value }}) +end + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/GetWayPoints/018_GetWayPoints_fake_parameters.lua b/test_scripts/API/Navigation/GetWayPoints/018_GetWayPoints_fake_parameters.lua new file mode 100644 index 0000000000..658a21bc96 --- /dev/null +++ b/test_scripts/API/Navigation/GetWayPoints/018_GetWayPoints_fake_parameters.lua @@ -0,0 +1,200 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/25 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Get%20Destination_and_Waypoints.md +-- Item: Use Case 1: Main Flow +-- +-- Requirement summary: +-- [GetWayPoints] As a mobile app I want to send a request to get the details of the destination +-- and waypoints set on the system so that I can get last mile connectivity. +-- +-- Description: +-- In case: +-- 1) mobile application sends valid and allowed by Policies GetWayPoints_request to SDL with fake params +-- SDL must: +-- 1) Transfer GetWayPoints_request to HMI without fake params +-- 2) Respond with received from HMI to mobile application +-- 3) Provide the requested parameters at the same order as received from HMI +-- to mobile application (in case of successfull response) and without fake parameters + +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Local Variables ]] +local requestFake = { + wayPointType = "ALL", + fakeParameter = 1 +} + +local requestAnotherReq = { + wayPointType = "ALL", + initialText = "initialText" +} + +local responseFake = { + wayPoints = { + { + coordinate = + { + latitudeDegrees = 1.1, + longitudeDegrees = 1.1, + fakeParameter = "fakeParameter" + }, + locationName = "Hotel", + fakeParameter = "fakeParameter", + addressLines = + { + "Hotel Bora", + "Hotel 5 stars" + }, + locationDescription = "VIP Hotel", + phoneNumber = "Phone39300434", + locationImage = + { + value ="icon.png", + imageType ="DYNAMIC", + fakeParameter = "fakeParameter" + }, + searchAddress = + { + countryName = "countryName", + countryCode = "countryCode", + postalCode = "postalCode", + administrativeArea = "administrativeArea", + subAdministrativeArea = "subAdministrativeArea", + locality = "locality", + subLocality = "subLocality", + thoroughfare = "thoroughfare", + subThoroughfare = "subThoroughfare", + fakeParameter = "fakeParameter" + } + } + } +} + +local responseAnotherReq = { + wayPoints = { + { + coordinate = + { + latitudeDegrees = 1.1, + longitudeDegrees = 1.1, + initialText = "initialText" + }, + locationName = "Hotel", + initialText = "initialText", + addressLines = + { + "Hotel Bora", + "Hotel 5 stars" + }, + locationDescription = "VIP Hotel", + phoneNumber = "Phone39300434", + locationImage = + { + value ="icon.png", + imageType ="DYNAMIC", + initialText = "initialText" + }, + searchAddress = + { + countryName = "countryName", + countryCode = "countryCode", + postalCode = "postalCode", + administrativeArea = "administrativeArea", + subAdministrativeArea = "subAdministrativeArea", + locality = "locality", + subLocality = "subLocality", + thoroughfare = "thoroughfare", + subThoroughfare = "subThoroughfare", + initialText = "initialText" + } + } + } +} + +--[[ Local Functions ]] +local function cloneTableWithOmitting(original) + local copy = { } + for k, v in pairs(original) do + if type(v) == 'table' then + v = cloneTableWithOmitting(v) + end + if + k ~= "fakeParameter" and + k ~= "initialText" then + copy[k] = v + end + end + return copy +end + +local function GetWayPointsReqCheck(request, self) + local cid = self.mobileSession1:SendRPC("GetWayPoints", request) + local lRequest = cloneTableWithOmitting(request) + lRequest.appID = common.getHMIAppId() + local lResponse = { } + lResponse.wayPoints = {{ locationName = "Hotel" }} + lResponse.appID = common.getHMIAppId() + EXPECT_HMICALL("Navigation.GetWayPoints", lRequest) + :Do(function(_,data) + self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", lResponse) + end) + :ValidIf(function(_,data) + if data.initialText then + return false, "SDL resends to HMI fake parameters from mobile request" + elseif data.fakeParameter then + return false, "SDL resends to HMI parameters from another API from mobile request" + else + return true + end + end) + self.mobileSession1:ExpectResponse(cid, { success = true, resultCode = "SUCCESS", wayPoints = lResponse.wayPoints }) +end + +local function GetWayPointsResCheck(response, self) + local requestParams = { wayPointType = "ALL" } + local cid = self.mobileSession1:SendRPC("GetWayPoints", requestParams) + requestParams.appID = common.getHMIAppId() + response.appID = common.getHMIAppId() + EXPECT_HMICALL("Navigation.GetWayPoints", requestParams) + :Do(function(_,data) + self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", response) + end) + local lResponse = cloneTableWithOmitting(response) + self.mobileSession1:ExpectResponse(cid, { success = true, resultCode = "SUCCESS", wayPoints = lResponse.wayPoints }) + :ValidIf(function(_,data) + for _, value in pairs(data.payload.wayPoints) do + if value.fakeParameter or + value.coordinate.fakeParameter or + value.locationImage.fakeParameter or + value.searchAddress.fakeParameter then + return false, "SDL resends fake parameters in HMI response to mobile app" + elseif value.initialText or + value.coordinate.initialText or + value.locationImage.initialText or + value.searchAddress.initialText then + return false, "SDL resends parameters from another API in HMI response to mobile app" + else + return true + end + end + end) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("GetWayPoints_fake_params_in_request", GetWayPointsReqCheck, { requestFake }) +runner.Step("GetWayPoints_params_from_another_API_in_request", GetWayPointsReqCheck, { requestAnotherReq }) +runner.Step("GetWayPoints_fake_params_in_response", GetWayPointsResCheck, { responseFake }) +runner.Step("GetWayPoints_params_from_another_API_in_response", GetWayPointsResCheck, { responseAnotherReq }) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/GetWayPoints/019_GetWayPoints_duplicated_corr_id.lua b/test_scripts/API/Navigation/GetWayPoints/019_GetWayPoints_duplicated_corr_id.lua new file mode 100644 index 0000000000..d62ee18ff9 --- /dev/null +++ b/test_scripts/API/Navigation/GetWayPoints/019_GetWayPoints_duplicated_corr_id.lua @@ -0,0 +1,79 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/25 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Get%20Destination_and_Waypoints.md +-- Item: Use Case 1: Main Flow +-- +-- Requirement summary: +-- [GetWayPoints] As a mobile app I want to send a request to get the details of the destination +-- and waypoints set on the system so that I can get last mile connectivity. +-- +-- Description: +-- In case: +-- 1) mobile application sends valid and allowed by Policies GetWayPoints_requests with the same correlationId to SDL +-- SDL must: +-- 1) Transfer GetWayPoints_request to HMI +-- 2) Respond with received from HMI to mobile application +-- 3) Provide the requested parameters at the same order as received from HMI +-- to mobile application (in case of successfull response) + +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Local Functions ]] +local function GetWayPoints(self) + local params = { + wayPointType = "ALL" + } + local cid = self.mobileSession1:SendRPC("GetWayPoints", params) + print("MOB->SDL: RQ1") + + params.appID = common.getHMIAppId() + local lResponse = { } + lResponse.wayPoints = {{ locationName = "Hotel" }} + lResponse.appID = common.getHMIAppId() + EXPECT_HMICALL("Navigation.GetWayPoints", params) + :Do(function(exp,data) + print("SDL->HMI: RQ" .. exp.occurences) + local function request2() + print("MOB->SDL: RQ2") + local msg = { + serviceType = 7, + frameInfo = 0, + rpcType = 0, + rpcFunctionId = 45, + rpcCorrelationId = cid, + payload = '{"wayPointType":"ALL"}' + } + self.mobileSession1:Send(msg) + end + if exp.occurences == 1 then + RUN_AFTER(request2, 500) + end + local function response() + print("HMI->SDL: RS" .. exp.occurences) + self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", lResponse) + end + RUN_AFTER(response, 100) + end) + :Times(2) + self.mobileSession1:ExpectResponse(cid, { success = true, resultCode = "SUCCESS", wayPoints = lResponse.wayPoints }) + :Times(2) + :Do(function(exp) + print("SDL->MOB: RS" .. exp.occurences) + end) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("GetWayPoints_duplicated_correlation_id", GetWayPoints) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/GetWayPoints/020_GetWayPoints_mandatory_missed_in_HMIresponse.lua b/test_scripts/API/Navigation/GetWayPoints/020_GetWayPoints_mandatory_missed_in_HMIresponse.lua new file mode 100644 index 0000000000..4c87949ff5 --- /dev/null +++ b/test_scripts/API/Navigation/GetWayPoints/020_GetWayPoints_mandatory_missed_in_HMIresponse.lua @@ -0,0 +1,61 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/25 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Get%20Destination_and_Waypoints.md +-- Item: Use Case 1: Main Flow +-- +-- Requirement summary: +-- [GetWayPoints] As a mobile app I want to send a request to get the details of the destination +-- and waypoints set on the system so that I can get last mile connectivity. +-- +-- Description: +-- In case: +-- 1) mobile application sends valid and allowed by Policies GetWayPoints_request to SDL +-- 2) GetWayPoints_request is transfered to HMI +-- 3) HMI sends response with missed mandatory parameters +-- SDL must: +-- 1) validate response and respond to mobile app with INVALID_DATA, success:false +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Local Functions ]] +local function GetWayPoints(parameter, value, self) + local params = { + wayPointType = "ALL" + } + local cid = self.mobileSession1:SendRPC("GetWayPoints", params) + params.appID = common.getHMIAppId() + local lResponse = { } + lResponse.wayPoints = {{ [parameter] = value }} + lResponse.appID = common.getHMIAppId() + EXPECT_HMICALL("Navigation.GetWayPoints", params) + :Do(function(_,data) + self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", lResponse) + end) + self.mobileSession1:ExpectResponse(cid, { success = false, resultCode = "INVALID_DATA" }) + :ValidIf(function(_,data) + if data.payload.wayPoints then + return false, "SDL sends wayPoints in error response to mobile application." + else + return true + end + end) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("GetWayPoints_wayPoints_missed_latitudeDegrees" , GetWayPoints, + { "coordinate", { latitudeDegrees = nil, longitudeDegrees = 0.1 }}) +runner.Step("GetWayPoints_wayPoints_missed_longitudeDegrees" , GetWayPoints, + { "coordinate", { latitudeDegrees = 0.1, longitudeDegrees = nil }}) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/GetWayPoints/021_GetWayPoints_diff_HMI_levells.lua b/test_scripts/API/Navigation/GetWayPoints/021_GetWayPoints_diff_HMI_levells.lua new file mode 100644 index 0000000000..5801bc88ec --- /dev/null +++ b/test_scripts/API/Navigation/GetWayPoints/021_GetWayPoints_diff_HMI_levells.lua @@ -0,0 +1,91 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/25 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Get%20Destination_and_Waypoints.md +-- +-- Requirement summary: +-- 1. Request is sent in NONE, BACKGROUND, FULL, LIMITED levels +-- 2. SDL responds DISALLOWED, success:false to request in NONE level and SUCCESS, success:true in other ones +-- +-- Description: +-- App requests GetWayPoints in different HMI levels +-- +-- Steps: +-- SDL receives GetWayPoints request in NONE, BACKGROUND, FULL, LIMITED +-- +-- Expected: +-- SDL responds DISALLOWED, success:false in NONE level, SUCCESS, success:true in BACKGROUND, FULL, LIMITED levels +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') +local commonFunctions = require('user_modules/shared_testcases/commonFunctions') + +--[[ General configuration parameters ]] +config.application1.registerAppInterfaceParams.isMediaApplication = true +config.application1.registerAppInterfaceParams.appHMIType = {"NAVIGATION"} +config.application2.registerAppInterfaceParams.isMediaApplication = false +config.application2.registerAppInterfaceParams.appHMIType = {"NAVIGATION"} + +--[[ Local Variables ]] +local params = { + wayPointType = "ALL" + } + +--[[ Local Functions ]] +local function GetWayPointsDisallowed(self) + local cid = self.mobileSession2:SendRPC("GetWayPoints", params) + EXPECT_HMICALL("Navigation.GetWayPoints") + :Times(0) + self.mobileSession2:ExpectResponse(cid, { success = false, resultCode = "DISALLOWED" }) + common:DelayedExp() +end + +local function GetWayPointsSuccess(fParams, self) + local lParams = commonFunctions:cloneTable(params) + local cid = self.mobileSession1:SendRPC("GetWayPoints", fParams) + lParams.appID = common.getHMIAppId() + local lResponse = { } + lResponse.wayPoints = {{ locationName = "Hotel" }} + lResponse.appID = common.getHMIAppId() + EXPECT_HMICALL("Navigation.GetWayPoints", lParams) + :Do(function(_,data) + self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", lResponse) + end) + self.mobileSession1:ExpectResponse(cid, { success = true, resultCode = "SUCCESS", wayPoints = lResponse.wayPoints }) +end + +local function BringAppToLimitedLevel(self) + local appIDval = common.getHMIAppId(1) + self.hmiConnection:SendNotification("BasicCommunication.OnAppDeactivated", + { appID = appIDval }) + self.mobileSession1:ExpectNotification("OnHMIStatus", { hmiLevel = "LIMITED" }) +end + +local function BringAppToBackgroundLevel(self) + common.activateApp(2, self) + self.mobileSession1:ExpectNotification("OnHMIStatus",{ hmiLevel = "BACKGROUND" }) +end + +local function ptuUpdateFunc(pTbl) + pTbl.policy_table.functional_groupings["WayPoints"].rpcs.GetWayPoints = + { hmi_levels = {"BACKGROUND","FULL","LIMITED" }} +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU first app", common.registerAppWithPTU, {1, ptuUpdateFunc}) +runner.Step("RAI, PTU second app", common.registerAppWithPTU, {2, ptuUpdateFunc}) +runner.Step("Activate first App", common.activateApp, {1}) + +runner.Title("Test") +runner.Step("GetWayPoints_in_NONE", GetWayPointsDisallowed) +runner.Step("GetWayPoints_in_FULL", GetWayPointsSuccess, { params }) +runner.Step("Bring_app_to_limited", BringAppToLimitedLevel) +runner.Step("GetWayPoints_in_LIMITED", GetWayPointsSuccess, { params }) +runner.Step("Bring_app_to_background", BringAppToBackgroundLevel) +runner.Step("GetWayPoints_in_BACKGROUND", GetWayPointsSuccess, { params }) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/GetWayPoints/022_GetWayPoints_invalid_characters.lua b/test_scripts/API/Navigation/GetWayPoints/022_GetWayPoints_invalid_characters.lua new file mode 100644 index 0000000000..ff5067357f --- /dev/null +++ b/test_scripts/API/Navigation/GetWayPoints/022_GetWayPoints_invalid_characters.lua @@ -0,0 +1,114 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/25 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Get%20Destination_and_Waypoints.md +-- +-- Requirement summary: +-- [GetWayPoints] As a mobile app I want to send a request to get the details of the destination +-- and waypoints set on the system so that I can get last mile connectivity. +-- +-- Description: +-- In case: +-- 1) mobile application sends valid and allowed by Policies GetWayPoints_request to SDL +-- 2) HMI responds with invalid characters \n,\t, " " values to SDL +-- SDL must: +-- 1) respond to mobile INVALID_DATA, success:false + +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Local Variables ]] +local stringNewLine = "str\ning" +local stringTab = "str\ting" +local stringOnlyWhiteSpace = " " +local wayPointTypeDefault = "ALL" +local imageTypes = { "DYNAMIC", "STATIC" } +local LocationDetailsStringParams = { + "locationName", + "locationDescription", + "phoneNumber" +} +local OASISAddressParams = { + "countryName", + "countryCode", + "postalCode", + "administrativeArea", + "subAdministrativeArea", + "locality", + "subLocality", + "thoroughfare", + "subThoroughfare" +} + +--[[ Local Functions ]] +local function GetWayPoints(parameter, value, self) + local params = { + wayPointType = wayPointTypeDefault + } + + local cid = self.mobileSession1:SendRPC("GetWayPoints", params) + params.appID = common.getHMIAppId() + local lResponse = {} + lResponse.wayPoints = {{ + coordinate = { + latitudeDegrees = 45.5, + longitudeDegrees = 45.5 + } + }} + lResponse.wayPoints = {{ [parameter] = value }} + lResponse.appID = common.getHMIAppId() + + EXPECT_HMICALL("Navigation.GetWayPoints", params) + :Do(function(_,data) + self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", lResponse) + end) + + self.mobileSession1:ExpectResponse(cid, { success = false, resultCode = "GENERIC_ERROR" }) + :ValidIf(function(_,data) + if data.payload.wayPoints then + return false, "SDL sends wayPoints in error response" + else + return true + end + end) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +for _, value in pairs(LocationDetailsStringParams) do + runner.Step("GetWayPoints_wayPoints_newLine_" .. value , GetWayPoints, { value, stringNewLine }) + runner.Step("GetWayPoints_wayPoints_tab_" .. value , GetWayPoints, { value, stringTab }) + runner.Step("GetWayPoints_wayPoints_whitespace_" .. value , GetWayPoints, { value, stringOnlyWhiteSpace }) +end +for _, value in pairs(OASISAddressParams) do + runner.Step("GetWayPoints_wayPoints_newLine_searchAddress_" .. value , GetWayPoints, + { "searchAddress", { [value] = stringNewLine }}) + runner.Step("GetWayPoints_wayPoints_tab_searchAddress_" .. value , GetWayPoints, + { "searchAddress", { [value] = stringTab }}) + runner.Step("GetWayPoints_wayPoints_whitespace_searchAddress_" .. value , GetWayPoints, + { "searchAddress", { [value] = stringOnlyWhiteSpace }}) +end +runner.Step("GetWayPoints_wayPoints_newLine_value_addressLines" , GetWayPoints, + { "addressLines", { stringNewLine }}) +runner.Step("GetWayPoints_wayPoints_tab_value_addressLines" , GetWayPoints, + { "addressLines", { stringTab }}) +runner.Step("GetWayPoints_wayPoints_whitespace_value_addressLines" , GetWayPoints, + { "addressLines", { stringOnlyWhiteSpace }}) +for _, value in pairs(imageTypes) do + runner.Step("GetWayPoints_wayPoints_newLine_locationImage_value_" .. value , GetWayPoints, + { "locationImage", { value = stringNewLine, imageType = value }}) + runner.Step("GetWayPoints_wayPoints_tab_locationImage_value_" .. value , GetWayPoints, + { "locationImage", { value = stringTab, imageType = value }}) + runner.Step("GetWayPoints_wayPoints_whitespace_locationImage_value_" .. value , GetWayPoints, + { "locationImage", { value = stringOnlyWhiteSpace, imageType = value }}) +end + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/GetWayPoints/023_GetWayPoints_app_not_registered.lua b/test_scripts/API/Navigation/GetWayPoints/023_GetWayPoints_app_not_registered.lua new file mode 100644 index 0000000000..6410faf6fa --- /dev/null +++ b/test_scripts/API/Navigation/GetWayPoints/023_GetWayPoints_app_not_registered.lua @@ -0,0 +1,53 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/25 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Get%20Destination_and_Waypoints.md +-- Requirement summary: +-- 1. Request is invalid: Wrong json, parameters of wrong type, string parameters with empty values or whitespace as the +-- only symbol, out of bounds, wrong characters, missing mandatory parameters +-- 2. SDL responds INVALID_DATA, success:false +-- +-- Description: +-- SDL receives GetWayPoints request to not reqistered application +-- +-- Steps: +-- SDL receives GetWayPoints request to not reqistered application +-- +-- Expected: +-- SDL responds APPLICATION_NOT_REGISTERED, success:false +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') +local mobileSession = require('mobile_session') + +--[[ Local Functions ]] +local function GetWayPoints(self) + local params = { + wayPointType = "ALL" + } + local cid = self.mobileSession2:SendRPC("GetWayPoints", params) + EXPECT_HMICALL("Navigation.GetWayPoints") + :Times(0) + self.mobileSession2:ExpectResponse(cid, { success = false, resultCode = "APPLICATION_NOT_REGISTERED" }) + common.DelayedExp() +end + +local function CreationNewSession(self) + self.mobileSession2 = mobileSession.MobileSession( + self, + self.mobileConnection, + config.application2.registerAppInterfaceParams + ) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("Start session", CreationNewSession) + +runner.Title("Test") +runner.Step("GetWayPoints_APPLICATION_NOT_REGISTERED", GetWayPoints) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/GetWayPoints/024_GetWayPoints_invalid_types_in_HMIresponse.lua b/test_scripts/API/Navigation/GetWayPoints/024_GetWayPoints_invalid_types_in_HMIresponse.lua new file mode 100644 index 0000000000..c0c9a023f3 --- /dev/null +++ b/test_scripts/API/Navigation/GetWayPoints/024_GetWayPoints_invalid_types_in_HMIresponse.lua @@ -0,0 +1,96 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/25 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Get%20Destination_and_Waypoints.md +-- Item: Use Case 1: Main Flow +-- +-- Requirement summary: +-- [GetWayPoints] As a mobile app I want to send a request to get the details of the destination +-- and waypoints set on the system so that I can get last mile connectivity. +-- +-- Description: +-- In case: +-- 1) mobile application sends valid and allowed by Policies GetWayPoints_request to SDL +-- 2) GetWayPoints_request is transfered to HMI +-- 3) HMI sends response with invalid types of parameters +-- SDL must: +-- 1) validate response and repond to mobile app with INVALID_DATA, success:false +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Local Variables ]] +local intType = 10 +local stringType = "string" +local LocationDetailsStringParams = { + "locationName", + "locationDescription", + "phoneNumber" +} +local OASISAddressParams = { + "countryName", + "countryCode", + "postalCode", + "administrativeArea", + "subAdministrativeArea", + "locality", + "subLocality", + "thoroughfare", + "subThoroughfare", +} + +--[[ Local Functions ]] +local function GetWayPoints(parameter, value, self) + local params = { + wayPointType = "ALL" + } + local cid = self.mobileSession1:SendRPC("GetWayPoints", params) + params.appID = common.getHMIAppId() + local lResponse = { } + lResponse.wayPoints = {{ [parameter] = value }} + lResponse.appID = common.getHMIAppId() + EXPECT_HMICALL("Navigation.GetWayPoints", params) + :Do(function(_,data) + self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", lResponse) + end) + self.mobileSession1:ExpectResponse(cid, { success = false, resultCode = "INVALID_DATA" }) + :ValidIf(function(_,data) + if data.payload.wayPoints then + return false, "SDL sends wayPoints in error response to mobile application." + else + return true + end + end) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("GetWayPoints_wayPoints_invalid_type_latitudeDegrees" , GetWayPoints, + { "coordinate", { latitudeDegrees = stringType, longitudeDegrees = 0.1 }}) +runner.Step("GetWayPoints_wayPoints_invalid_type_longitudeDegrees" , GetWayPoints, + { "coordinate", { latitudeDegrees = 0.1, longitudeDegrees = stringType }}) +for _, value in pairs(LocationDetailsStringParams) do + runner.Step("GetWayPoints_wayPoints_invalid_type_" .. value , GetWayPoints, { value, intType }) +end +for _, value in pairs(OASISAddressParams) do + runner.Step("GetWayPoints_wayPoints_invalid_type_searchAddress_" .. value , GetWayPoints, + { "searchAddress", { [value] = intType }}) +end +runner.Step("GetWayPoints_wayPoints_invalid_type_value_addressLines" , GetWayPoints, + { "addressLines", { intType }}) +runner.Step("GetWayPoints_wayPoints_invalid_type_array_addressLines" , GetWayPoints, + { "addressLines", intType }) +runner.Step("GetWayPoints_wayPoints_invalid_type_locationImage_value", GetWayPoints, + { "locationImage", { value = intType, imageType = "DYNAMIC" }}) +runner.Step("GetWayPoints_wayPoints_invalid_type_locationImage_type", GetWayPoints, + { "locationImage", { value = "image", imageType = intType }}) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/GetWayPoints/025_GetWayPoints_Transfering_of_HMI_resultCode_to_mobile.lua b/test_scripts/API/Navigation/GetWayPoints/025_GetWayPoints_Transfering_of_HMI_resultCode_to_mobile.lua new file mode 100644 index 0000000000..fa6ff8a281 --- /dev/null +++ b/test_scripts/API/Navigation/GetWayPoints/025_GetWayPoints_Transfering_of_HMI_resultCode_to_mobile.lua @@ -0,0 +1,130 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/25 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Get%20Destination_and_Waypoints.md +-- Item: Use Case 1: Main flow +-- +-- Requirement summary: +-- [GetWayPoints] As a mobile app I want to send a request to get the details of the destination +-- and waypoints set on the system so that I can get last mile connectivity. +-- +-- Description: +-- In case: +-- 1) Mobile application requests to get details of the destination and waypoints set on the system +-- so that it can provide last mile connectivity. +-- SDL must: +-- 1) SDL transfers the request with valid and allowed parameters to HMI +-- 2) SDL receives response from HMI +-- 3) SDL transfers response to mobile application + +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Local Variables ]] +local resultCodes = { + success = common.getSuccessResultCodes("GetWayPoints"), + failure = common.getFailureResultCodes("GetWayPoints"), + unexpected = common.getUnexpectedResultCodes("GetWayPoints"), + unmapped = common.getUnmappedResultCodes("GetWayPoints") +} + +local params = { + wayPointType = "ALL" +} + +local validResponse = { + wayPoints = { + { + coordinate = + { + latitudeDegrees = 0, + longitudeDegrees = 0 + }, + locationName = "Home", + addressLines = { "Odessa", "Street" } + } + } +} + +--[[ Local Functions ]] +local function getWayPointsSuccess(pResultCodeMap, self) + local cid = self.mobileSession1:SendRPC("GetWayPoints", params) + + validResponse.appID = common.getHMIAppId() + EXPECT_HMICALL("Navigation.GetWayPoints", params) + :ValidIf(function(_, data) + return data.params.appID == common.getHMIAppId() + end) + :Do(function(_,data) + self.hmiConnection:SendResponse(data.id, data.method, pResultCodeMap.hmi, validResponse) + end) + self.mobileSession1:ExpectResponse(cid, { success = true, resultCode = pResultCodeMap.mobile }) +end + +local function getWayPointsUnsuccess(pResultCodeMap, self) + local cid = self.mobileSession1:SendRPC("GetWayPoints", params) + + EXPECT_HMICALL("Navigation.GetWayPoints", params) + :ValidIf(function(_, data) + return data.params.appID == common.getHMIAppId() + end) + :Do(function(_,data) + self.hmiConnection:SendError(data.id, data.method, pResultCodeMap.hmi, "Error error") + end) + + self.mobileSession1:ExpectResponse(cid, { success = false, resultCode = pResultCodeMap.mobile }) + :ValidIf(function(_,data) + if not data.payload.info then + return false, "SDL doesn't resend info parameter to mobile App" + end + return true + end) +end + +local function getWayPointsUnexpected(pResultCodeMap, self) + local cid = self.mobileSession1:SendRPC("GetWayPoints", params) + + EXPECT_HMICALL("Navigation.GetWayPoints", params) + :ValidIf(function(_, data) + return data.params.appID == common.getHMIAppId() + end) + :Do(function(_,data) + if pResultCodeMap.success then + validResponse.appID = common.getHMIAppId() + self.hmiConnection:SendResponse(data.id, data.method, pResultCodeMap.hmi, validResponse) + else + self.hmiConnection:SendError(data.id, data.method, pResultCodeMap.hmi, "Error error") + end + end) + + self.mobileSession1:ExpectResponse(cid, { success = pResultCodeMap.success, resultCode = pResultCodeMap.mobile }) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("Result Codes", common.printResultCodes, { resultCodes }) + +runner.Title("Successful codes") +for _, item in pairs(resultCodes.success) do + runner.Step("GetWayPoints with " .. item.hmi .. " resultCode", getWayPointsSuccess, { item }) +end + +runner.Title("Erroneous codes") +for _, item in pairs(resultCodes.failure) do + runner.Step("GetWayPoints with " .. item.hmi .. " resultCode", getWayPointsUnsuccess, { item }) +end + +runner.Title("Unexpected codes") +for _, item in pairs(resultCodes.unexpected) do + runner.Step("GetWayPoints with " .. item.hmi .. " resultCode", getWayPointsUnexpected, { item }) +end + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/OnWayPointChange/001_OnWayPointChange_success_flow.lua b/test_scripts/API/Navigation/OnWayPointChange/001_OnWayPointChange_success_flow.lua new file mode 100755 index 0000000000..8120a24298 --- /dev/null +++ b/test_scripts/API/Navigation/OnWayPointChange/001_OnWayPointChange_success_flow.lua @@ -0,0 +1,80 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/28 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Notification_about_changes_to_Destination_or_Waypoints.md +-- Item: Use Case 1: Main Flow +-- +-- Requirement summary: +-- [OnWayPointChange] As a mobile application I want to be able to be notified on changes +-- to Destination or Waypoints based on my subscription +-- +-- Description: +-- In case: +-- 1) SDL and HMI are started, Navi interface and embedded navigation source are available on HMI, +-- mobile applications are registered on SDL and subscribed on destination and waypoints changes notification +-- 2) Any change in destination or waypoints is registered on HMI (user set new route, canselled the route, +-- arrived at destination point or crossed a waypoint) + +-- SDL must: +-- 1) Transfer the notification about changes to destination or waypoints to mobile application +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Local Variables ]] +local notification = { + wayPoints = { + { + coordinate = + { + latitudeDegrees = 1.1, + longitudeDegrees = 1.1 + }, + locationName = "Hotel", + addressLines = + { + "Hotel Bora", + "Hotel 5 stars" + }, + locationDescription = "VIP Hotel", + phoneNumber = "Phone39300434", + locationImage = + { + value ="icon.png", + imageType ="DYNAMIC", + }, + searchAddress = + { + countryName = "countryName", + countryCode = "countryCode", + postalCode = "postalCode", + administrativeArea = "administrativeArea", + subAdministrativeArea = "subAdministrativeArea", + locality = "locality", + subLocality = "subLocality", + thoroughfare = "thoroughfare", + subThoroughfare = "subThoroughfare" + } + } + } +} + +--[[ Local Functions ]] +local function onWayPointChange(self) + self.hmiConnection:SendNotification("Navigation.OnWayPointChange", notification) + self.mobileSession1:ExpectNotification("OnWayPointChange", notification) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) +runner.Step("Subscribe OnWayPointChange", common.subscribeWayPoints) + +runner.Title("Test") +runner.Step("OnWayPointChange", onWayPointChange) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/OnWayPointChange/002_OnWayPointChange_not_allowed_by_policy.lua b/test_scripts/API/Navigation/OnWayPointChange/002_OnWayPointChange_not_allowed_by_policy.lua new file mode 100755 index 0000000000..5ffe996495 --- /dev/null +++ b/test_scripts/API/Navigation/OnWayPointChange/002_OnWayPointChange_not_allowed_by_policy.lua @@ -0,0 +1,84 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/28 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Notification_about_changes_to_Destination_or_Waypoints.md +-- Item: Use Case 1: Exception 1: Notification about changes to destination or waypoints is not allowed by Policies for mobile application +-- +-- Requirement summary: +-- [OnWayPointChange] As a mobile application I want to be able to be notified on changes +-- to Destination or Waypoints based on my subscription +-- +-- Description: +-- In case: +-- 1) SDL and HMI are started, Navi interface and embedded navigation source are available on HMI, +-- mobile applications are registered on SDL and subscribed on destination and waypoints changes notification +-- 2) Notification about changes to destination or waypoints is not allowed by Policies for mobile application + +-- SDL must: +-- 1) SDL doesn't transfer the notification to such mobile application +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Local Variables ]] +local notification = { + wayPoints = { + { + coordinate = + { + latitudeDegrees = 1.1, + longitudeDegrees = 1.1 + }, + locationName = "Hotel", + addressLines = + { + "Hotel Bora", + "Hotel 5 stars" + }, + locationDescription = "VIP Hotel", + phoneNumber = "Phone39300434", + locationImage = + { + value ="icon.png", + imageType ="DYNAMIC", + }, + searchAddress = + { + countryName = "countryName", + countryCode = "countryCode", + postalCode = "postalCode", + administrativeArea = "administrativeArea", + subAdministrativeArea = "subAdministrativeArea", + locality = "locality", + subLocality = "subLocality", + thoroughfare = "thoroughfare", + subThoroughfare = "subThoroughfare" + } + } + } +} + +--[[ Local Functions ]] +local function disallowOnWayPointChange(tbl) + tbl.policy_table.functional_groupings["WayPoints"].rpcs.OnWayPointChange = nil +end + +local function onWayPointChange(self) + self.hmiConnection:SendNotification("Navigation.OnWayPointChange", notification) + self.mobileSession1:ExpectNotification("OnWayPointChange"):Times(0) + common:DelayedExp() +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU, { common.appId1, disallowOnWayPointChange }) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("Subscribe OnWayPointChange", common.subscribeWayPoints) +runner.Step("OnWayPointChange", onWayPointChange) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/OnWayPointChange/003_OnWayPointChange_invalid_notification.lua b/test_scripts/API/Navigation/OnWayPointChange/003_OnWayPointChange_invalid_notification.lua new file mode 100755 index 0000000000..ac1ded8895 --- /dev/null +++ b/test_scripts/API/Navigation/OnWayPointChange/003_OnWayPointChange_invalid_notification.lua @@ -0,0 +1,42 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/28 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Notification_about_changes_to_Destination_or_Waypoints.md +-- Item: Use Case 1: Exception 2 : Received notification about changes to destination or waypoints from HMI is invalid +-- +-- Requirement summary: +-- [OnWayPointChange] As a mobile application I want to be able to be notified on changes +-- to Destination or Waypoints based on my subscription +-- +-- Description: +-- In case: +-- 1) SDL and HMI are started, Navi interface and embedded navigation source are available on HMI, +-- mobile applications are registered on SDL and subscribed on destination and waypoints changes notification +-- 2) Received notification about changes to destination or waypoints from HMI is invalid + +-- SDL must: +-- 1) SDL logs the error internally and ignores such notification without transfering it to any of subscribed mobile applications +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Local Functions ]] +local function emptyNotification(self) + self.hmiConnection:SendNotification("Navigation.OnWayPointChange", {}) + self.mobileSession1:ExpectNotification("OnWayPointChange"):Times(0) + common:DelayedExp() +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("Subscribe OnWayPointChange", common.subscribeWayPoints) +runner.Step("OnWayPointChange emptyNotification", emptyNotification) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/OnWayPointChange/004_OnWayPointChange_two_apps.lua b/test_scripts/API/Navigation/OnWayPointChange/004_OnWayPointChange_two_apps.lua new file mode 100755 index 0000000000..5bf67fbf41 --- /dev/null +++ b/test_scripts/API/Navigation/OnWayPointChange/004_OnWayPointChange_two_apps.lua @@ -0,0 +1,95 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/28 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Notification_about_changes_to_Destination_or_Waypoints.md +-- Item: Use Case 1: Alternative flow 1 +-- +-- Requirement summary: +-- [OnWayPointChange] As a mobile application I want to be able to be notified on changes +-- to Destination or Waypoints based on my subscription +-- +-- Description: +-- In case: +-- 1) One application requested to unsubscribe from receiving notifications on destination & waypoints changes +-- (other mobile applications remain subscribed) +-- Any change in destination or waypoints is registered on HMI (user set new route, canselled the route, +-- arrived at destination point or crossed a waypoint) +-- 2) HMI sends the notification about changes to SDL + +-- SDL must: +-- 1) SDL does not transfer the notification to unsubscribed mobile application +-- SDL transfers the notification to subscribed mobile applications +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Local Variables ]] +local notification = { + wayPoints = { + { + coordinate = + { + latitudeDegrees = 1.1, + longitudeDegrees = 1.1 + }, + locationName = "Hotel", + addressLines = + { + "Hotel Bora", + "Hotel 5 stars" + }, + locationDescription = "VIP Hotel", + phoneNumber = "Phone39300434", + locationImage = + { + value ="icon.png", + imageType ="DYNAMIC", + }, + searchAddress = + { + countryName = "countryName", + countryCode = "countryCode", + postalCode = "postalCode", + administrativeArea = "administrativeArea", + subAdministrativeArea = "subAdministrativeArea", + locality = "locality", + subLocality = "subLocality", + thoroughfare = "thoroughfare", + subThoroughfare = "subThoroughfare" + } + } + } +} + +--[[ Local Functions ]] +local function onWayPointChangeToBothApps(self) + self.hmiConnection:SendNotification("Navigation.OnWayPointChange", notification) + self.mobileSession1:ExpectNotification("OnWayPointChange", notification) + self.mobileSession2:ExpectNotification("OnWayPointChange", notification) +end + +local function onWayPointChangeToOneApp(self) + self.hmiConnection:SendNotification("Navigation.OnWayPointChange", notification) + self.mobileSession1:ExpectNotification("OnWayPointChange", notification) + self.mobileSession2:ExpectNotification("OnWayPointChange"):Times(0) + common:DelayedExp() +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) + +for i = 1, 2 do + runner.Step("RAI, PTU " .. i, common.registerAppWithPTU, { i }) + runner.Step("Activate App " .. i, common.activateApp, { i }) + runner.Step("Subscribe OnWayPointChange App " .. i, common.subscribeWayPoints, { i }) +end + +runner.Title("Test") +runner.Step("OnWayPointChange to both apps", onWayPointChangeToBothApps) +runner.Step("Second app unsubscribe OnWayPointChange", common.unsubscribeWayPoints, { common.appId2 }) +runner.Step("OnWayPointChange to one app", onWayPointChangeToOneApp) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/OnWayPointChange/005_OnWayPointChange_update_internaly_stored_notification_data.lua b/test_scripts/API/Navigation/OnWayPointChange/005_OnWayPointChange_update_internaly_stored_notification_data.lua new file mode 100755 index 0000000000..b07eb3f1bb --- /dev/null +++ b/test_scripts/API/Navigation/OnWayPointChange/005_OnWayPointChange_update_internaly_stored_notification_data.lua @@ -0,0 +1,133 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/28 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Notification_about_changes_to_Destination_or_Waypoints.md +-- Item: Use Case 1: Alternative flow 1 +-- +-- Requirement summary: +-- [OnWayPointChange] As a mobile application I want to be able to be notified on changes +-- to Destination or Waypoints based on my subscription +-- +-- Description: +-- In case: +-- 1) One application requested to unsubscribe from receiving notifications on destination & waypoints changes +-- (other mobile applications remain subscribed) +-- Any change in destination or waypoints is registered on HMI (user set new route, canselled the route, +-- arrived at destination point or crossed a waypoint) +-- 2) HMI sends the notification about changes to SDL + +-- SDL must: +-- 1) Update of internaly stored notification data in case new notification came from HMI +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Local Variables ]] +local firstNotification = { + wayPoints = { + { + coordinate = + { + latitudeDegrees = 1.1, + longitudeDegrees = 1.1 + }, + locationName = "Hotel", + addressLines = + { + "Hotel Bora", + "Hotel 5 stars" + }, + locationDescription = "VIP Hotel", + phoneNumber = "Phone39300434", + locationImage = + { + value ="icon.png", + imageType ="DYNAMIC", + }, + searchAddress = + { + countryName = "countryName", + countryCode = "countryCode", + postalCode = "postalCode", + administrativeArea = "administrativeArea", + subAdministrativeArea = "subAdministrativeArea", + locality = "locality", + subLocality = "subLocality", + thoroughfare = "thoroughfare", + subThoroughfare = "subThoroughfare" + } + } + } +} + +local secondNotification = { + wayPoints = { + { + coordinate = + { + latitudeDegrees = 2.1, + longitudeDegrees = 2.1 + }, + locationName = "Home", + addressLines = + { + "Street 36" + }, + locationDescription = "MyHome", + phoneNumber = "009300434", + locationImage = + { + value ="icon.png", + imageType ="DYNAMIC", + }, + searchAddress = + { + countryName = "countryName", + countryCode = "countryCode", + postalCode = "postalCode", + administrativeArea = "administrativeArea", + subAdministrativeArea = "subAdministrativeArea", + locality = "locality", + subLocality = "subLocality", + thoroughfare = "thoroughfare", + subThoroughfare = "subThoroughfare" + } + } + } +} + +--[[ Local Functions ]] +local function firstOnWayPointChange(self) + self.hmiConnection:SendNotification("Navigation.OnWayPointChange", firstNotification) + self.mobileSession1:ExpectNotification("OnWayPointChange", firstNotification) +end + +local function subscribeApp2(self) + common.subscribeWayPoints(2, self) + self.mobileSession2:ExpectNotification("OnWayPointChange", firstNotification) +end + +local function secondOnWayPointChange(self) + self.hmiConnection:SendNotification("Navigation.OnWayPointChange", secondNotification) + self.mobileSession1:ExpectNotification("OnWayPointChange", secondNotification) + self.mobileSession2:ExpectNotification("OnWayPointChange", secondNotification) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) + +for i = 1, 2 do + runner.Step("RAI, PTU " .. i, common.registerAppWithPTU, { i }) + runner.Step("Activate App " .. i, common.activateApp, { i }) +end + +runner.Title("Test") +runner.Step("First app subscribe OnWayPointChange", common.subscribeWayPoints) +runner.Step("First OnWayPointChange", firstOnWayPointChange) +runner.Step("Second app subscribe OnWayPointChange", subscribeApp2) +runner.Step("Second OnWayPointChange to both apps", secondOnWayPointChange) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/OnWayPointChange/006_OnWayPointChange_OnlyManadatoryParams.lua b/test_scripts/API/Navigation/OnWayPointChange/006_OnWayPointChange_OnlyManadatoryParams.lua new file mode 100644 index 0000000000..3f0b7bfdf2 --- /dev/null +++ b/test_scripts/API/Navigation/OnWayPointChange/006_OnWayPointChange_OnlyManadatoryParams.lua @@ -0,0 +1,55 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/28 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Notification_about_changes_to_Destination_or_Waypoints.md +-- Item: Use Case 1: Main Flow +-- +-- Requirement summary: +-- [OnWayPointChange] As a mobile application I want to be able to be notified on changes +-- to Destination or Waypoints based on my subscription +-- +-- Description: +-- In case: +-- 1) SDL and HMI are started, Navi interface and embedded navigation source are available on HMI, +-- mobile applications are registered on SDL and subscribed on destination and waypoints changes notification +-- 2) Any change in destination or waypoints is registered on HMI (user set new route, canselled the route, +-- arrived at destination point or crossed a waypoint) with the mandatory params only + +-- SDL must: +-- 1) Transfer the notification about changes to destination or waypoints to mobile application +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Local Variables ]] +local notification = { + wayPoints = { + { + coordinate = + { + latitudeDegrees = 1.1, + longitudeDegrees = 1.1 + } + } + } +} + +--[[ Local Functions ]] +local function onWayPointChange(self) + self.hmiConnection:SendNotification("Navigation.OnWayPointChange", notification) + self.mobileSession1:ExpectNotification("OnWayPointChange", notification) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) +runner.Step("Subscribe OnWayPointChange", common.subscribeWayPoints) + +runner.Title("Test") +runner.Step("OnWayPointChange", onWayPointChange) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/OnWayPointChange/007_OnWayPointChange_OnlyManadatoryParamsEmpty_success.lua b/test_scripts/API/Navigation/OnWayPointChange/007_OnWayPointChange_OnlyManadatoryParamsEmpty_success.lua new file mode 100644 index 0000000000..4b3af06fa8 --- /dev/null +++ b/test_scripts/API/Navigation/OnWayPointChange/007_OnWayPointChange_OnlyManadatoryParamsEmpty_success.lua @@ -0,0 +1,49 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/28 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Notification_about_changes_to_Destination_or_Waypoints.md +-- Item: Use Case 1: Exception 2 : Received notification about changes to destination or waypoints from HMI is invalid +-- +-- Requirement summary: +-- [OnWayPointChange] As a mobile application I want to be able to be notified on changes +-- to Destination or Waypoints based on my subscription +-- +-- Description: +-- In case: +-- 1) SDL and HMI are started, Navi interface and embedded navigation source are available on HMI, +-- mobile applications are registered on SDL and subscribed on destination and waypoints changes notification +-- 2) Received notification about changes to destination or waypoints from HMI with empty mandatory wayPoints parameter + +-- SDL must: +-- 1) Transfer the notification about changes to destination or waypoints to mobile application +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + + +--[[ Local Variables ]] +local notification = { + wayPoints = { + { } + } +} + +--[[ Local Functions ]] +local function onWayPointChange(self) + self.hmiConnection:SendNotification("Navigation.OnWayPointChange", notification) + self.mobileSession1:ExpectNotification("OnWayPointChange", notification) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("Subscribe OnWayPointChange", common.subscribeWayPoints) +runner.Step("OnWayPointChange emptyNotification", onWayPointChange) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/OnWayPointChange/008_OnWayPointChange_boundary_values_by_parameters.lua b/test_scripts/API/Navigation/OnWayPointChange/008_OnWayPointChange_boundary_values_by_parameters.lua new file mode 100644 index 0000000000..938e844c7f --- /dev/null +++ b/test_scripts/API/Navigation/OnWayPointChange/008_OnWayPointChange_boundary_values_by_parameters.lua @@ -0,0 +1,123 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/28 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Notification_about_changes_to_Destination_or_Waypoints.md +-- Item: Use Case 1: Main Flow +-- +-- Requirement summary: +-- [OnWayPointChange] As a mobile application I want to be able to be notified on changes +-- to Destination or Waypoints based on my subscription +-- +-- Description: +-- In case: +-- 1) SDL and HMI are started, Navi interface and embedded navigation source are available on HMI, +-- mobile applications are registered on SDL and subscribed on destination and waypoints changes notification +-- 2) Any change in destination or waypoints is registered on HMI (user set new route, canselled the route, +-- arrived at destination point or crossed a waypoint) + +-- SDL must: +-- 1) Transfer the notification about changes to destination or waypoints to mobile application +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Local Variables ]] +local string65535char = string.rep("a", 65535) +local string500char = string.rep("a", 500) +local string200char = string.rep("a", 200) +local string50char = string.rep("a", 50) +local string16char = string.rep("a", 16) +local minLen = "a" +local imageTypes = { "DYNAMIC", "STATIC" } +local LocationDetailsStringParams = { + "locationName", + "locationDescription", + "phoneNumber" +} +local coordinateParams = { + latitudeDegrees = { lower = -90, upper = 90 }, + longitudeDegrees = { lower = -180, upper = 180 } +} +local OASISAddressParams = { + countryName = { lower = minLen, upper = string200char }, + countryCode = { lower = minLen, upper = string50char }, + postalCode = { lower = minLen, upper = string16char }, + administrativeArea = { lower = minLen, upper = string200char }, + subAdministrativeArea = { lower = minLen, upper = string200char }, + locality = { lower = minLen, upper = string200char }, + subLocality = { lower = minLen, upper = string200char }, + thoroughfare = { lower = minLen, upper = string200char }, + subThoroughfare = { lower = minLen, upper = string200char } +} +local addressLinesArraySize = 4 +local maxAddressLinesArray = {} +for i=1,addressLinesArraySize do + maxAddressLinesArray[i] = "string" +end +local maxAddressLinesArrayValue = {} +for i=1,addressLinesArraySize do + maxAddressLinesArrayValue[i] = string500char +end +--[[ Local Functions ]] +local function onWayPointChange(parameter, value, self) + local notification = { } + notification.wayPoints = {{ [parameter] = value }} + notification.appID = common.getHMIAppId() + self.hmiConnection:SendNotification("Navigation.OnWayPointChange", notification) + self.mobileSession1:ExpectNotification("OnWayPointChange", {wayPoints = notification.wayPoints}) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) +runner.Step("Subscribe OnWayPointChange", common.subscribeWayPoints) + +runner.Title("Test") +runner.Title("Lower bound") +for _, value in pairs(LocationDetailsStringParams) do + runner.Step("OnWayPointChange_wayPoints_lower_bound_" .. value , onWayPointChange, { value, minLen }) +end +for k, value in pairs(OASISAddressParams) do + runner.Step("OnWayPointChange_wayPoints_lower_bound_searchAddress_" .. k , onWayPointChange, + { "searchAddress", { [k] = value.lower }}) +end +runner.Step("OnWayPointChange_wayPoints_lower_bound_value_array_addressLines" , onWayPointChange, + { "addressLines", { minLen }}) +runner.Step("OnWayPointChange_wayPoints_lower_bound_latitudeDegrees" , onWayPointChange, + { "coordinate", { latitudeDegrees = coordinateParams.latitudeDegrees.lower, longitudeDegrees = 0.1 }}) +runner.Step("OnWayPointChange_wayPoints_lower_bound_longitudeDegrees" , onWayPointChange, + { "coordinate", { latitudeDegrees = 0.1, longitudeDegrees = coordinateParams.longitudeDegrees.lower }}) +for _, value in pairs(imageTypes) do + runner.Step("OnWayPointChange_wayPoints_lower_bound_locationImage_value_" .. value , onWayPointChange, + { "locationImage", { value = "a", imageType = value }}) +end + +runner.Title("Upper bound") +for _, value in pairs(LocationDetailsStringParams) do + runner.Step("OnWayPointChange_wayPoints_upper_bound_" .. value , onWayPointChange, { value, string500char }) +end +for k, value in pairs(OASISAddressParams) do + runner.Step("OnWayPointChange_wayPoints_upper_bound_searchAddress_" .. k , onWayPointChange, + { "searchAddress", { [k] = value.upper }}) +end +runner.Step("OnWayPointChange_wayPoints_upper_bound_value_addressLines" , onWayPointChange, + { "addressLines", { string500char }}) +runner.Step("OnWayPointChange_wayPoints_upper_bound_array_addressLines" , onWayPointChange, + { "addressLines", maxAddressLinesArray }) +runner.Step("OnWayPointChange_wayPoints_upper_bound_value_array_addressLines" , onWayPointChange, + { "addressLines", maxAddressLinesArrayValue }) +runner.Step("OnWayPointChange_wayPoints_upper_bound_latitudeDegrees" , onWayPointChange, + { "coordinate", { latitudeDegrees = coordinateParams.latitudeDegrees.upper, longitudeDegrees = 0.1 }}) +runner.Step("OnWayPointChange_wayPoints_upper_bound_longitudeDegrees" , onWayPointChange, + { "coordinate", { latitudeDegrees = 0.1, longitudeDegrees = coordinateParams.longitudeDegrees.upper }}) +for _, value in pairs(imageTypes) do + runner.Step("OnWayPointChange_wayPoints_upper_bound_locationImage_value_" .. value , onWayPointChange, + { "locationImage", { value = string65535char, imageType = value }}) +end + +runner.Title("Postconditions") +runner.Step("Unsubscribe OnWayPointChange", common.unsubscribeWayPoints) +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/OnWayPointChange/009_OnWayPointChange_out_boundary_values_by_parameters.lua b/test_scripts/API/Navigation/OnWayPointChange/009_OnWayPointChange_out_boundary_values_by_parameters.lua new file mode 100644 index 0000000000..cd69759149 --- /dev/null +++ b/test_scripts/API/Navigation/OnWayPointChange/009_OnWayPointChange_out_boundary_values_by_parameters.lua @@ -0,0 +1,103 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/28 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Notification_about_changes_to_Destination_or_Waypoints.md +-- Item: Use Case 1: Main Flow +-- +-- Requirement summary: +-- [OnWayPointChange] As a mobile application I want to be able to be notified on changes +-- to Destination or Waypoints based on my subscription +-- +-- Description: +-- In case: +-- 1) HMI sends OnWayPointChange notification with out bound values + +-- SDL must: +-- 1) not transfer notification to mobile application +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Local Variables ]] +local string65536char = string.rep("a", 65536) +local string501char = string.rep("a", 501) +local string201char = string.rep("a", 201) +local string51char = string.rep("a", 51) +local string17char = string.rep("a", 17) +local imageTypes = { "DYNAMIC", "STATIC" } +local LocationDetailsStringParams = { + "locationName", + "locationDescription", + "phoneNumber" +} +local coordinateParams = { + latitudeDegrees = { lower = -90.1, upper = 90.1 }, + longitudeDegrees = { lower = -180.1, upper = 180.1 } +} +local OASISAddressParams = { + countryName = { upper = string201char }, + countryCode = { upper = string51char }, + postalCode = { upper = string17char }, + administrativeArea = { upper = string201char }, + subAdministrativeArea = { upper = string201char }, + locality = { upper = string201char }, + subLocality = { upper = string201char }, + thoroughfare = { upper = string201char }, + subThoroughfare = { upper = string201char } +} +local addressLinesArraySize = 5 +local maxAddressLinesArray = {} +for i=1,addressLinesArraySize do + maxAddressLinesArray[i] = "string" +end + +--[[ Local Functions ]] +local function onWayPointChange(parameter, value, self) + local notification = { } + notification.wayPoints = {{ [parameter] = value }} + notification.appID = common.getHMIAppId() + self.hmiConnection:SendNotification("Navigation.OnWayPointChange", notification) + self.mobileSession1:ExpectNotification("OnWayPointChange") + :Times(0) + common.DelayedExp() +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) +runner.Step("Subscribe OnWayPointChange", common.subscribeWayPoints) + +runner.Title("Test") +runner.Title("Out lower bound") +runner.Step("OnWayPointChange_wayPoints_lower_bound_latitudeDegrees" , onWayPointChange, + { "coordinate", { latitudeDegrees = coordinateParams.latitudeDegrees.lower, longitudeDegrees = 0.1 }}) +runner.Step("OnWayPointChange_wayPoints_lower_bound_longitudeDegrees" , onWayPointChange, + { "coordinate", { latitudeDegrees = 0.1, longitudeDegrees = coordinateParams.longitudeDegrees.lower }}) + +runner.Title("Out upper bound") +for _, value in pairs(LocationDetailsStringParams) do + runner.Step("OnWayPointChange_wayPoints_upper_bound_" .. value , onWayPointChange, { value, string501char }) +end +for k, value in pairs(OASISAddressParams) do + runner.Step("OnWayPointChange_wayPoints_upper_bound_searchAddress_" .. k , onWayPointChange, + { "searchAddress", { [k] = value.upper }}) +end +runner.Step("OnWayPointChange_wayPoints_upper_bound_value_addressLines" , onWayPointChange, + { "addressLines", { string501char }}) +runner.Step("OnWayPointChange_wayPoints_upper_bound_array_addressLines" , onWayPointChange, + { "addressLines", maxAddressLinesArray }) +runner.Step("OnWayPointChange_wayPoints_upper_bound_latitudeDegrees" , onWayPointChange, + { "coordinate", { latitudeDegrees = coordinateParams.latitudeDegrees.upper, longitudeDegrees = 0.1 }}) +runner.Step("OnWayPointChange_wayPoints_upper_bound_longitudeDegrees" , onWayPointChange, + { "coordinate", { latitudeDegrees = 0.1, longitudeDegrees = coordinateParams.longitudeDegrees.upper }}) +for _, value in pairs(imageTypes) do + runner.Step("OnWayPointChange_wayPoints_upper_bound_locationImage_value_" .. value , onWayPointChange, + { "locationImage", { value = string65536char, imageType = value }}) +end + +runner.Title("Postconditions") +runner.Step("Subscribe OnWayPointChange", common.unsubscribeWayPoints) +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/OnWayPointChange/010_OnWayPointChange_ImageWithUnknownValue.lua b/test_scripts/API/Navigation/OnWayPointChange/010_OnWayPointChange_ImageWithUnknownValue.lua new file mode 100644 index 0000000000..7347aa09b0 --- /dev/null +++ b/test_scripts/API/Navigation/OnWayPointChange/010_OnWayPointChange_ImageWithUnknownValue.lua @@ -0,0 +1,57 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/28 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Notification_about_changes_to_Destination_or_Waypoints.md +-- Item: Use Case 1: Main Flow +-- +-- Requirement summary: +-- [OnWayPointChange] As a mobile application I want to be able to be notified on changes +-- to Destination or Waypoints based on my subscription +-- +-- Description: +-- In case: +-- 1) SDL and HMI are started, Navi interface and embedded navigation source are available on HMI, +-- mobile applications are registered on SDL and subscribed on destination and waypoints changes notification +-- 2) Any change in destination or waypoints is registered on HMI (user set new route, canselled the route, +-- arrived at destination point or crossed a waypoint) with parameters of invalid type + +-- SDL must: +-- 1) Don't transfer the notification about changes to destination or waypoints to mobile application +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Local Variables ]] +local notification = + { + wayPoints= + { + { + locationImage={ + value = "icon.png", + imageType = "CLASSIC" + } + } + } + } + +--[[ Local Functions ]] +local function onWayPointChange(self) + self.hmiConnection:SendNotification("Navigation.OnWayPointChange", notification) + self.mobileSession1:ExpectNotification("OnWayPointChange", notification):Times(0) + common:DelayedExp() +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) +runner.Step("Subscribe OnWayPointChange", common.subscribeWayPoints) + +runner.Title("Test") +runner.Step("OnWayPointChange", onWayPointChange) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/OnWayPointChange/011_OnWayPointChange_invalid_types.lua b/test_scripts/API/Navigation/OnWayPointChange/011_OnWayPointChange_invalid_types.lua new file mode 100644 index 0000000000..751145798b --- /dev/null +++ b/test_scripts/API/Navigation/OnWayPointChange/011_OnWayPointChange_invalid_types.lua @@ -0,0 +1,83 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/28 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Notification_about_changes_to_Destination_or_Waypoints.md +-- Item: Use Case 1: Main Flow +-- +-- Requirement summary: +-- [OnWayPointChange] As a mobile application I want to be able to be notified on changes +-- to Destination or Waypoints based on my subscription +-- +-- Description: +-- In case: +-- 1) HMI sends OnWayPointChange notification with invalid type of parameters + +-- SDL must: +-- 1) not transfer notification to mobile application +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Local Variables ]] +local intType = 10 +local stringType = "string" +local LocationDetailsStringParams = { + "locationName", + "locationDescription", + "phoneNumber" +} +local OASISAddressParams = { + "countryName", + "countryCode", + "postalCode", + "administrativeArea", + "subAdministrativeArea", + "locality", + "subLocality", + "thoroughfare", + "subThoroughfare", +} + +--[[ Local Functions ]] +local function onWayPointChange(parameter, value, self) + local notification = { } + notification.wayPoints = {{ [parameter] = value }} + notification.appID = common.getHMIAppId() + self.hmiConnection:SendNotification("Navigation.OnWayPointChange", notification) + self.mobileSession1:ExpectNotification("OnWayPointChange") + :Times(0) + common.DelayedExp() +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) +runner.Step("Subscribe OnWayPointChange", common.subscribeWayPoints) + +runner.Title("Test") +runner.Step("OnWayPointChange_wayPoints_invalid_type_latitudeDegrees" , onWayPointChange, + { "coordinate", { latitudeDegrees = stringType, longitudeDegrees = 0.1 }}) +runner.Step("OnWayPointChange_wayPoints_invalid_type_longitudeDegrees" , onWayPointChange, + { "coordinate", { latitudeDegrees = 0.1, longitudeDegrees = stringType }}) +for _, value in pairs(LocationDetailsStringParams) do + runner.Step("OnWayPointChange_wayPoints_invalid_type_" .. value , onWayPointChange, { value, intType }) +end +for _, value in pairs(OASISAddressParams) do + runner.Step("OnWayPointChange_wayPoints_invalid_type_searchAddress_" .. value , onWayPointChange, + { "searchAddress", { [value] = intType }}) +end +runner.Step("OnWayPointChange_wayPoints_invalid_type_value_addressLines" , onWayPointChange, + { "addressLines", { intType }}) +runner.Step("OnWayPointChange_wayPoints_invalid_type_array_addressLines" , onWayPointChange, + { "addressLines", intType }) +runner.Step("OnWayPointChange_wayPoints_invalid_type_locationImage_value", onWayPointChange, + { "locationImage", { value = intType, imageType = "DYNAMIC" }}) +runner.Step("OnWayPointChange_wayPoints_invalid_type_locationImage_type", onWayPointChange, + { "locationImage", { value = "image", imageType = intType }}) + +runner.Title("Postconditions") +runner.Step("Subscribe OnWayPointChange", common.unsubscribeWayPoints) +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/OnWayPointChange/012_OnWayPointChange_invalid_characters.lua b/test_scripts/API/Navigation/OnWayPointChange/012_OnWayPointChange_invalid_characters.lua new file mode 100644 index 0000000000..1ad9d09a82 --- /dev/null +++ b/test_scripts/API/Navigation/OnWayPointChange/012_OnWayPointChange_invalid_characters.lua @@ -0,0 +1,93 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/28 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Notification_about_changes_to_Destination_or_Waypoints.md +-- Item: Use Case 1: Main Flow +-- +-- Requirement summary: +-- [OnWayPointChange] As a mobile application I want to be able to be notified on changes +-- to Destination or Waypoints based on my subscription +-- +-- Description: +-- In case: +-- 1) HMI sends OnWayPointChange notification with invalid characters \n, \t, whitespace only + +-- SDL must: +-- 1) not transfer notification to mobile application +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Local Variables ]] +local stringNewLine = "str\ning" +local stringTab = "str\ting" +local stringOnlyWhiteSpace = " " +local imageTypes = { "DYNAMIC", "STATIC" } +local LocationDetailsStringParams = { + "locationName", + "locationDescription", + "phoneNumber" +} +local OASISAddressParams = { + "countryName", + "countryCode", + "postalCode", + "administrativeArea", + "subAdministrativeArea", + "locality", + "subLocality", + "thoroughfare", + "subThoroughfare" +} + +--[[ Local Functions ]] +local function onWayPointChange(parameter, value, self) + local notification = { } + notification.wayPoints = {{ [parameter] = value }} + notification.appID = common.getHMIAppId() + self.hmiConnection:SendNotification("Navigation.OnWayPointChange", notification) + self.mobileSession1:ExpectNotification("OnWayPointChange") + :Times(0) + common.DelayedExp() +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) +runner.Step("Subscribe OnWayPointChange", common.subscribeWayPoints) + +runner.Title("Test") +for _, value in pairs(LocationDetailsStringParams) do + runner.Step("OnWayPointChange_wayPoints_newLine_" .. value , onWayPointChange, { value, stringNewLine }) + runner.Step("OnWayPointChange_wayPoints_tab_" .. value , onWayPointChange, { value, stringTab }) + runner.Step("OnWayPointChange_wayPoints_whitespace_" .. value , onWayPointChange, { value, stringOnlyWhiteSpace }) +end +for _, value in pairs(OASISAddressParams) do + runner.Step("OnWayPointChange_wayPoints_newLine_searchAddress_" .. value , onWayPointChange, + { "searchAddress", { [value] = stringNewLine }}) + runner.Step("OnWayPointChange_wayPoints_tab_searchAddress_" .. value , onWayPointChange, + { "searchAddress", { [value] = stringTab }}) + runner.Step("OnWayPointChange_wayPoints_whitespace_searchAddress_" .. value , onWayPointChange, + { "searchAddress", { [value] = stringOnlyWhiteSpace }}) +end +runner.Step("OnWayPointChange_wayPoints_newLine_value_addressLines" , onWayPointChange, + { "addressLines", { stringNewLine }}) +runner.Step("OnWayPointChange_wayPoints_tab_value_addressLines" , onWayPointChange, + { "addressLines", { stringTab }}) +runner.Step("OnWayPointChange_wayPoints_whitespace_value_addressLines" , onWayPointChange, + { "addressLines", { stringOnlyWhiteSpace }}) +for _, value in pairs(imageTypes) do + runner.Step("OnWayPointChange_wayPoints_newLine_locationImage_value_" .. value , onWayPointChange, + { "locationImage", { value = stringNewLine, imageType = value }}) + runner.Step("OnWayPointChange_wayPoints_tab_locationImage_value_" .. value , onWayPointChange, + { "locationImage", { value = stringTab, imageType = value }}) + runner.Step("OnWayPointChange_wayPoints_whitespace_locationImage_value_" .. value , onWayPointChange, + { "locationImage", { value = stringOnlyWhiteSpace, imageType = value }}) +end + +runner.Title("Postconditions") +runner.Step("Subscribe OnWayPointChange", common.unsubscribeWayPoints) +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/OnWayPointChange/013_OnWayPointChange_invalid_json.lua b/test_scripts/API/Navigation/OnWayPointChange/013_OnWayPointChange_invalid_json.lua new file mode 100644 index 0000000000..6edde58512 --- /dev/null +++ b/test_scripts/API/Navigation/OnWayPointChange/013_OnWayPointChange_invalid_json.lua @@ -0,0 +1,44 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/28 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Notification_about_changes_to_Destination_or_Waypoints.md +-- Item: Use Case 1: Main Flow +-- +-- Requirement summary: +-- [OnWayPointChange] As a mobile application I want to be able to be notified on changes +-- to Destination or Waypoints based on my subscription +-- +-- Description: +-- In case: +-- 1) HMI sends OnWayPointChange notification wint invalid json + +-- SDL must: +-- 1) not transfer notification to mobile application +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Local Functions ]] +local function onWayPointChange(self) + -- missed : + local text = '{"params":{"wayPoints":[{"locationName""Hotel"}]},"method":"Navigation.OnWayPointChange","jsonrpc":"2.0"}' + self.hmiConnection:Send(text) + self.mobileSession1:ExpectNotification("OnWayPointChange") + :Times(0) + common.DelayedExp() +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) +runner.Step("Subscribe OnWayPointChange", common.subscribeWayPoints) + +runner.Title("Test") +runner.Step("OnWayPointChange_wayPoints_invalid_json" , onWayPointChange) + +runner.Title("Postconditions") +runner.Step("Subscribe OnWayPointChange", common.unsubscribeWayPoints) +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/OnWayPointChange/014_OnWayPointChange_WithInvalidJsonStructure.lua b/test_scripts/API/Navigation/OnWayPointChange/014_OnWayPointChange_WithInvalidJsonStructure.lua new file mode 100644 index 0000000000..61999dfafc --- /dev/null +++ b/test_scripts/API/Navigation/OnWayPointChange/014_OnWayPointChange_WithInvalidJsonStructure.lua @@ -0,0 +1,43 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/28 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Notification_about_changes_to_Destination_or_Waypoints.md +-- Item: Use Case 1: Main Flow +-- +-- Requirement summary: +-- [OnWayPointChange] As a mobile application I want to be able to be notified on changes +-- to Destination or Waypoints based on my subscription +-- +-- Description: +-- In case: +-- 1) SDL and HMI are started, Navi interface and embedded navigation source are available on HMI, +-- mobile applications are registered on SDL and subscribed on destination and waypoints changes notification +-- 2) HMI sends notification with invalid json struct + +-- SDL must: +-- 1) SDL validates notification and ignore it +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + + +--[[ Local Functions ]] +local function onWayPointChange(self) + self.hmiConnection:Send('{"params":{"wayPoints":{ "locationName":"test"},"method":"Navigation.OnWayPointChange"},"jsonrpc":"2.0"}') + self.mobileSession1:ExpectNotification("OnWayPointChange", {}):Times(0) + common:DelayedExp() +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) +runner.Step("Subscribe OnWayPointChange", common.subscribeWayPoints) + +runner.Title("Test") +runner.Step("OnWayPointChange", onWayPointChange) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/OnWayPointChange/015_OnWayPointChange_WithFakeParams_SuccessWOFakeParams.lua b/test_scripts/API/Navigation/OnWayPointChange/015_OnWayPointChange_WithFakeParams_SuccessWOFakeParams.lua new file mode 100644 index 0000000000..8a25da5d6e --- /dev/null +++ b/test_scripts/API/Navigation/OnWayPointChange/015_OnWayPointChange_WithFakeParams_SuccessWOFakeParams.lua @@ -0,0 +1,126 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/28 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Notification_about_changes_to_Destination_or_Waypoints.md +-- Item: Use Case 1: Main Flow +-- +-- Requirement summary: +-- [OnWayPointChange] As a mobile application I want to be able to be notified on changes +-- to Destination or Waypoints based on my subscription +-- +-- Description: +-- In case: +-- 1) SDL and HMI are started, Navi interface and embedded navigation source are available on HMI, +-- mobile applications are registered on SDL and subscribed on destination and waypoints changes notification +-- 2) Any change in destination or waypoints is registered on HMI (user set new route, canselled the route, +-- arrived at destination point or crossed a waypoint) and HMI sends several fake params + +-- SDL must: +-- 1) Transfer the notification about changes to destination or waypoints to mobile application without fake params +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') +local commonFunctions = require('user_modules/shared_testcases/commonFunctions') + +--[[ Local Variables ]] +local NotificationWithFakeParams = + { + wayPoints= + { + { + coordinate={ + longitudeDegrees = -180.0, + latitudeDegrees = -90.0, + fake="a" + }, + locationName="Odessa", + addressLines={"Bolshaya Arnautskaya 72/74"}, + locationDescription="Luxoft", + phoneNumber="1231414", + locationImage={ + value = "icon.png", + imageType = "DYNAMIC", + fake="a" + }, + searchAddress={ + countryName="UA", + countryCode="380", + postalCode="65045", + administrativeArea="aa", + subAdministrativeArea="a", + locality="a", + subLocality="a", + thoroughfare="a", + subThoroughfare="a", + fake="a" + }, + fake="fakeparam" + }, + }, + fake="fakeparam" + } + + local NotificationWithoutFakeParams = + { + wayPoints= + { + { + coordinate={ + longitudeDegrees = -180.0, + latitudeDegrees = -90.0 + }, + locationName="Odessa", + addressLines={"Bolshaya Arnautskaya 72/74"}, + locationDescription="Luxoft", + phoneNumber="1231414", + locationImage={ + value = "icon.png", + imageType = "DYNAMIC" + }, + searchAddress={ + countryName="UA", + countryCode="380", + postalCode="65045", + administrativeArea="aa", + subAdministrativeArea="a", + locality="a", + subLocality="a", + thoroughfare="a", + subThoroughfare="a" + } + } + } + } + +--[[ Local Functions ]] +local function onWayPointChange(self) + self.hmiConnection:SendNotification("Navigation.OnWayPointChange", NotificationWithFakeParams) + self.mobileSession1:ExpectNotification("OnWayPointChange", NotificationWithoutFakeParams) + :ValidIf (function(_, data) + if data.payload.fake or + data.payload.wayPoints[1].fake or + data.payload.wayPoints[1].coordinate.fake or + data.payload.wayPoints[1].searchAddress.fake or + data.payload.wayPoints[1].locationImage.fake + then + commonFunctions:printError(" SDL resends fake parameter to mobile app ") + return false + else + return true + end + end) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) +runner.Step("Subscribe OnWayPointChange", common.subscribeWayPoints) + +runner.Title("Test") +runner.Step("OnWayPointChange with fake params", onWayPointChange) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/OnWayPointChange/016_OnWayPointChange_WithFakeParamsFromAnotherAPI_SuccessWOFakeParams.lua b/test_scripts/API/Navigation/OnWayPointChange/016_OnWayPointChange_WithFakeParamsFromAnotherAPI_SuccessWOFakeParams.lua new file mode 100644 index 0000000000..6a0b32cb34 --- /dev/null +++ b/test_scripts/API/Navigation/OnWayPointChange/016_OnWayPointChange_WithFakeParamsFromAnotherAPI_SuccessWOFakeParams.lua @@ -0,0 +1,126 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/28 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Notification_about_changes_to_Destination_or_Waypoints.md +-- Item: Use Case 1: Main Flow +-- +-- Requirement summary: +-- [OnWayPointChange] As a mobile application I want to be able to be notified on changes +-- to Destination or Waypoints based on my subscription +-- +-- Description: +-- In case: +-- 1) SDL and HMI are started, Navi interface and embedded navigation source are available on HMI, +-- mobile applications are registered on SDL and subscribed on destination and waypoints changes notification +-- 2) Any change in destination or waypoints is registered on HMI (user set new route, canselled the route, +-- arrived at destination point or crossed a waypoint) and HMI sends several fake params + +-- SDL must: +-- 1) Transfer the notification about changes to destination or waypoints to mobile application without fake params +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') +local commonFunctions = require('user_modules/shared_testcases/commonFunctions') + +--[[ Local Variables ]] +local NotificationWithFakeParams = + { + wayPoints= + { + { + coordinate={ + longitudeDegrees = -180.0, + latitudeDegrees = -90.0, + sliderPosition = 4 + }, + locationName="Odessa", + addressLines={"Bolshaya Arnautskaya 72/74"}, + locationDescription="Luxoft", + phoneNumber="1231414", + locationImage={ + value = "icon.png", + imageType = "DYNAMIC", + sliderPosition = 4 + }, + searchAddress={ + countryName="UA", + countryCode="380", + postalCode="65045", + administrativeArea="aa", + subAdministrativeArea="a", + locality="a", + subLocality="a", + thoroughfare="a", + subThoroughfare="a", + sliderPosition = 4 + }, + sliderPosition = 4 + }, + }, + sliderPosition = 4 + } + + local NotificationWithoutFakeParams = + { + wayPoints= + { + { + coordinate={ + longitudeDegrees = -180.0, + latitudeDegrees = -90.0 + }, + locationName="Odessa", + addressLines={"Bolshaya Arnautskaya 72/74"}, + locationDescription="Luxoft", + phoneNumber="1231414", + locationImage={ + value = "icon.png", + imageType = "DYNAMIC" + }, + searchAddress={ + countryName="UA", + countryCode="380", + postalCode="65045", + administrativeArea="aa", + subAdministrativeArea="a", + locality="a", + subLocality="a", + thoroughfare="a", + subThoroughfare="a" + } + } + } + } + +--[[ Local Functions ]] +local function onWayPointChange(self) + self.hmiConnection:SendNotification("Navigation.OnWayPointChange", NotificationWithFakeParams) + self.mobileSession1:ExpectNotification("OnWayPointChange", NotificationWithoutFakeParams) + :ValidIf (function(_, data) + if data.payload.sliderPosition or + data.payload.wayPoints[1].sliderPosition or + data.payload.wayPoints[1].coordinate.sliderPosition or + data.payload.wayPoints[1].searchAddress.sliderPosition or + data.payload.wayPoints[1].locationImage.sliderPosition + then + commonFunctions:printError(" SDL resends fake parameter to mobile app ") + return false + else + return true + end + end) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) +runner.Step("Subscribe OnWayPointChange", common.subscribeWayPoints) + +runner.Title("Test") +runner.Step("OnWayPointChange with fake params", onWayPointChange) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/OnWayPointChange/017_OnWayPointChange_SeveralNotificationsWithIdenticalParams_AllSuccess.lua b/test_scripts/API/Navigation/OnWayPointChange/017_OnWayPointChange_SeveralNotificationsWithIdenticalParams_AllSuccess.lua new file mode 100644 index 0000000000..741e21a5b6 --- /dev/null +++ b/test_scripts/API/Navigation/OnWayPointChange/017_OnWayPointChange_SeveralNotificationsWithIdenticalParams_AllSuccess.lua @@ -0,0 +1,77 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/28 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Notification_about_changes_to_Destination_or_Waypoints.md +-- Item: Use Case 1: Main Flow +-- +-- Requirement summary: +-- [OnWayPointChange] As a mobile application I want to be able to be notified on changes +-- to Destination or Waypoints based on my subscription +-- +-- Description: +-- In case: +-- 1) SDL and HMI are started, Navi interface and embedded navigation source are available on HMI, +-- mobile applications are registered on SDL and subscribed on destination and waypoints changes notification +-- 2) Any change in destination or waypoints is registered on HMI (user set new route, canselled the route, +-- arrived at destination point or crossed a waypoint) and HMI sends several identical notifications + +-- SDL must: +-- 1) Transfer notifications about changes to destination or waypoints to mobile application +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Local Variables ]] + local Notification = + { + wayPoints= + { + { + coordinate={ + longitudeDegrees = -180.0, + latitudeDegrees = -90.0 + }, + locationName="Odessa", + addressLines={"Bolshaya Arnautskaya 72/74"}, + locationDescription="Luxoft", + phoneNumber="1231414", + locationImage={ + value = "icon.png", + imageType = "DYNAMIC" + }, + searchAddress={ + countryName="UA", + countryCode="380", + postalCode="65045", + administrativeArea="aa", + subAdministrativeArea="a", + locality="a", + subLocality="a", + thoroughfare="a", + subThoroughfare="a" + } + } + } + } + +--[[ Local Functions ]] +local function onWayPointChange(self) + self.hmiConnection:SendNotification("Navigation.OnWayPointChange", Notification) + self.hmiConnection:SendNotification("Navigation.OnWayPointChange", Notification) + self.hmiConnection:SendNotification("Navigation.OnWayPointChange", Notification) + self.mobileSession1:ExpectNotification("OnWayPointChange", Notification):Times(3) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) +runner.Step("Subscribe OnWayPointChange", common.subscribeWayPoints) + +runner.Title("Test") +runner.Step("OnWayPointChange 3 times with identical params", onWayPointChange) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/OnWayPointChange/018_OnWayPointChange_SeveralNotificationsWithDiffParams_AllSuccess.lua b/test_scripts/API/Navigation/OnWayPointChange/018_OnWayPointChange_SeveralNotificationsWithDiffParams_AllSuccess.lua new file mode 100644 index 0000000000..cb5e87c574 --- /dev/null +++ b/test_scripts/API/Navigation/OnWayPointChange/018_OnWayPointChange_SeveralNotificationsWithDiffParams_AllSuccess.lua @@ -0,0 +1,98 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/28 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Notification_about_changes_to_Destination_or_Waypoints.md +-- Item: Use Case 1: Main Flow +-- +-- Requirement summary: +-- [OnWayPointChange] As a mobile application I want to be able to be notified on changes +-- to Destination or Waypoints based on my subscription +-- +-- Description: +-- In case: +-- 1) SDL and HMI are started, Navi interface and embedded navigation source are available on HMI, +-- mobile applications are registered on SDL and subscribed on destination and waypoints changes notification +-- 2) Any change in destination or waypoints is registered on HMI (user set new route, canselled the route, +-- arrived at destination point or crossed a waypoint) and HMI sends several notifications with different parameter values + +-- SDL must: +-- 1) Transfer notifications about changes to destination or waypoints to mobile application +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') +local commonFunctions = require('user_modules/shared_testcases/commonFunctions') + +--[[ Local Variables ]] +local Notification1 = { + wayPoints= + { + { + coordinate={ + longitudeDegrees = -180.0, + latitudeDegrees = -90.0 + } + } + } +} +local Notification2 = { + wayPoints= + { + { + + locationName="Odessa", + addressLines={"Bolshaya Arnautskaya 72/74"}, + locationDescription="Luxoft", + phoneNumber="1231414", + locationImage={ + value = "icon.png", + imageType = "DYNAMIC" + } + } + } +} +local Notification3 = { + wayPoints= + { + { + searchAddress={ + countryName="UA", + countryCode="380", + postalCode="65045", + administrativeArea="aa", + subAdministrativeArea="a", + locality="a", + subLocality="a", + thoroughfare="a", + subThoroughfare="a" + } + } + } +} + +--[[ Local Functions ]] +local function onWayPointChange(self) + self.hmiConnection:SendNotification("Navigation.OnWayPointChange", Notification1) + self.hmiConnection:SendNotification("Navigation.OnWayPointChange", Notification2) + self.hmiConnection:SendNotification("Navigation.OnWayPointChange", Notification3) + self.mobileSession1:ExpectNotification( + "OnWayPointChange", + Notification1, + Notification2, + Notification3 + ) + :Times(3) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) +runner.Step("Subscribe OnWayPointChange", common.subscribeWayPoints) + +runner.Title("Test") +runner.Step("OnWayPointChange 3 times with identical params", onWayPointChange) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/OnWayPointChange/019_OnWayPointChange_diff_HMI_levels.lua b/test_scripts/API/Navigation/OnWayPointChange/019_OnWayPointChange_diff_HMI_levels.lua new file mode 100644 index 0000000000..7e0fadb14c --- /dev/null +++ b/test_scripts/API/Navigation/OnWayPointChange/019_OnWayPointChange_diff_HMI_levels.lua @@ -0,0 +1,95 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/28 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Notification_about_changes_to_Destination_or_Waypoints.md +-- Item: Use Case 1: Main Flow +-- +-- Requirement summary: +-- [OnWayPointChange] As a mobile application I want to be able to be notified on changes +-- to Destination or Waypoints based on my subscription +-- +-- Description: +-- In case: +-- 1) HMI sends valid OnWayPointChange notification +-- 2) notification allowed by policies in FULL, BACKGROUND,LIMITED levels +-- 3) and not allowed in NONE HMI level +-- SDL must: +-- 1) transfer notification to mobile application in allowed HMI levels +-- 2) not transfer notification to mobile application in not alloewed HMI levels +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Local Variables ]] +--[[ General configuration parameters ]] +config.application1.registerAppInterfaceParams.isMediaApplication = true +config.application1.registerAppInterfaceParams.appHMIType = {"NAVIGATION"} +config.application2.registerAppInterfaceParams.isMediaApplication = false +config.application2.registerAppInterfaceParams.appHMIType = {"NAVIGATION"} + +--[[ Local Variables ]] +local notificationParams = { + wayPoints = { + { + coordinate = + { + latitudeDegrees = 1.1, + longitudeDegrees = 1.1 + }, + locationName = "Hotel" + } + } +} + +--[[ Local Functions ]] +local function onWayPointChangeDisallowed(notification, self) + notification.appID = common.getHMIAppId(2) + self.hmiConnection:SendNotification("Navigation.OnWayPointChange", notification) + self.mobileSession2:ExpectNotification("OnWayPointChange") + :Times(0) + common.DelayedExp() +end + +local function onWayPointChangeSuccess(notification, self) + notification.appID = common.getHMIAppId(1) + self.hmiConnection:SendNotification("Navigation.OnWayPointChange", notification) + self.mobileSession1:ExpectNotification("OnWayPointChange") +end + +local function BringAppToLimitedLevel(self) + local appIDval = common.getHMIAppId(1) + self.hmiConnection:SendNotification("BasicCommunication.OnAppDeactivated", + { appID = appIDval }) + self.mobileSession1:ExpectNotification("OnHMIStatus", { hmiLevel = "LIMITED" }) +end + +local function BringAppToBackgroundLevel(self) + common.activateApp(2, self) + self.mobileSession1:ExpectNotification("OnHMIStatus",{ hmiLevel = "BACKGROUND" }) +end + +local function ptuUpdateFunc(pTbl) + pTbl.policy_table.functional_groupings["WayPoints"].rpcs.OnWayPointChange = + { hmi_levels = {"BACKGROUND","FULL","LIMITED" }} +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU first app", common.registerAppWithPTU, {1, ptuUpdateFunc}) +runner.Step("RAI, PTU second app", common.registerAppWithPTU, {2, ptuUpdateFunc}) +runner.Step("Activate App", common.activateApp) +runner.Step("Subscribe OnWayPointChange", common.subscribeWayPoints) + +runner.Title("Test") +runner.Step("OnWayPointChange_in_NONE", onWayPointChangeDisallowed, { notificationParams }) +runner.Step("OnWayPointChange_in_FULL", onWayPointChangeSuccess, { notificationParams }) +runner.Step("Bring_app_to_limited", BringAppToLimitedLevel) +runner.Step("OnWayPointChange_in_LIMITED", onWayPointChangeSuccess, { notificationParams }) +runner.Step("Bring_app_to_background", BringAppToBackgroundLevel) +runner.Step("OnWayPointChange_in_BACKGROUND", onWayPointChangeSuccess, { notificationParams }) + +runner.Title("Postconditions") +runner.Step("Unsubscribe OnWayPointChange", common.unsubscribeWayPoints) +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/SubscribeWayPoints/001_SubscribeWayPoints_success_flow.lua b/test_scripts/API/Navigation/SubscribeWayPoints/001_SubscribeWayPoints_success_flow.lua new file mode 100755 index 0000000000..f8ce8c6f01 --- /dev/null +++ b/test_scripts/API/Navigation/SubscribeWayPoints/001_SubscribeWayPoints_success_flow.lua @@ -0,0 +1,63 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/26 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Subscribe_to_Destination_and_Waypoints.md +-- Item: Use Case 1: Main Flow +-- +-- Requirement summary: +-- [SubscribeWayPoints] As a mobile app I want to be able to subscribe on notifications about +-- any changes to the destination or waypoints. +-- +-- Description: +-- In case: +-- 1) mobile application sent valid and allowed by Policies SubscribeWayPoints_request to SDL +-- +-- SDL must: +-- 1) transfer SubscribeWayPoints_request_ to HMI +-- 2) respond with received from HMI to mobile app + +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Local Variables ]] +local notification = { + wayPoints = { + { + coordinate = { + latitudeDegrees = 1.1, + longitudeDegrees = 1.1 + } + } + } +} + +--[[ Local Functions ]] +local function subscribeWayPointsFirstApp(self) + local cid = self.mobileSession1:SendRPC("SubscribeWayPoints", {}) + EXPECT_HMICALL("Navigation.SubscribeWayPoints") + :Do(function(_,data) + self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", {}) + end) + self.mobileSession1:ExpectResponse(cid, { success = true , resultCode = "SUCCESS" }) + self.mobileSession1:ExpectNotification("OnHashChange") +end + +local function onWayPointChangeToBothApps(self) + self.hmiConnection:SendNotification("Navigation.OnWayPointChange", notification) + self.mobileSession1:ExpectNotification("OnWayPointChange", notification) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("SubscribeWayPoints first app", subscribeWayPointsFirstApp) +runner.Step("OnWayPointChange to check apps subscription", onWayPointChangeToBothApps) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/SubscribeWayPoints/002_SubscribeWayPoints_DISALLOWED_by_policy.lua b/test_scripts/API/Navigation/SubscribeWayPoints/002_SubscribeWayPoints_DISALLOWED_by_policy.lua new file mode 100755 index 0000000000..18a3ad879b --- /dev/null +++ b/test_scripts/API/Navigation/SubscribeWayPoints/002_SubscribeWayPoints_DISALLOWED_by_policy.lua @@ -0,0 +1,45 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/26 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Subscribe_to_Destination_and_Waypoints.md +-- Item: Use Case 1: Alternative flow 2: Request is not allowed by Policies +-- +-- Requirement summary: +-- [SubscribeWayPoints] As a mobile app I want to be able to subscribe on notifications about +-- any changes to the destination or waypoints. +-- +-- Description: +-- In case: +-- 1) mobile application sent valid SubscribeWayPoints_request to SDL and this request is NOT allowed by Policies +-- +-- SDL must: +-- 1) SDL responds DISALLOWED, success:false to mobile application and doesn't transfer this request to HMI + +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Local Functions ]] +local function subscribeWayPoints(self) + local cid = self.mobileSession1:SendRPC("SubscribeWayPoints", {}) + EXPECT_HMICALL("Navigation.SubscribeWayPoints"):Times(0) + self.mobileSession1:ExpectResponse(cid, { success = false , resultCode = "DISALLOWED" }) + common:DelayedExp() +end + +local function ptuUpdateFunc(pTbl) + pTbl.policy_table.functional_groupings["WayPoints"].rpcs.SubscribeWayPoints = nil +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerAppWithPTU, { common.appId1, ptuUpdateFunc }) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("SubscribeWayPoints DISALLOWED by policy", subscribeWayPoints) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/SubscribeWayPoints/003_SubscribeWayPoints_IGNORED_already_subscribed_app.lua b/test_scripts/API/Navigation/SubscribeWayPoints/003_SubscribeWayPoints_IGNORED_already_subscribed_app.lua new file mode 100755 index 0000000000..3b3f077f76 --- /dev/null +++ b/test_scripts/API/Navigation/SubscribeWayPoints/003_SubscribeWayPoints_IGNORED_already_subscribed_app.lua @@ -0,0 +1,62 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/26 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Subscribe_to_Destination_and_Waypoints.md +-- Item: Use Case 2: Mobile application is already subscribed to Destination & Waypoints : Main Flow +-- +-- Requirement summary: +-- [SubscribeWayPoints] As a mobile app I want to be able to subscribe on notifications about +-- any changes to the destination or waypoints. +-- +-- Description: +-- In case: +-- 1) Mobile application is subscribed to destination & waypoints change notification +-- and the same mobile application sends new request to subscribe on destination and waypoints change notification +-- +-- SDL must: +-- 1) SDL responds with result code IGNORED, success:false to mobile application +-- 2) SDL keeps the subscription status of the application unchanged + +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Local Variables ]] +local notification = { + wayPoints = { + { + coordinate = { + latitudeDegrees = 1.1, + longitudeDegrees = 1.1 + } + } + } +} + +--[[ Local Functions ]] +local function subscribeWayPoints(self) + local cid = self.mobileSession1:SendRPC("SubscribeWayPoints", {}) + EXPECT_HMICALL("Navigation.SubscribeWayPoints"):Times(0) + self.mobileSession1:ExpectResponse(cid, { success = false , resultCode = "IGNORED" }) + common:DelayedExp() +end + +local function onWayPointChange(self) + self.hmiConnection:SendNotification("Navigation.OnWayPointChange", notification) + self.mobileSession1:ExpectNotification("OnWayPointChange", notification) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) +runner.Step("SubscribeWayPoints", common.subscribeWayPoints) + +runner.Title("Test") +runner.Step("SubscribeWayPoints for the same app IGNORED", subscribeWayPoints) +runner.Step("OnWayPointChange to check app subscription", onWayPointChange) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/SubscribeWayPoints/004_SubscribeWayPoints_UNSUPPORTED_RESOURCE_Navi_interface_is_not_available.lua b/test_scripts/API/Navigation/SubscribeWayPoints/004_SubscribeWayPoints_UNSUPPORTED_RESOURCE_Navi_interface_is_not_available.lua new file mode 100755 index 0000000000..9eeb309241 --- /dev/null +++ b/test_scripts/API/Navigation/SubscribeWayPoints/004_SubscribeWayPoints_UNSUPPORTED_RESOURCE_Navi_interface_is_not_available.lua @@ -0,0 +1,67 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/26 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Subscribe_to_Destination_and_Waypoints.md +-- Item: Use Case 1: Subscribe to Destination & Waypoints: Alternative flow 3: Navigation interface is not available on HMI +-- +-- Requirement summary: +-- [SubscribeWayPoints] As a mobile app I want to be able to subscribe on notifications about +-- any changes to the destination or waypoints. +-- +-- Description: +-- In case: +-- 1) Navigation interface is not available on HMI +-- +-- SDL must: +-- 1) SDL responds UNSUPPORTED_RESOURCE, success:false to mobile app and doesn't subscribe on destination +-- and waypoints change notifications +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') +local hmi_values = require('user_modules/hmi_values') + +--[[ Local Variables ]] +local notification = { + wayPoints = { + { + coordinate = { + latitudeDegrees = 1.1, + longitudeDegrees = 1.1 + } + } + } +} + +--[[ Local Functions ]] +local function disableNavigationInterface() + local params = hmi_values.getDefaultHMITable() + params.Navigation.IsReady.params.available = false + return params +end + +local function subscribeWayPoints(self) + local cid = self.mobileSession1:SendRPC("SubscribeWayPoints", {}) + EXPECT_HMICALL("Navigation.SubscribeWayPoints"):Times(0) + self.mobileSession1:ExpectResponse(cid, { success = false, resultCode = "UNSUPPORTED_RESOURCE" }) + common:DelayedExp() +end + +local function onWayPointChange(self) + self.hmiConnection:SendNotification("Navigation.OnWayPointChange", notification) + self.mobileSession1:ExpectNotification("OnWayPointChange"):Times(0) + common:DelayedExp() +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start, { disableNavigationInterface() }) +runner.Step("RAI", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("SubscribeWayPoints, navigation interface is not available on HMI", subscribeWayPoints) +runner.Step("OnWayPointChange to check that app is not subscribed", onWayPointChange) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/SubscribeWayPoints/005_SubscribeWayPoints_INVALID_DATA.lua b/test_scripts/API/Navigation/SubscribeWayPoints/005_SubscribeWayPoints_INVALID_DATA.lua new file mode 100644 index 0000000000..6968fbd97f --- /dev/null +++ b/test_scripts/API/Navigation/SubscribeWayPoints/005_SubscribeWayPoints_INVALID_DATA.lua @@ -0,0 +1,43 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/26 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Subscribe_to_Destination_and_Waypoints.md +-- Item: Use Case 1: Subscribe to Destination & Waypoints: Alternative flow 1: Request is invalid +-- +-- Requirement summary: +-- [SubscribeWayPoints] As a mobile app I want to be able to subscribe on notifications about +-- any changes to the destination or waypoints. +-- +-- Description: +-- In case: +-- 1) Request is invalid +-- +-- SDL must: +-- 1) SDL responds INVALID_DATA, success:false to mobile application and doesn't subscribe on destination and waypoints change notifications + +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Local Functions ]] +local function invalidJson(self) + local params = { "/ // "} + local cid = self.mobileSession1:SendRPC("SubscribeWayPoints", params) + EXPECT_HMICALL("Navigation.SubscribeWayPoints"):Times(0) + + self.mobileSession1:ExpectResponse(cid, { success = false, resultCode = "INVALID_DATA" }) + common:DelayedExp() +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("SubscribeWayPoints invalid json", invalidJson) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/SubscribeWayPoints/006_SubscribeWayPoints_GENERIC_ERROR_HMI_did_not_respond.lua b/test_scripts/API/Navigation/SubscribeWayPoints/006_SubscribeWayPoints_GENERIC_ERROR_HMI_did_not_respond.lua new file mode 100755 index 0000000000..55ed1daca1 --- /dev/null +++ b/test_scripts/API/Navigation/SubscribeWayPoints/006_SubscribeWayPoints_GENERIC_ERROR_HMI_did_not_respond.lua @@ -0,0 +1,45 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/26 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Subscribe_to_Destination_and_Waypoints.md +-- Item: Use Case 1: Subscribe to Destination & Waypoints +-- +-- Requirement summary: +-- [SubscribeWayPoints] As a mobile app I want to be able to subscribe on notifications about +-- any changes to the destination or waypoints. +-- +-- Description: +-- In case: +-- 1) mobile application sends valid and allowed by Policies SubscribeWayPoints to SDL +-- and HMI did not respond during default timeout +-- SDL must: +-- 1) SDL responds GENERIC_ERROR, success:false to mobile application + +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') +local commonTestCases = require('user_modules/shared_testcases/commonTestCases') + +--[[ Local Functions ]] +local function subscribeWayPoints(self) + local cid = self.mobileSession1:SendRPC("SubscribeWayPoints", {}) + EXPECT_HMICALL("Navigation.SubscribeWayPoints") + :Do(function() + -- HMI does not respond + end) + self.mobileSession1:ExpectResponse(cid, { success = false, resultCode = "GENERIC_ERROR"}) + commonTestCases:DelayedExp(11000) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("SubscribeWayPoints, HMI did not respond", subscribeWayPoints) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/SubscribeWayPoints/007_SubscribeWayPoints_GENERIC_ERROR_HMI_respond_with_invalid_data.lua b/test_scripts/API/Navigation/SubscribeWayPoints/007_SubscribeWayPoints_GENERIC_ERROR_HMI_respond_with_invalid_data.lua new file mode 100755 index 0000000000..f122ec2521 --- /dev/null +++ b/test_scripts/API/Navigation/SubscribeWayPoints/007_SubscribeWayPoints_GENERIC_ERROR_HMI_respond_with_invalid_data.lua @@ -0,0 +1,46 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/26 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Subscribe_to_Destination_and_Waypoints.md +-- Item: Use Case 1: Subscribe to Destination & Waypoints +-- +-- Requirement summary: +-- [SubscribeWayPoints] As a mobile app I want to be able to subscribe on notifications about +-- any changes to the destination or waypoints. +-- +-- Description: +-- In case: +-- 1) mobile application sends valid and allowed by Policies SubscribeWayPoints to SDL +-- and HMI respond with invalid data +-- SDL must: +-- 1) SDL responds GENERIC_ERROR, success:false to mobile application + +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Local Functions ]] +local function subscribeWayPoints(self) + local cid = self.mobileSession1:SendRPC("SubscribeWayPoints", {}) + EXPECT_HMICALL("Navigation.SubscribeWayPoints") + :Do(function(_, data) + local msg = '{"result":{"method":' .. tostring(data.method) -- method name without quotes + .. ',"code":0},"id":' .. tostring(data.id) + .. ',"jsonrpc":"2.0"}' + self.hmiConnection:Send(msg) + end) + self.mobileSession1:ExpectResponse(cid, { success = false, resultCode = "GENERIC_ERROR"}) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("SubscribeWayPoints, HMI respond with invalid data", subscribeWayPoints) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/SubscribeWayPoints/008_SubscribeWayPoints_IGN_OFF.lua b/test_scripts/API/Navigation/SubscribeWayPoints/008_SubscribeWayPoints_IGN_OFF.lua new file mode 100755 index 0000000000..ccb13d6ada --- /dev/null +++ b/test_scripts/API/Navigation/SubscribeWayPoints/008_SubscribeWayPoints_IGN_OFF.lua @@ -0,0 +1,60 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/26 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Subscribe_to_Destination_and_Waypoints.md +-- Item: Use Case 2: Mobile application is already subscribed to Destination & Waypoints: Alternative flow 2: Ignition OFF - ignition cycle is over +-- +-- Requirement summary: +-- [SubscribeWayPoints] As a mobile app I want to be able to subscribe on notifications about +-- any changes to the destination or waypoints. +-- +-- Description: +-- In case: +-- 1) Ignition OFF - ignition cycle is over +-- 2) New ignitions cycle, mobile application registers with the same hashID as in previous ignition cycle +-- SDL must: +-- 1) SDL restores the subscription status of mobile application + +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Local Variables ]] +local notification = { + wayPoints = { + { + coordinate = { + latitudeDegrees = 1.1, + longitudeDegrees = 1.1 + } + } + } +} + +--[[ Local Functions ]] +local function onWayPointChange(self) + self.hmiConnection:SendNotification("Navigation.OnWayPointChange", notification) + self.mobileSession1:ExpectNotification("OnWayPointChange", notification) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) +runner.Step("SubscribeWayPoints", common.subscribeWayPoints) +runner.Step("OnWayPointChange to check app subscription", onWayPointChange) + +runner.Title("Test") + +runner.Step("IGNITION_OFF", common.IGNITION_OFF) + +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerAppWithTheSameHashId) +runner.Step("Activate App", common.activateApp) + +runner.Step("OnWayPointChange to check app subscription", onWayPointChange) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/SubscribeWayPoints/009_SubscribeWayPoints_unexpected_disconnect.lua b/test_scripts/API/Navigation/SubscribeWayPoints/009_SubscribeWayPoints_unexpected_disconnect.lua new file mode 100755 index 0000000000..f406c79bae --- /dev/null +++ b/test_scripts/API/Navigation/SubscribeWayPoints/009_SubscribeWayPoints_unexpected_disconnect.lua @@ -0,0 +1,62 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/26 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Subscribe_to_Destination_and_Waypoints.md +-- Item: Use Case 2: Mobile application is already subscribed to Destination & Waypoints: Alternative flow 1: Mobile application unexpectedly disconnects +-- +-- Requirement summary: +-- [SubscribeWayPoints] As a mobile app I want to be able to subscribe on notifications about +-- any changes to the destination or waypoints. +-- +-- Description: +-- In case: +-- 1) Mobile application unexpectedly disconnects +-- SDL must: +-- 1) SDL stores the subscription status internally +-- 2) SDL sends request to unsubscribe mobile application to HMI +-- 3) SDL restores the subscription status right after application reconnects with the same hashID +-- that was before disconnect + +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Local Variables ]] +local notification = { + wayPoints = { + { + coordinate = { + latitudeDegrees = 1.1, + longitudeDegrees = 1.1 + } + } + } +} + +--[[ Local Functions ]] +local function onWayPointChange(self) + self.hmiConnection:SendNotification("Navigation.OnWayPointChange", notification) + self.mobileSession1:ExpectNotification("OnWayPointChange", notification) +end + +local function closeSession(self) + self.mobileSession1:Stop() + EXPECT_HMINOTIFICATION("BasicCommunication.OnAppUnregistered", + { unexpectedDisconnect = true, appID = common.getHMIAppId() }) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) +runner.Step("SubscribeWayPoints", common.subscribeWayPoints) + +runner.Title("Test") +runner.Step("Unexpected disconnect", closeSession) +runner.Step("RAI", common.registerAppWithTheSameHashId) +runner.Step("OnWayPointChange to check app subscription", onWayPointChange) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/SubscribeWayPoints/010_SubscribeWayPoints_2_apps.lua b/test_scripts/API/Navigation/SubscribeWayPoints/010_SubscribeWayPoints_2_apps.lua new file mode 100755 index 0000000000..a43fd853b4 --- /dev/null +++ b/test_scripts/API/Navigation/SubscribeWayPoints/010_SubscribeWayPoints_2_apps.lua @@ -0,0 +1,78 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/26 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Subscribe_to_Destination_and_Waypoints.md +-- Item: Use Case 2: Alternative flow 3 +-- +-- Requirement summary: +-- [SubscribeWayPoints] As a mobile app I want to be able to subscribe on notifications about +-- any changes to the destination or waypoints. +-- +-- Description: +-- In case: +-- 1) Another application requests to sunbscribe on destination and waypoints change notification +-- +-- SDL must: +-- 1) SDL subscribes new mobile application internally +-- 2) SDL responds SUCCESS, success:true on subscription request of the second application +-- 3) SDL doesn't transfer new subscription request to HMI +-- 4) SDL transfers stored waypoints change notification to newly subscribed application + +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Local Variables ]] +local notification = { + wayPoints = { + { + coordinate = { + latitudeDegrees = 1.1, + longitudeDegrees = 1.1 + } + } + } +} + +--[[ Local Functions ]] +local function subscribeWayPointsFirstApp(self) + local cid = self.mobileSession1:SendRPC("SubscribeWayPoints", {}) + EXPECT_HMICALL("Navigation.SubscribeWayPoints") + :Do(function(_,data) + self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", {}) + end) + self.mobileSession1:ExpectResponse(cid, { success = true , resultCode = "SUCCESS" }) + self.mobileSession1:ExpectNotification("OnHashChange") +end + +local function subscribeWayPointsSecondApp(self) + local cid = self.mobileSession2:SendRPC("SubscribeWayPoints", {}) + EXPECT_HMICALL("Navigation.SubscribeWayPoints"):Times(0) + self.mobileSession2:ExpectResponse(cid, { success = true , resultCode = "SUCCESS" }) + self.mobileSession2:ExpectNotification("OnHashChange") + common:DelayedExp() +end + +local function onWayPointChangeToBothApps(self) + self.hmiConnection:SendNotification("Navigation.OnWayPointChange", notification) + self.mobileSession1:ExpectNotification("OnWayPointChange", notification) + self.mobileSession2:ExpectNotification("OnWayPointChange", notification) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) + +for i = 1, 2 do + runner.Step("RAI, PTU " .. i, common.registerAppWithPTU, { i }) + runner.Step("Activate App " .. i, common.activateApp, { i }) +end + +runner.Title("Test") +runner.Step("SubscribeWayPoints 1st app", subscribeWayPointsFirstApp) +runner.Step("SubscribeWayPoints 2nd app", subscribeWayPointsSecondApp) +runner.Step("OnWayPointChange to check apps subscription", onWayPointChangeToBothApps) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/SubscribeWayPoints/011_SubscribeWayPoints_fake_another_request_params.lua b/test_scripts/API/Navigation/SubscribeWayPoints/011_SubscribeWayPoints_fake_another_request_params.lua new file mode 100644 index 0000000000..a282310b5f --- /dev/null +++ b/test_scripts/API/Navigation/SubscribeWayPoints/011_SubscribeWayPoints_fake_another_request_params.lua @@ -0,0 +1,72 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/26 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Subscribe_to_Destination_and_Waypoints.md +-- +-- Requirement summary: +-- [SubscribeWayPoints] As a mobile app I want to be able to subscribe on notifications about +-- any changes to the destination or waypoints. +-- +-- Description: +-- In case: +-- 1) mobile application sent valid and allowed by Policies SubscribeWayPoints_request with fake, from another request parameters to SDL +-- +-- SDL must: +-- 1) transfer SubscribeWayPoints_request to HMI without fake, from another request parameters +-- 2) respond with received from HMI to mobile app +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Local Variables ]] +local notification = { + wayPoints = { + { + coordinate = { + latitudeDegrees = 1.1, + longitudeDegrees = 1.1 + } + } + } +} + +--[[ Local Functions ]] +local function subscribeWayPoints(params, self) + local cid = self.mobileSession1:SendRPC("SubscribeWayPoints", params) + EXPECT_HMICALL("Navigation.SubscribeWayPoints") + :Do(function(_,data) + self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", { }) + end) + :ValidIf(function(_,data) + if data.params then + return false, "SDL sends SubscribeWayPoints request to HMI with fake parameters" + else + return true + end + end) + self.mobileSession1:ExpectResponse(cid, { success = true , resultCode = "SUCCESS" }) +end + +local function onWayPointChange(self) + self.hmiConnection:SendNotification("Navigation.OnWayPointChange", notification) + self.mobileSession1:ExpectNotification("OnWayPointChange", notification) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("SubscribeWayPoints_with_fake_parameters", subscribeWayPoints, {{ fake = "string_name" }}) +runner.Step("OnWayPointChange to check apps subscription_1", onWayPointChange) +runner.Step("Postcond_UnsubscribeWayPoints", common.unsubscribeWayPoints) +runner.Step("SubscribeWayPoints_with_parameters_from_another_request", subscribeWayPoints, {{ gps = true }}) +runner.Step("OnWayPointChange to check apps subscription_2", onWayPointChange) + +runner.Title("Postconditions") +runner.Step("UnsubscribeWayPoints", common.unsubscribeWayPoints) +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/SubscribeWayPoints/012_SubscribeWayPoints_APP_NOT_REGISTERED.lua b/test_scripts/API/Navigation/SubscribeWayPoints/012_SubscribeWayPoints_APP_NOT_REGISTERED.lua new file mode 100644 index 0000000000..58bfde87fe --- /dev/null +++ b/test_scripts/API/Navigation/SubscribeWayPoints/012_SubscribeWayPoints_APP_NOT_REGISTERED.lua @@ -0,0 +1,49 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/26 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Subscribe_to_Destination_and_Waypoints.md +-- +-- Requirement summary: +-- [SubscribeWayPoints] As a mobile app I want to be able to subscribe on notifications about +-- any changes to the destination or waypoints. +-- +-- Description: +-- In case: +-- 1) not registered mobile application sent valid and allowed by Policies SubscribeWayPoints_request +-- +-- SDL must: +-- 1) respond with APPLICATION_NOT_REGISTERED, success:false to mobile app +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') +local mobileSession = require('mobile_session') + +--[[ Local Functions ]] +local function subscribeWayPoints(self) + local cid = self.mobileSession1:SendRPC("SubscribeWayPoints", {}) + EXPECT_HMICALL("Navigation.SubscribeWayPoints") + :Times(0) + self.mobileSession1:ExpectResponse(cid, { success = false , resultCode = "APPLICATION_NOT_REGISTERED" }) + common:DelayedExp() +end + +local function CreationNewSession(self) + self.mobileSession1 = mobileSession.MobileSession( + self, + self.mobileConnection, + config.application2.registerAppInterfaceParams + ) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("Start session", CreationNewSession) + +runner.Title("Test") +runner.Step("SubscribeWayPoints_APP_NOT_REGISTERED", subscribeWayPoints) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/SubscribeWayPoints/013_SubscribeWayPoints_diff_HMI_levels.lua b/test_scripts/API/Navigation/SubscribeWayPoints/013_SubscribeWayPoints_diff_HMI_levels.lua new file mode 100644 index 0000000000..f8db17ce94 --- /dev/null +++ b/test_scripts/API/Navigation/SubscribeWayPoints/013_SubscribeWayPoints_diff_HMI_levels.lua @@ -0,0 +1,112 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/26 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Subscribe_to_Destination_and_Waypoints.md +-- +-- Requirement summary: +-- 1. Request is sent in NONE, BACKGROUND, FULL, LIMITED levels +-- 2. SDL responds DISALLOWED, success:false to request in NONE level and SUCCESS, success:true in other ones +-- +-- Description: +-- App requests SubscribeWayPoints in different HMI levels +-- +-- Steps: +-- SDL receives SubscribeWayPoints request in NONE, BACKGROUND, FULL, LIMITED +-- +-- Expected: +-- SDL responds DISALLOWED, success:false in NONE level, SUCCESS, success:true in BACKGROUND, FULL, LIMITED levels +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ General configuration parameters ]] +config.application1.registerAppInterfaceParams.isMediaApplication = true +config.application1.registerAppInterfaceParams.appHMIType = {"NAVIGATION"} +config.application2.registerAppInterfaceParams.isMediaApplication = false +config.application2.registerAppInterfaceParams.appHMIType = {"NAVIGATION"} + +--[[ Local Variables ]] +local notification = { + wayPoints = { + { + coordinate = { + latitudeDegrees = 1.1, + longitudeDegrees = 1.1 + } + } + } +} + +--[[ Local Functions ]] +local function SubscribeWayPointsDisallowed(self) + local cid = self.mobileSession2:SendRPC("SubscribeWayPoints", {}) + EXPECT_HMICALL("Navigation.SubscribeWayPoints") + :Times(0) + self.mobileSession2:ExpectResponse(cid, {success = false, resultCode = "DISALLOWED"}) + common:DelayedExp() +end + +local function SubscribeWayPointsSuccess(self) + local cid = self.mobileSession1:SendRPC("SubscribeWayPoints", {}) + EXPECT_HMICALL("Navigation.SubscribeWayPoints") + :Do(function(_,data) + self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", {}) + end) + self.mobileSession1:ExpectResponse(cid, {success = true , resultCode = "SUCCESS"}) +end + +local function BringAppToLimitedLevel(self) + local appIDval = common.getHMIAppId(1) + self.hmiConnection:SendNotification("BasicCommunication.OnAppDeactivated", + {appID = appIDval}) + self.mobileSession1:ExpectNotification("OnHMIStatus", {hmiLevel = "LIMITED"}) +end + +local function BringAppToBackgroundLevel(self) + common.activateApp(2, self) + self.mobileSession1:ExpectNotification("OnHMIStatus",{hmiLevel = "BACKGROUND"}) +end + +local function ptuUpdateFunc(pTbl) + pTbl.policy_table.functional_groupings["WayPoints"].rpcs["SubscribeWayPoints"] = + {hmi_levels = {"BACKGROUND","FULL","LIMITED"}} + pTbl.policy_table.functional_groupings["WayPoints"].rpcs["OnWayPointChange"] = + {hmi_levels = {"BACKGROUND","FULL","LIMITED", "NONE"}} +end + +local function onWayPointChange(number, self) + self.hmiConnection:SendNotification("Navigation.OnWayPointChange", notification) + if number == 1 then + self.mobileSession1:ExpectNotification("OnWayPointChange", notification) + else + self.mobileSession2:ExpectNotification("OnWayPointChange", notification) + :Times(0) + common:DelayedExp() + end +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU first app", common.registerAppWithPTU, {1, ptuUpdateFunc}) +runner.Step("RAI, PTU second app", common.registerAppWithPTU, {2, ptuUpdateFunc}) +runner.Step("Activate first App", common.activateApp, {1}) + +runner.Title("Test") +runner.Step("SubscribeWayPoints_in_NONE", SubscribeWayPointsDisallowed) +runner.Step("onWayPointChange_ignored", onWayPointChange, {0}) +runner.Step("SubscribeWayPoints_in_FULL", SubscribeWayPointsSuccess) +runner.Step("onWayPointChange_after_success_subscription_in_full", onWayPointChange, {1}) +runner.Step("UnsubscribeWayPoints_after_FULL", common.unsubscribeWayPoints) +runner.Step("Bring_app_to_limited", BringAppToLimitedLevel) +runner.Step("SubscribeWayPoints_in_LIMITED", SubscribeWayPointsSuccess) +runner.Step("onWayPointChange_after_success_subscription_in_limited", onWayPointChange, {1}) +runner.Step("UnsubscribeWayPoints_after_LIMITED", common.unsubscribeWayPoints) +runner.Step("Bring_app_to_background", BringAppToBackgroundLevel) +runner.Step("SubscribeWayPoints_in_BACKGROUND", SubscribeWayPointsSuccess) +runner.Step("onWayPointChange_after_success_subscription_in_background", onWayPointChange, {1}) + +runner.Title("Postconditions") +runner.Step("UnsubscribeWayPoints", common.unsubscribeWayPoints) +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/SubscribeWayPoints/014_SubscribeWayPoints_Transfering_of_HMI_error_resultCode_to_mobile.lua b/test_scripts/API/Navigation/SubscribeWayPoints/014_SubscribeWayPoints_Transfering_of_HMI_error_resultCode_to_mobile.lua new file mode 100644 index 0000000000..77fbe96826 --- /dev/null +++ b/test_scripts/API/Navigation/SubscribeWayPoints/014_SubscribeWayPoints_Transfering_of_HMI_error_resultCode_to_mobile.lua @@ -0,0 +1,142 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/26 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Subscribe_to_Destination_and_Waypoints.md +-- Item: Use Case 1: Main Flow +-- +-- Requirement summary: +-- [SubscribeWayPoints] As a mobile app I want to be able to subscribe on notifications about +-- any changes to the destination or waypoints. +-- +-- Description: +-- In case: +-- 1) mobile application sent valid and allowed by Policies SubscribeWayPoints_request to SDL +-- +-- SDL must: +-- 1) transfer SubscribeWayPoints_request_ to HMI +-- 2) respond with received from HMI to mobile app + +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') +local events = require("events") + +--[[ Local Variables ]] +local isSubscribed = false +local resultCodes = { + success = common.getSuccessResultCodes("SubscribeWayPoints"), + failure = common.getFailureResultCodes("SubscribeWayPoints"), + unexpected = common.getUnexpectedResultCodes("SubscribeWayPoints"), + unmapped = common.getUnmappedResultCodes("SubscribeWayPoints") +} + +--[[ Local Functions ]] +local function unsubscribeWayPoints(self) + local event = events.Event() + event.matches = function(e1, e2) return e1 == e2 end + local ret = EXPECT_EVENT(event, "Precondition event") + if isSubscribed then + local cid = self.mobileSession1:SendRPC("UnsubscribeWayPoints", {}) + EXPECT_HMICALL("Navigation.UnsubscribeWayPoints") + :Do(function(_,data) + self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", {}) + end) + self.mobileSession1:ExpectResponse(cid, { success = true, resultCode = "SUCCESS" }) + :Do(function(_, data) + if data.payload.success then isSubscribed = false end + RAISE_EVENT(event, event, "Precondition event") + end) + else + local function raise_event() + RAISE_EVENT(event, event, "Precondition event") + end + RUN_AFTER(raise_event, 100) + end + return ret +end + +local function subscribeWayPointsSuccess(pResultCodeMap, self) + unsubscribeWayPoints(self) + :Do(function() + local cid = self.mobileSession1:SendRPC("SubscribeWayPoints", {}) + EXPECT_HMICALL("Navigation.SubscribeWayPoints") + :Do(function(_,data) + self.hmiConnection:SendResponse(data.id, data.method, pResultCodeMap.hmi, {}) + end) + self.mobileSession1:ExpectResponse(cid, { success = true, resultCode = pResultCodeMap.mobile }) + :Do(function(_, data) + if data.payload.success then isSubscribed = true end + end) + end) +end + +local function subscribeWayPointsUnsuccess(pResultCodeMap, self) + unsubscribeWayPoints(self) + :Do(function() + local cid = self.mobileSession1:SendRPC("SubscribeWayPoints", {}) + EXPECT_HMICALL("Navigation.SubscribeWayPoints") + :Do(function(_,data) + self.hmiConnection:SendError(data.id, data.method, pResultCodeMap.hmi, "Error error") + end) + + self.mobileSession1:ExpectResponse(cid, { success = false, resultCode = pResultCodeMap.mobile }) + :ValidIf(function(_,data) + if not data.payload.info then + return false, "SDL doesn't resend info parameter to mobile App" + end + return true + end) + :Do(function(_, data) + if data.payload.success then isSubscribed = true end + end) + end) +end + +local function subscribeWayPointsUnexpected(pResultCodeMap, self) + unsubscribeWayPoints(self) + :Do(function() + local cid = self.mobileSession1:SendRPC("SubscribeWayPoints", {}) + + EXPECT_HMICALL("Navigation.SubscribeWayPoints") + :Do(function(_,data) + if pResultCodeMap.success then + self.hmiConnection:SendResponse(data.id, data.method, pResultCodeMap.hmi, {}) + else + self.hmiConnection:SendError(data.id, data.method, pResultCodeMap.hmi, "Error error") + end + end) + + self.mobileSession1:ExpectResponse(cid, { success = pResultCodeMap.success, resultCode = pResultCodeMap.mobile }) + :Do(function(_, data) + if data.payload.success then isSubscribed = true end + end) + end) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("Result Codes", common.printResultCodes, { resultCodes }) + +runner.Title("Successful codes") +for _, item in pairs(resultCodes.success) do + runner.Step("SubscribeWayPoints with " .. item.hmi .. " resultCode", subscribeWayPointsSuccess, { item }) +end + +runner.Title("Erroneous codes") +for _, item in pairs(resultCodes.failure) do + runner.Step("SubscribeWayPoints with " .. item.hmi .. " resultCode", subscribeWayPointsUnsuccess, { item }) +end + +runner.Title("Unexpected codes") +for _, item in pairs(resultCodes.unexpected) do + runner.Step("SubscribeWayPoints with " .. item.hmi .. " resultCode", subscribeWayPointsUnexpected, { item }) +end + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/UnsubscribeWayPoints/001_UnsubscribeWayPoints_success_flow.lua b/test_scripts/API/Navigation/UnsubscribeWayPoints/001_UnsubscribeWayPoints_success_flow.lua new file mode 100755 index 0000000000..6b289e976f --- /dev/null +++ b/test_scripts/API/Navigation/UnsubscribeWayPoints/001_UnsubscribeWayPoints_success_flow.lua @@ -0,0 +1,39 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/27 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Unsubscribe_from_Destination_and_Waypoints.md +-- Item: Use Case 1: Main Flow +-- +-- Requirement summary: +-- [UnsubscribeWayPoints] As a mobile app I want to be able to unsubscribe from getting notifications +-- about any changes to the destination or waypoints. +-- +-- Description: +-- In case: +-- 1) mobile application sent valid UnsubscribeWayPoints_request to SDL +-- 2) and this request is allowed by Policies +-- 3) and there are no other applications subscribed on waypoints change notifications +-- +-- SDL must: +-- 1) transfer UnsubscribeWayPoints_request to HMI +-- 2) respond with <"resultCode"> received from HMI to mobile application + +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) +runner.Step("SubscribeWayPoints", common.subscribeWayPoints) +runner.Step("Is Subscribed", common.isSubscribed) + +runner.Title("Test") +runner.Step("UnsubscribeWayPoints", common.unsubscribeWayPoints) +runner.Step("Is Unsubscribed", common.isUnsubscribed) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/UnsubscribeWayPoints/002_UnsubscribeWayPoints_DISALLOWED_by_policy.lua b/test_scripts/API/Navigation/UnsubscribeWayPoints/002_UnsubscribeWayPoints_DISALLOWED_by_policy.lua new file mode 100755 index 0000000000..73ed02e9b8 --- /dev/null +++ b/test_scripts/API/Navigation/UnsubscribeWayPoints/002_UnsubscribeWayPoints_DISALLOWED_by_policy.lua @@ -0,0 +1,48 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/27 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Unsubscribe_from_Destination_and_Waypoints.md +-- Item: Use Case 1: Exception 2 +-- +-- Requirement summary: +-- [UnsubscribeWayPoints] As a mobile app I want to be able to unsubscribes from getting notifications +-- about any changes to the destination or waypoints. +-- +-- Description: +-- In case: +-- 1) mobile application sent valid UnsubscribeWayPoints_request to SDL and this request is NOT allowed by Policies +-- +-- SDL must: +-- 1) respond "DISALLOWED, success:false" to mobile app + +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Local Functions ]] +local function unsubscribeWayPoints(self) + local cid = self.mobileSession1:SendRPC("UnsubscribeWayPoints", {}) + EXPECT_HMICALL("Navigation.UnsubscribeWayPoints"):Times(0) + self.mobileSession1:ExpectResponse(cid, { success = false, resultCode = "DISALLOWED" }) + common:DelayedExp() +end + +local function ptuUpdateFunc(pTbl) + pTbl.policy_table.functional_groupings["WayPoints"].rpcs.UnsubscribeWayPoints = nil +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU, { common.appId1, ptuUpdateFunc }) +runner.Step("Activate App", common.activateApp) +runner.Step("SubscribeWayPoints", common.subscribeWayPoints) +runner.Step("Is Subscribed", common.isSubscribed) + +runner.Title("Test") +runner.Step("UnsubscribeWayPoints DISALLOWED by policy", unsubscribeWayPoints) +runner.Step("Is still Subscribed", common.isSubscribed) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/UnsubscribeWayPoints/003_UnsubscribeWayPoints_IGNORED_already_unsubscribed_app.lua b/test_scripts/API/Navigation/UnsubscribeWayPoints/003_UnsubscribeWayPoints_IGNORED_already_unsubscribed_app.lua new file mode 100755 index 0000000000..06df5b466f --- /dev/null +++ b/test_scripts/API/Navigation/UnsubscribeWayPoints/003_UnsubscribeWayPoints_IGNORED_already_unsubscribed_app.lua @@ -0,0 +1,48 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/27 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Unsubscribe_from_Destination_and_Waypoints.md +-- Item: Use Case 2: Main Flow +-- +-- Requirement summary: +-- [UnsubscribeWayPoints] As a mobile app I want to be able to unsubscribes from getting notifications +-- about any changes to the destination or waypoints. +-- +-- Description: +-- In case: +-- 1) mobile application is already unsubscribed from WayPoints-related parameters +-- 2) and the same mobile application sends UnsubscribeWayPoints_request to SDL +-- +-- SDL must: +-- 1) respond "IGNORED, success:false" to mobile application +-- 2) keep this application unsubscribed from waypoints change notification + +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Local Functions ]] +local function unsubscribeWayPoints(self) + local cid = self.mobileSession1:SendRPC("UnsubscribeWayPoints", {}) + EXPECT_HMICALL("Navigation.UnsubscribeWayPoints"):Times(0) + self.mobileSession1:ExpectResponse(cid, { success = false, resultCode = "IGNORED" }) + common:DelayedExp() +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) +runner.Step("SubscribeWayPoints", common.subscribeWayPoints) +runner.Step("Is Subscribed", common.isSubscribed) +runner.Step("UnsubscribeWayPoints", common.unsubscribeWayPoints) +runner.Step("Is Unsubscribed", common.isUnsubscribed) + +runner.Title("Test") +runner.Step("UnsubscribeWayPoints for the same app IGNORED", unsubscribeWayPoints) +runner.Step("Is still Unsubscribed", common.isUnsubscribed) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/UnsubscribeWayPoints/004_UnsubscribeWayPoints_UNSUPPORTED_RESOURCE_Navi_interface_is_not_available.lua b/test_scripts/API/Navigation/UnsubscribeWayPoints/004_UnsubscribeWayPoints_UNSUPPORTED_RESOURCE_Navi_interface_is_not_available.lua new file mode 100755 index 0000000000..625dbcd67f --- /dev/null +++ b/test_scripts/API/Navigation/UnsubscribeWayPoints/004_UnsubscribeWayPoints_UNSUPPORTED_RESOURCE_Navi_interface_is_not_available.lua @@ -0,0 +1,55 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/27 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Unsubscribe_from_Destination_and_Waypoints.md +-- Item: Use Case 1:Exception 3 +-- +-- Requirement summary: +-- [UnsubscribeWayPoints] As a mobile app I want to be able to unsubscribes from getting notifications +-- about any changes to the destination or waypoints. +-- +-- Description: +-- In case: +-- 1) mobile application sent valid and allowed by Policies UnsubscribeWayPoints_request to SDL +-- 2) and Navigation interface is not available on HMI +-- +-- SDL must: +-- 1) respond UNSUPPORTED_RESOURCE, success:false to mobile application without transferring this request to HMI + +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') +local hmi_values = require('user_modules/hmi_values') + +--[[ Local Functions ]] +local function disableNavigationInterface() + local params = hmi_values.getDefaultHMITable() + params.Navigation.IsReady.params.available = false + return params +end + +local function unsubscribeWayPoints(self) + local cid = self.mobileSession1:SendRPC("UnsubscribeWayPoints", {}) + EXPECT_HMICALL("Navigation.UnsubscribeWayPoints"):Times(0) + self.mobileSession1:ExpectResponse(cid, { success = false, resultCode = "UNSUPPORTED_RESOURCE" }) + common:DelayedExp() +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) +runner.Step("SubscribeWayPoints", common.subscribeWayPoints) +runner.Step("Is Subscribed", common.isSubscribed) + +runner.Title("Test") +runner.Step("IGNITION_OFF", common.IGNITION_OFF) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start, { disableNavigationInterface() }) +runner.Step("RAI", common.registerAppWithTheSameHashId) +runner.Step("Activate App", common.activateApp) +runner.Step("UnsubscribeWayPoints", unsubscribeWayPoints) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/UnsubscribeWayPoints/005_UnsubscribeWayPoints_INVALID_DATA.lua b/test_scripts/API/Navigation/UnsubscribeWayPoints/005_UnsubscribeWayPoints_INVALID_DATA.lua new file mode 100755 index 0000000000..5028226d1e --- /dev/null +++ b/test_scripts/API/Navigation/UnsubscribeWayPoints/005_UnsubscribeWayPoints_INVALID_DATA.lua @@ -0,0 +1,47 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/27 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Unsubscribe_from_Destination_and_Waypoints.md +-- Item: Use Case 1: Exception 1 +-- +-- Requirement summary: +-- [UnsubscribeWayPoints] As a mobile app I want to be able to unsubscribes from getting notifications +-- about any changes to the destination or waypoints. +-- +-- Description: +-- In case: +-- 1) request is invalid +-- +-- SDL must: +-- 1) respond INVALID_DATA, success:false to mobile application +-- 2) do not transfer UnsubscribeWayPoints_request to HMI +-- 3) keep this application subscribed to waypoints change notification + +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Local Functions ]] +local function invalidJson(self) + local params = { "/ // "} + local cid = self.mobileSession1:SendRPC("UnsubscribeWayPoints", params) + EXPECT_HMICALL("Navigation.UnsubscribeWayPoints"):Times(0) + self.mobileSession1:ExpectResponse(cid, { success = false, resultCode = "INVALID_DATA" }) + common:DelayedExp() +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) +runner.Step("SubscribeWayPoints", common.subscribeWayPoints) +runner.Step("Is Subscribed", common.isSubscribed) + +runner.Title("Test") +runner.Step("UnsubscribeWayPoints", invalidJson) +runner.Step("Is still Subscribed", common.isSubscribed) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/UnsubscribeWayPoints/006_UnsubscribeWayPoints_GENERIC_ERROR_HMI_did_not_respond.lua b/test_scripts/API/Navigation/UnsubscribeWayPoints/006_UnsubscribeWayPoints_GENERIC_ERROR_HMI_did_not_respond.lua new file mode 100755 index 0000000000..b47deb6244 --- /dev/null +++ b/test_scripts/API/Navigation/UnsubscribeWayPoints/006_UnsubscribeWayPoints_GENERIC_ERROR_HMI_did_not_respond.lua @@ -0,0 +1,49 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/27 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Unsubscribe_from_Destination_and_Waypoints.md +-- Item: Use Case 1: Exception 4 +-- +-- Requirement summary: +-- [UnsubscribeWayPoints] As a mobile app I want to be able to unsubscribes from getting notifications +-- about any changes to the destination or waypoints. +-- +-- Description: +-- In case: +-- 1) mobile application sent valid UnsubscribeWayPoints_request to SDL +-- 2) and HMI did not respond during default timeout +-- +-- SDL must: +-- 1) respond GENERIC_ERROR, success:false to mobile application + +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') +local commonTestCases = require('user_modules/shared_testcases/commonTestCases') + +--[[ Local Functions ]] +local function unsubscribeWayPoints(self) + local cid = self.mobileSession1:SendRPC("UnsubscribeWayPoints", {}) + EXPECT_HMICALL("Navigation.UnsubscribeWayPoints") + :Do(function() + -- HMI does not respond + end) + self.mobileSession1:ExpectResponse(cid, { success = false, resultCode = "GENERIC_ERROR" }) + commonTestCases:DelayedExp(11000) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) +runner.Step("SubscribeWayPoints", common.subscribeWayPoints) +runner.Step("Is Subscribed", common.isSubscribed) + +runner.Title("Test") +runner.Step("UnsubscribeWayPoints, HMI did not respond", unsubscribeWayPoints) +runner.Step("Is still Subscribed", common.isSubscribed) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/UnsubscribeWayPoints/007_UnsubscribeWayPoints_GENERIC_ERROR_HMI_respond_with_invalid_data.lua b/test_scripts/API/Navigation/UnsubscribeWayPoints/007_UnsubscribeWayPoints_GENERIC_ERROR_HMI_respond_with_invalid_data.lua new file mode 100755 index 0000000000..bc08c656a8 --- /dev/null +++ b/test_scripts/API/Navigation/UnsubscribeWayPoints/007_UnsubscribeWayPoints_GENERIC_ERROR_HMI_respond_with_invalid_data.lua @@ -0,0 +1,50 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/27 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Unsubscribe_from_Destination_and_Waypoints.md +-- Item: Use Case 1: Exception 4 +-- +-- Requirement summary: +-- [UnsubscribeWayPoints] As a mobile app I want to be able to unsubscribes from getting notifications +-- about any changes to the destination or waypoints. +-- +-- Description: +-- In case: +-- 1) mobile application sent valid UnsubscribeWayPoints_request to SDL +-- 2) and HMI respond with invalid data +-- +-- SDL must: +-- 1) respond GENERIC_ERROR, success:false to mobile application + +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Local Functions ]] +local function unsubscribeWayPoints(self) + local cid = self.mobileSession1:SendRPC("UnsubscribeWayPoints", {}) + EXPECT_HMICALL("Navigation.UnsubscribeWayPoints") + :Do(function(_, data) + local msg = '{"result":{"method":' .. tostring(data.method) -- method name without quotes + .. ',"code":0},"id":' .. tostring(data.id) + .. ',"jsonrpc":"2.0"}' + self.hmiConnection:Send(msg) + end) + self.mobileSession1:ExpectResponse(cid, { success = false, resultCode = "GENERIC_ERROR"}) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) +runner.Step("SubscribeWayPoints", common.subscribeWayPoints) +runner.Step("Is Subscribed", common.isSubscribed) + +runner.Title("Test") +runner.Step("UnsubscribeWayPoints", unsubscribeWayPoints) +runner.Step("Is still Subscribed", common.isSubscribed) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/UnsubscribeWayPoints/008_UnsubscribeWayPoints_IGN_OFF.lua b/test_scripts/API/Navigation/UnsubscribeWayPoints/008_UnsubscribeWayPoints_IGN_OFF.lua new file mode 100755 index 0000000000..eea2db41e5 --- /dev/null +++ b/test_scripts/API/Navigation/UnsubscribeWayPoints/008_UnsubscribeWayPoints_IGN_OFF.lua @@ -0,0 +1,42 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/27 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Unsubscribe_from_Destination_and_Waypoints.md +-- Item: Use Case 2: Alternative flow 2 +-- +-- Requirement summary: +-- [UnsubscribeWayPoints] As a mobile app I want to be able to unsubscribes from getting notifications +-- about any changes to the destination or waypoints. +-- +-- Description: +-- In case: +-- 1) Ignition OFF (ignition cycle is over) +-- 2) New ignitions cycle, mobile application registers with the same hashID as in previous ignition cycle +-- +-- SDL must: +-- 1) restore the subscription status of mobile application (unsubscribed) + +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) +runner.Step("SubscribeWayPoints", common.subscribeWayPoints) +runner.Step("Is Subscribed", common.isSubscribed) +runner.Step("UnsubscribeWayPoints", common.unsubscribeWayPoints) +runner.Step("Is Unsubscribed", common.isUnsubscribed) + +runner.Title("Test") +runner.Step("IGNITION_OFF", common.IGNITION_OFF) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerAppWithTheSameHashId) +runner.Step("Activate App", common.activateApp) +runner.Step("Is still Unsubscribed", common.isUnsubscribed) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/UnsubscribeWayPoints/009_UnsubscribeWayPoints_unexpected_disconnect.lua b/test_scripts/API/Navigation/UnsubscribeWayPoints/009_UnsubscribeWayPoints_unexpected_disconnect.lua new file mode 100755 index 0000000000..5e2bc5f84e --- /dev/null +++ b/test_scripts/API/Navigation/UnsubscribeWayPoints/009_UnsubscribeWayPoints_unexpected_disconnect.lua @@ -0,0 +1,48 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/27 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Unsubscribe_from_Destination_and_Waypoints.md +-- Item: Use Case 2: Alternative flow 1 +-- +-- Requirement summary: +-- [UnsubscribeWayPoints] As a mobile app I want to be able to unsubscribes from getting notifications +-- about any changes to the destination or waypoints. +-- +-- Description: +-- In case: +-- 1) mobile application unexpectedly disconnects +-- +-- SDL must: +-- 1) store the subscription status internally (application remains unsubscribed) +-- 2) restore the subscription status right after application reconnects with the same hashID that was before disconnect + +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Local Functions ]] +local function closeSession(self) + self.mobileSession1:Stop() + EXPECT_HMINOTIFICATION("BasicCommunication.OnAppUnregistered", + { unexpectedDisconnect = true, appID = common.getHMIAppId() }) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) +runner.Step("SubscribeWayPoints", common.subscribeWayPoints) +runner.Step("Is Subscribed", common.isSubscribed) +runner.Step("UnsubscribeWayPoints", common.unsubscribeWayPoints) +runner.Step("Is Unsubscribed", common.isUnsubscribed) + +runner.Title("Test") +runner.Step("Unexpected disconnect", closeSession) +runner.Step("RAI", common.registerAppWithTheSameHashId) +runner.Step("Activate App", common.activateApp) +runner.Step("Is still Unsubscribed", common.isUnsubscribed) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/UnsubscribeWayPoints/010_UnsubscribeWayPoints_2_apps.lua b/test_scripts/API/Navigation/UnsubscribeWayPoints/010_UnsubscribeWayPoints_2_apps.lua new file mode 100755 index 0000000000..c0f1b5c741 --- /dev/null +++ b/test_scripts/API/Navigation/UnsubscribeWayPoints/010_UnsubscribeWayPoints_2_apps.lua @@ -0,0 +1,69 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/27 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Unsubscribe_from_Destination_and_Waypoints.md +-- Item: Use Case 1: Alternative flow 1 +-- +-- Requirement summary: +-- [UnsubscribeWayPoints] As a mobile app I want to be able to unsubscribes from getting notifications +-- about any changes to the destination or waypoints. +-- +-- Description: +-- In case: +-- 1) mobile application sent valid UnsubscribeWayPoints_request to SDL +-- 2) and this request is allowed by Policies +-- 3) and there are other applications still subscribed on waypoints change npotifications +-- +-- SDL must: +-- 1) unsubscribe requesting application from waypoints change notifications +-- 2) not send UnsubscribeWayPoints_request to HMI + +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Local Functions ]] +local function unsubscribeWayPointsSecondApp(self) + local mobSession = common.getMobileSession(2, self) + local cid = mobSession:SendRPC("UnsubscribeWayPoints", {}) + EXPECT_HMICALL("Navigation.UnsubscribeWayPoints"):Times(0) + mobSession:ExpectResponse(cid, { success = true, resultCode = "SUCCESS" }) + mobSession:ExpectNotification("OnHashChange") + common:DelayedExp() +end + +local function unsubscribeWayPointsFirstApp(self) + local mobSession = common.getMobileSession(1, self) + local cid = mobSession:SendRPC("UnsubscribeWayPoints", {}) + EXPECT_HMICALL("Navigation.UnsubscribeWayPoints") + :Do(function(_, data) + self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", {}) + end) + mobSession:ExpectResponse(cid, { success = true, resultCode = "SUCCESS" }) + mobSession:ExpectNotification("OnHashChange") +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) + +for i = 1, 2 do + runner.Step("RAI, PTU " .. i, common.registerAppWithPTU, { i }) + runner.Step("Activate App " .. i, common.activateApp, { i }) +end + +for i = 1, 2 do + runner.Step("SubscribeWayPoints, App " .. i, common.subscribeWayPoints, { i }) + runner.Step("Is Subscribed, App " .. i, common.isSubscribed, { i }) +end + +runner.Title("Test") +runner.Step("UnsubscribeWayPoints App2", unsubscribeWayPointsSecondApp) +runner.Step("Is Unsubscribed App2", common.isUnsubscribed, { common.appId2 }) +runner.Step("Is still Subscribed App1", common.isSubscribed, { common.appId1 }) +runner.Step("UnsubscribeWayPoints App1", unsubscribeWayPointsFirstApp) +runner.Step("Is Unsubscribed App1", common.isUnsubscribed, { common.appId1 }) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/UnsubscribeWayPoints/011_UnsubscribeWayPoints_diff_HMI_levels.lua b/test_scripts/API/Navigation/UnsubscribeWayPoints/011_UnsubscribeWayPoints_diff_HMI_levels.lua new file mode 100644 index 0000000000..8f58f31e58 --- /dev/null +++ b/test_scripts/API/Navigation/UnsubscribeWayPoints/011_UnsubscribeWayPoints_diff_HMI_levels.lua @@ -0,0 +1,113 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/27 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Unsubscribe_from_Destination_and_Waypoints.md +-- +-- Requirement summary: +-- 1. Request is sent in NONE, BACKGROUND, FULL, LIMITED levels +-- 2. SDL responds DISALLOWED, success:false to request in NONE level and SUCCESS, success:true in other ones +-- +-- Description: +-- App requests UnsubscribeWayPoints in different HMI levels +-- +-- Steps: +-- SDL receives UnsubscribeWayPoints request in NONE, BACKGROUND, FULL, LIMITED +-- +-- Expected: +-- SDL responds DISALLOWED, success:false in NONE level, SUCCESS, success:true in BACKGROUND, FULL, LIMITED levels +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ General configuration parameters ]] +config.application1.registerAppInterfaceParams.isMediaApplication = true +config.application1.registerAppInterfaceParams.appHMIType = {"NAVIGATION"} +config.application2.registerAppInterfaceParams.isMediaApplication = false +config.application2.registerAppInterfaceParams.appHMIType = {"NAVIGATION"} + +--[[ Local Variables ]] +local notification = { + wayPoints = { + { + coordinate = { + latitudeDegrees = 1.1, + longitudeDegrees = 1.1 + } + } + } +} + +--[[ Local Functions ]] +local function UnsubscribeWayPointsDisallowed(self) + local cid = self.mobileSession2:SendRPC("UnsubscribeWayPoints", {}) + EXPECT_HMICALL("Navigation.UnsubscribeWayPoints") + :Times(0) + self.mobileSession2:ExpectResponse(cid, {success = false, resultCode = "DISALLOWED"}) + common:DelayedExp() +end + +local function UnsubscribeWayPointsSuccess(self) + local cid = self.mobileSession1:SendRPC("UnsubscribeWayPoints", {}) + EXPECT_HMICALL("Navigation.UnsubscribeWayPoints") + :Do(function(_,data) + self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", {}) + end) + self.mobileSession1:ExpectResponse(cid, {success = true , resultCode = "SUCCESS"}) +end + +local function BringAppToLimitedLevel(self) + local appIDval = common.getHMIAppId(1) + self.hmiConnection:SendNotification("BasicCommunication.OnAppDeactivated", + {appID = appIDval}) + self.mobileSession1:ExpectNotification("OnHMIStatus", {hmiLevel = "LIMITED"}) +end + +local function BringAppToBackgroundLevel(self) + common.activateApp(2, self) + self.mobileSession1:ExpectNotification("OnHMIStatus",{hmiLevel = "BACKGROUND"}) +end + +local function ptuUpdateFunc(pTbl) + pTbl.policy_table.functional_groupings["WayPoints"].rpcs["UnsubscribeWayPoints"] = + {hmi_levels = {"BACKGROUND","FULL","LIMITED"}} + pTbl.policy_table.functional_groupings["WayPoints"].rpcs["OnWayPointChange"] = + {hmi_levels = {"BACKGROUND","FULL","LIMITED", "NONE"}} + pTbl.policy_table.functional_groupings["WayPoints"].rpcs["SubscribeWayPoints"] = + {hmi_levels = {"BACKGROUND","FULL","LIMITED", "NONE"}} +end + +local function onWayPointChange(number, self) + self.hmiConnection:SendNotification("Navigation.OnWayPointChange", notification) + if number == 1 then + self.mobileSession1:ExpectNotification("OnWayPointChange", notification) + else + self.mobileSession2:ExpectNotification("OnWayPointChange", notification) + :Times(0) + common:DelayedExp() + end +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU first app", common.registerAppWithPTU, {1, ptuUpdateFunc}) +runner.Step("RAI, PTU second app", common.registerAppWithPTU, {2, ptuUpdateFunc}) +runner.Step("Activate first App", common.activateApp, {1}) + +runner.Title("Test") +runner.Step("UnsubscribeWayPoints_in_NONE", UnsubscribeWayPointsDisallowed) +runner.Step("Prec_SubscribeWayPoints_in_FULL", common.subscribeWayPoints) +runner.Step("UnsubscribeWayPoints_in_FULL", UnsubscribeWayPointsSuccess) +runner.Step("onWayPointChange_after_success_subscription_in_full", onWayPointChange, {0}) +runner.Step("Bring_app_to_limited", BringAppToLimitedLevel) +runner.Step("Prec_SubscribeWayPoints_in_LIMITED", common.subscribeWayPoints) +runner.Step("UnsubscribeWayPoints_in_LIMITED", UnsubscribeWayPointsSuccess) +runner.Step("onWayPointChange_after_success_subscription_in_limited", onWayPointChange, {0}) +runner.Step("Bring_app_to_background", BringAppToBackgroundLevel) +runner.Step("Prec_SubscribeWayPoints_in_BACKGROUND", common.subscribeWayPoints) +runner.Step("UnsubscribeWayPoints_in_BACKGROUND", UnsubscribeWayPointsSuccess) +runner.Step("onWayPointChange_after_success_subscription_in_background", onWayPointChange, {0}) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/UnsubscribeWayPoints/012_UnsubscribeWayPoints_app_not_registered.lua b/test_scripts/API/Navigation/UnsubscribeWayPoints/012_UnsubscribeWayPoints_app_not_registered.lua new file mode 100644 index 0000000000..b34f4e9ea1 --- /dev/null +++ b/test_scripts/API/Navigation/UnsubscribeWayPoints/012_UnsubscribeWayPoints_app_not_registered.lua @@ -0,0 +1,49 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/27 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Unsubscribe_from_Destination_and_Waypoints.md +-- +-- Requirement summary: +-- [UnsubscribeWayPoints] As a mobile app I want to be able to unsubscribes from getting notifications +-- about any changes to the destination or waypoints. +-- +-- Description: +-- In case: +-- 1) not registered mobile application sent valid and allowed by Policies UnsubscribeWayPoints_request +-- +-- SDL must: +-- 1) respond with APPLICATION_NOT_REGISTERED, success:false to mobile app +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') +local mobileSession = require('mobile_session') + +--[[ Local Functions ]] +local function UnsubscribeWayPoints(self) + local cid = self.mobileSession1:SendRPC("UnsubscribeWayPoints", {}) + EXPECT_HMICALL("Navigation.UnsubscribeWayPoints") + :Times(0) + self.mobileSession1:ExpectResponse(cid, { success = false , resultCode = "APPLICATION_NOT_REGISTERED" }) + common:DelayedExp() +end + +local function CreationNewSession(self) + self.mobileSession1 = mobileSession.MobileSession( + self, + self.mobileConnection, + config.application2.registerAppInterfaceParams + ) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("Start session", CreationNewSession) + +runner.Title("Test") +runner.Step("UnsubscribeWayPoints_APP_NOT_REGISTERED", UnsubscribeWayPoints) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/UnsubscribeWayPoints/013_UnsubscribeWayPoints_fake_another_request_parameters.lua b/test_scripts/API/Navigation/UnsubscribeWayPoints/013_UnsubscribeWayPoints_fake_another_request_parameters.lua new file mode 100644 index 0000000000..fb36d5d3cb --- /dev/null +++ b/test_scripts/API/Navigation/UnsubscribeWayPoints/013_UnsubscribeWayPoints_fake_another_request_parameters.lua @@ -0,0 +1,75 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/27 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Unsubscribe_from_Destination_and_Waypoints.md +-- +-- Requirement summary: +-- [UnsubscribeWayPoints] As a mobile app I want to be able to unsubscribes from getting notifications +-- about any changes to the destination or waypoints. +-- +-- Description: +-- In case: +-- 1) mobile application sent valid and allowed by Policies UnsubscribeWayPoints_request with fake, +-- from another request parameters to SDL +-- +-- SDL must: +-- 1) transfer UnsubscribeWayPoints_request to HMI without fake, from another request parameters +-- 2) respond with received from HMI to mobile app +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') + +--[[ Local Variables ]] +local notification = { + wayPoints = { + { + coordinate = { + latitudeDegrees = 1.1, + longitudeDegrees = 1.1 + } + } + } +} + +--[[ Local Functions ]] +local function UnsubscribeWayPoints(params, self) + local cid = self.mobileSession1:SendRPC("UnsubscribeWayPoints", params) + EXPECT_HMICALL("Navigation.UnsubscribeWayPoints") + :Do(function(_,data) + self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", { }) + end) + :ValidIf(function(_,data) + if data.params then + return false, "SDL sends UnsubscribeWayPoints request to HMI with fake parameters" + else + return true + end + end) + self.mobileSession1:ExpectResponse(cid, { success = true , resultCode = "SUCCESS" }) +end + +local function onWayPointChange(self) + self.hmiConnection:SendNotification("Navigation.OnWayPointChange", notification) + self.mobileSession1:ExpectNotification("OnWayPointChange", notification) + :Times(0) + common:DelayedExp() +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) +runner.Step("SubscribeWayPoints", common.subscribeWayPoints) + +runner.Title("Test") +runner.Step("UnsubscribeWayPoints_with_fake_parameters", UnsubscribeWayPoints, {{ fake = "string_name" }}) +runner.Step("OnWayPointChange to check app is not subscribed", onWayPointChange) +runner.Step("Precond_SubscribeWayPoints", common.subscribeWayPoints) +runner.Step("UnsubscribeWayPoints_with_parameters_from_another_request", UnsubscribeWayPoints, {{ gps = true }}) +runner.Step("OnWayPointChange to check app is not subscribed", onWayPointChange) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/UnsubscribeWayPoints/014_UnsubscribeWayPoints_Transfering_of_HMI_error_resultCode_to_mobile.lua b/test_scripts/API/Navigation/UnsubscribeWayPoints/014_UnsubscribeWayPoints_Transfering_of_HMI_error_resultCode_to_mobile.lua new file mode 100644 index 0000000000..4537cff3ce --- /dev/null +++ b/test_scripts/API/Navigation/UnsubscribeWayPoints/014_UnsubscribeWayPoints_Transfering_of_HMI_error_resultCode_to_mobile.lua @@ -0,0 +1,141 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_requirements/issues/27 +-- Use case: https://github.com/smartdevicelink/sdl_requirements/blob/master/detailed_docs/embedded_navi/Unsubscribe_from_Destination_and_Waypoints.md +-- Item: Use Case 1: Main Flow +-- +-- Requirement summary: +-- [UnsubscribeWayPoints] As a mobile app I want to be able to unsubscribes from getting notifications +-- about any changes to the destination or waypoints. +-- +-- Description: +-- In case: +-- 1) mobile application sent valid and allowed by Policies UnsubscribeWayPoints_request to SDL +-- +-- SDL must: +-- 1) transfer UnsubscribeWayPoints_request_ to HMI +-- 2) respond with received from HMI to mobile app + +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/API/Navigation/commonNavigation') +local events = require("events") + +--[[ Local Variables ]] +local isSubscribed = false +local resultCodes = { + success = common.getSuccessResultCodes("UnsubscribeWayPoints"), + failure = common.getFailureResultCodes("UnsubscribeWayPoints"), + unexpected = common.getUnexpectedResultCodes("UnsubscribeWayPoints"), + unmapped = common.getUnmappedResultCodes("UnsubscribeWayPoints") +} + +--[[ Local Functions ]] +local function subscribeWayPoints(self) + local event = events.Event() + event.matches = function(e1, e2) return e1 == e2 end + local ret = EXPECT_EVENT(event, "Precondition event") + if not isSubscribed then + local cid = self.mobileSession1:SendRPC("SubscribeWayPoints", {}) + EXPECT_HMICALL("Navigation.SubscribeWayPoints") + :Do(function(_,data) + self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", {}) + end) + self.mobileSession1:ExpectResponse(cid, { success = true, resultCode = "SUCCESS" }) + :Do(function(_, data) + if data.payload.success then isSubscribed = true end + RAISE_EVENT(event, event, "Precondition event") + end) + else + local function raise_event() + RAISE_EVENT(event, event, "Precondition event") + end + RUN_AFTER(raise_event, 100) + end + return ret +end + +local function unsubscribeWayPointsSuccess(pResultCodeMap, self) + subscribeWayPoints(self) + :Do(function() + local cid = self.mobileSession1:SendRPC("UnsubscribeWayPoints", {}) + EXPECT_HMICALL("Navigation.UnsubscribeWayPoints") + :Do(function(_,data) + self.hmiConnection:SendResponse(data.id, data.method, pResultCodeMap.hmi, {}) + end) + self.mobileSession1:ExpectResponse(cid, { success = true, resultCode = pResultCodeMap.mobile }) + :Do(function(_, data) + if data.payload.success then isSubscribed = false end + end) + end) +end + +local function unsubscribeWayPointsUnsuccess(pResultCodeMap, self) + subscribeWayPoints(self) + :Do(function() + local cid = self.mobileSession1:SendRPC("UnsubscribeWayPoints", {}) + EXPECT_HMICALL("Navigation.UnsubscribeWayPoints") + :Do(function(_, data) + self.hmiConnection:SendError(data.id, data.method, pResultCodeMap.hmi, "Error error") + end) + self.mobileSession1:ExpectResponse(cid, { success = false, resultCode = pResultCodeMap.mobile }) + :ValidIf(function(_,data) + if not data.payload.info then + return false, "SDL doesn't resend info parameter to mobile App" + end + return true + end) + :Do(function(_, data) + if data.payload.success then isSubscribed = false end + end) + end) +end + +local function unsubscribeWayPointsUnexpected(pResultCodeMap, self) + subscribeWayPoints(self) + :Do(function() + local cid = self.mobileSession1:SendRPC("UnsubscribeWayPoints", {}) + + EXPECT_HMICALL("Navigation.UnsubscribeWayPoints") + :Do(function(_,data) + if pResultCodeMap.success then + self.hmiConnection:SendResponse(data.id, data.method, pResultCodeMap.hmi, {}) + else + self.hmiConnection:SendError(data.id, data.method, pResultCodeMap.hmi, "Error error") + end + end) + + self.mobileSession1:ExpectResponse(cid, { success = pResultCodeMap.success, resultCode = pResultCodeMap.mobile }) + :Do(function(_, data) + if data.payload.success then isSubscribed = false end + end) + end) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.registerAppWithPTU) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("Result Codes", common.printResultCodes, { resultCodes }) + +runner.Title("Successful codes") +for _, item in pairs(resultCodes.success) do + runner.Step("UnsubscribeWayPoints with " .. item.hmi .. " resultCode", unsubscribeWayPointsSuccess, { item }) +end + +runner.Title("Erroneous codes") +for _, item in pairs(resultCodes.failure) do + runner.Step("UnsubscribeWayPoints with " .. item.hmi .. " resultCode", unsubscribeWayPointsUnsuccess, { item }) +end + +runner.Title("Unexpected codes") +for _, item in pairs(resultCodes.unexpected) do + runner.Step("UnsubscribeWayPoints with " .. item.hmi .. " resultCode", unsubscribeWayPointsUnexpected, { item }) +end + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/Navigation/commonNavigation.lua b/test_scripts/API/Navigation/commonNavigation.lua new file mode 100755 index 0000000000..1884b50816 --- /dev/null +++ b/test_scripts/API/Navigation/commonNavigation.lua @@ -0,0 +1,703 @@ +--------------------------------------------------------------------------------------------------- +-- Navigation common module +--------------------------------------------------------------------------------------------------- +--[[ General configuration parameters ]] +config.mobileHost = "127.0.0.1" +config.defaultProtocolVersion = 2 + +--[[ Required Shared libraries ]] +local mobile_session = require("mobile_session") +local json = require("modules/json") + +local commonFunctions = require("user_modules/shared_testcases/commonFunctions") +local commonSteps = require("user_modules/shared_testcases/commonSteps") +local commonTestCases = require("user_modules/shared_testcases/commonTestCases") +local SDL = require('SDL') +local events = require("events") + +local api_loader = require("modules/api_loader") +local mobile_api = api_loader.init("data/MOBILE_API.xml") +local mobile_api_schema = mobile_api.interface[next(mobile_api.interface)] +local hmi_api = api_loader.init("data/HMI_API.xml") +local hmi_api_schema = hmi_api.interface["Common"] + +local commonNavigation = {} + +--[[ Constants ]] +commonNavigation.timeout = 2000 +commonNavigation.minTimeout = 500 +commonNavigation.appId1 = 1 +commonNavigation.appId2 = 2 + + +--[[ Variables ]] +local ptu_table = {} +local hmiAppIds = {} + +local successCodes = { + "SUCCESS", + "WARNINGS", + "WRONG_LANGUAGE", + "RETRY", + "SAVED" +} + +local excludedCodes = { + "UNSUPPORTED_RESOURCE" -- excluded due to unresolved clarification +} + +local notification = { + wayPoints = { + { + coordinate = { + latitudeDegrees = 1.1, + longitudeDegrees = 1.1 + } + } + } +} + +--[[ Functions ]] + +--[[ @checkIfPTSIsSentAsBinary: check if binary data is not empty +--! @parameters: +--! pBinData - binary data +--]] +local function checkIfPTSIsSentAsBinary(pBinData) + if not (pBinData ~= nil and string.len(pBinData) > 0) then + commonFunctions:userPrint(31, "PTS was not sent to Mobile in payload of OnSystemRequest") + end +end + +--[[ @getGetWayPointsConfig: create configuration for application +-- with additional functional group for Navigation RPCs +--! @parameters: none +--! @return: table with configuration +--]] +function commonNavigation.getGetWayPointsConfig() + return { + keep_context = false, + steal_focus = false, + priority = "NONE", + default_hmi = "NONE", + groups = { "Base-4", "WayPoints" } + } +end + +--[[ @getPTUFromPTS: create policy table update table (PTU) +--! @parameters: +--! pTbl - table with policy table snapshot (PTS) +--! @return: table with PTU +--]] +local function getPTUFromPTS(pTbl) + pTbl.policy_table.consumer_friendly_messages.messages = nil + pTbl.policy_table.device_data = nil + pTbl.policy_table.module_meta = nil + pTbl.policy_table.usage_and_error_counts = nil + pTbl.policy_table.functional_groupings["DataConsent-2"].rpcs = json.null + pTbl.policy_table.module_config.preloaded_pt = nil + pTbl.policy_table.module_config.preloaded_date = nil +end + +--[[ @jsonFileToTable: convert .json file to table +--! @parameters: +--! pFileName - file name +--! @return: table +--]] +local function jsonFileToTable(pFileName) + local f = io.open(pFileName, "r") + local content = f:read("*all") + f:close() + return json.decode(content) +end + +--[[ @tableToJsonFile: convert table to .json file +--! @parameters: +--! pTbl - table +--! pFileName - file name +--]] +local function tableToJsonFile(pTbl, pFileName) + local f = io.open(pFileName, "w") + f:write(json.encode(pTbl)) + f:close() +end + +--[[ @updatePTU: update PTU table with additional functional group for Navigation RPCs +--! @parameters: +--! pTbl - PTU table +--! pAppId - application number (1, 2, etc.) +--]] +local function updatePTU(pTbl, pAppId) + pTbl.policy_table.functional_groupings["WayPoints"] = { + rpcs = { + GetWayPoints = { + hmi_levels = { "BACKGROUND", "FULL", "LIMITED", "NONE" } + }, + SubscribeWayPoints = { + hmi_levels = { "BACKGROUND", "FULL", "LIMITED", "NONE" } + }, + UnsubscribeWayPoints = { + hmi_levels = { "BACKGROUND", "FULL", "LIMITED", "NONE" } + }, + OnWayPointChange = { + hmi_levels = { "BACKGROUND", "FULL", "LIMITED", "NONE" } + } + } + } + local appID = commonNavigation.getMobileAppId(pAppId) + pTbl.policy_table.app_policies[appID] = commonNavigation.getGetWayPointsConfig() +end + +--[[ @ptu: perform policy table update +--! @parameters: +--! pAppId - application number (1, 2, etc.) +--! pPTUpdateFunc - additional function for update +--! self - test object +--]] +local function ptu(pAppId, pPTUpdateFunc, self) + local policy_file_name = "PolicyTableUpdate" + local policy_file_path = commonFunctions:read_parameter_from_smart_device_link_ini("SystemFilesPath") + local pts_file_name = commonFunctions:read_parameter_from_smart_device_link_ini("PathToSnapshot") + local ptu_file_name = os.tmpname() + local requestId = self.hmiConnection:SendRequest("SDL.GetURLS", { service = 7 }) + EXPECT_HMIRESPONSE(requestId) + :Do(function() + self.hmiConnection:SendNotification("BasicCommunication.OnSystemRequest", + { requestType = "PROPRIETARY", fileName = pts_file_name }) + getPTUFromPTS(ptu_table) + + updatePTU(ptu_table, pAppId) + + if pPTUpdateFunc then + pPTUpdateFunc(ptu_table) + end + + tableToJsonFile(ptu_table, ptu_file_name) + + local event = events.Event() + event.matches = function(self, e) return self == e end + EXPECT_EVENT(event, "PTU event") + :Timeout(11000) + + local function getAppsCount() + local count = 0 + for _ in pairs(hmiAppIds) do + count = count + 1 + end + return count + end + for id = 1, getAppsCount() do + local mobileSession = commonNavigation.getMobileSession(id, self) + mobileSession:ExpectNotification("OnSystemRequest", { requestType = "PROPRIETARY" }) + :Do(function(_, d2) + print("App ".. id .. " was used for PTU") + RAISE_EVENT(event, event, "PTU event") + checkIfPTSIsSentAsBinary(d2.binaryData) + local corIdSystemRequest = mobileSession:SendRPC("SystemRequest", + { requestType = "PROPRIETARY", fileName = policy_file_name }, ptu_file_name) + EXPECT_HMICALL("BasicCommunication.SystemRequest") + :Do(function(_, d3) + self.hmiConnection:SendResponse(d3.id, "BasicCommunication.SystemRequest", "SUCCESS", { }) + self.hmiConnection:SendNotification("SDL.OnReceivedPolicyUpdate", + { policyfile = policy_file_path .. "/" .. policy_file_name }) + end) + mobileSession:ExpectResponse(corIdSystemRequest, { success = true, resultCode = "SUCCESS" }) + end) + :Times(AtMost(1)) + end + end) + os.remove(ptu_file_name) +end + +--[[ @preconditions: precondition steps +--! @parameters: none +--]] +function commonNavigation.preconditions() + commonFunctions:SDLForceStop() + commonSteps:DeletePolicyTable() + commonSteps:DeleteLogsFiles() +end + +--[[ @activateApp: activate application +--! @parameters: +--! pAppId - application number (1, 2, etc.) +--! self - test object +--]] +function commonNavigation.activateApp(pAppId, self) + self, pAppId = commonNavigation.getSelfAndParams(pAppId, self) + if not pAppId then pAppId = 1 end + local pHMIAppId = hmiAppIds[config["application" .. pAppId].registerAppInterfaceParams.appID] + local mobSession = commonNavigation.getMobileSession(pAppId, self) + local requestId = self.hmiConnection:SendRequest("SDL.ActivateApp", { appID = pHMIAppId }) + EXPECT_HMIRESPONSE(requestId) + mobSession:ExpectNotification("OnHMIStatus", + { hmiLevel = "FULL", audioStreamingState = "AUDIBLE", systemContext = "MAIN" }) + commonTestCases:DelayedExp(commonNavigation.minTimeout) +end + +--[[ @getSelfAndParams: shifting parameters in order to move self at 1st position +--! @parameters: +--! ... - various parameters and self +--! @return: self and other parameters +--]] +function commonNavigation.getSelfAndParams(...) + local out = { } + local selfIdx = nil + for i,v in pairs({...}) do + if type(v) == "table" and v.isTest then + table.insert(out, v) + selfIdx = i + break + end + end + local idx = 2 + for i = 1, table.maxn({...}) do + if i ~= selfIdx then + out[idx] = ({...})[i] + idx = idx + 1 + end + end + return table.unpack(out, 1, table.maxn(out)) +end + +--[[ @getHMIAppId: get HMI application identifier +--! @parameters: +--! pAppId - application number (1, 2, etc.) +--! @return: application identifier +--]] +function commonNavigation.getHMIAppId(pAppId) + if not pAppId then pAppId = 1 end + return hmiAppIds[config["application" .. pAppId].registerAppInterfaceParams.appID] +end + +--[[ @getMobileSession: get mobile session +--! @parameters: +--! pAppId - application number (1, 2, etc.) +--! self - test object +--! @return: mobile session +--]] +function commonNavigation.getMobileSession(pAppId, self) + if not pAppId then pAppId = 1 end + return self["mobileSession" .. pAppId] +end + +--[[ @getMobileAppId: get mobile session +--! @parameters: +--! pAppId - application number (1, 2, etc.) +--! @return: mobile session +--]] +function commonNavigation.getMobileAppId(pAppId) + if not pAppId then pAppId = 1 end + return config["application" .. pAppId].registerAppInterfaceParams.appID +end + +--[[ @postconditions: postcondition steps +--! @parameters: none +--]] +function commonNavigation.postconditions() + StopSDL() +end + +--[[ @registerAppWithPTU: register mobile application and perform PTU +--! @parameters: +--! pAppId - application number (1, 2, etc.) +--! pPTUpdateFunc - additional function for update +--! self - test object +--]] +function commonNavigation.registerAppWithPTU(pAppId, pPTUpdateFunc, self) + self, pAppId, pPTUpdateFunc = commonNavigation.getSelfAndParams(pAppId, pPTUpdateFunc, self) + if not pAppId then pAppId = 1 end + self["mobileSession" .. pAppId] = mobile_session.MobileSession(self, self.mobileConnection) + self["mobileSession" .. pAppId]:StartService(7) + :Do(function() + local corId = self["mobileSession" .. pAppId]:SendRPC("RegisterAppInterface", + config["application" .. pAppId].registerAppInterfaceParams) + EXPECT_HMINOTIFICATION("BasicCommunication.OnAppRegistered", + { application = { appName = config["application" .. pAppId].registerAppInterfaceParams.appName } }) + :Do(function(_, d1) + hmiAppIds[config["application" .. pAppId].registerAppInterfaceParams.appID] = d1.params.application.appID + EXPECT_HMINOTIFICATION("SDL.OnStatusUpdate", + { status = "UPDATE_NEEDED" }, { status = "UPDATING" }, { status = "UP_TO_DATE" }) + :Times(3) + EXPECT_HMICALL("BasicCommunication.PolicyUpdate") + :Do(function(_, d2) + self.hmiConnection:SendResponse(d2.id, d2.method, "SUCCESS", { }) + ptu_table = jsonFileToTable(d2.params.file) + ptu(pAppId, pPTUpdateFunc, self) + end) + end) + self["mobileSession" .. pAppId]:ExpectResponse(corId, { success = true, resultCode = "SUCCESS" }) + :Do(function() + self["mobileSession" .. pAppId]:ExpectNotification("OnHMIStatus", + { hmiLevel = "NONE", audioStreamingState = "NOT_AUDIBLE", systemContext = "MAIN" }) + :Times(1) + self["mobileSession" .. pAppId]:ExpectNotification("OnPermissionsChange") + :Times(AtLeast(1)) -- TODO: Change to exact 1 occurence when SDL issue is fixed + end) + end) +end + +--[[ @registerAppWithTheSameHashId: register mobile application with the same hash id +--! @parameters: +--! pAppId - application number (1, 2, etc.) +--! self - test object +--]] +function commonNavigation.registerAppWithTheSameHashId(pAppId, self) + self, pAppId = commonNavigation.getSelfAndParams(pAppId, self) + if not pAppId then pAppId = 1 end + self["mobileSession" .. pAppId] = mobile_session.MobileSession(self, self.mobileConnection) + self["mobileSession" .. pAppId]:StartService(7) + :Do(function() + config["application" .. pAppId].registerAppInterfaceParams.hashID = self.currentHashID + local corId = self["mobileSession" .. pAppId]:SendRPC("RegisterAppInterface", + config["application" .. pAppId].registerAppInterfaceParams) + EXPECT_HMINOTIFICATION("BasicCommunication.OnAppRegistered", + { application = { appName = config["application" .. pAppId].registerAppInterfaceParams.appName } }) + :Do(function(_, d1) + hmiAppIds[config["application" .. pAppId].registerAppInterfaceParams.appID] = d1.params.application.appID + end) + self["mobileSession" .. pAppId]:ExpectResponse(corId, { success = true, resultCode = "SUCCESS" }) + :Do(function() + self["mobileSession" .. pAppId]:ExpectNotification("OnHMIStatus", + { hmiLevel = "NONE", audioStreamingState = "NOT_AUDIBLE", systemContext = "MAIN" }) + :Times(1) + self["mobileSession" .. pAppId]:ExpectNotification("OnPermissionsChange") + end) + end) +end + +--[[ @allowSDL: sequence that allows SDL functionality +--! @parameters: +--! self - test object +--]] +local function allowSDL(self) + self.hmiConnection:SendNotification("SDL.OnAllowSDLFunctionality", { + allowed = true, + source = "GUI", + device = { + id = commonNavigation.getDeviceMAC(), + name = commonNavigation.getDeviceName() + } + }) +end + +--[[ @start: starting sequence: starting of SDL, initialization of HMI, connect mobile +--! @parameters: +--! pHMIParams - table with parameters for HMI initialization +--! self - test object +--]] +function commonNavigation.start(pHMIParams, self) + self, pHMIParams = commonNavigation.getSelfAndParams(pHMIParams, self) + self:runSDL() + commonFunctions:waitForSDLStart(self) + :Do(function() + self:initHMI(self) + :Do(function() + commonFunctions:userPrint(35, "HMI initialized") + self:initHMI_onReady(pHMIParams) + :Do(function() + commonFunctions:userPrint(35, "HMI is ready") + self:connectMobile() + :Do(function() + commonFunctions:userPrint(35, "Mobile connected") + allowSDL(self) + end) + end) + end) + end) +end + +--[[ @subscribeWayPoints: SubscribeWayPoints successful sequence +--! @parameters: +--! pAppId - application number (1, 2, etc.) +--! self - test object +--]] +function commonNavigation.subscribeWayPoints(pAppId, self) + self, pAppId = commonNavigation.getSelfAndParams(pAppId, self) + if not pAppId then pAppId = 1 end + local mobSession = commonNavigation.getMobileSession(pAppId, self) + local cid = mobSession:SendRPC("SubscribeWayPoints", {}) + if pAppId == 1 then + EXPECT_HMICALL("Navigation.SubscribeWayPoints") + :Do(function(_, data) + self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", {}) + end) + end + mobSession:ExpectResponse(cid, { success = true , resultCode = "SUCCESS" }) + mobSession:ExpectNotification("OnHashChange") + :Do(function(_, data) + self.currentHashID = data.payload.hashID + end) +end + +--[[ @unsubscribeWayPoints: UnsubscribeWayPoints successful sequence +--! @parameters: +--! pAppId - application number (1, 2, etc.) +--! self - test object +--]] +function commonNavigation.unsubscribeWayPoints(pAppId, self) + self, pAppId = commonNavigation.getSelfAndParams(pAppId, self) + if not pAppId then pAppId = 1 end + local mobSession = commonNavigation.getMobileSession(pAppId, self) + local cid = mobSession:SendRPC("UnsubscribeWayPoints", {}) + if pAppId == 1 then + EXPECT_HMICALL("Navigation.UnsubscribeWayPoints") + :Do(function(_, data) + self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", {}) + end) + end + mobSession:ExpectResponse(cid, { success = true , resultCode = "SUCCESS" }) + mobSession:ExpectNotification("OnHashChange") + :Do(function(_, data) + self.currentHashID = data.payload.hashID + end) +end + +--[[ @IGNITION_OFF: IGNITION_OFF sequence +--! @parameters: +--! self - test object +--]] +function commonNavigation.IGNITION_OFF(self) + self.hmiConnection:SendNotification("BasicCommunication.OnExitAllApplications", + { reason = "SUSPEND" }) + EXPECT_HMINOTIFICATION("BasicCommunication.OnSDLPersistenceComplete") + :Do(function() + self.hmiConnection:SendNotification("BasicCommunication.OnExitAllApplications", + { reason = "IGNITION_OFF" }) + self.mobileSession1:ExpectNotification("OnAppInterfaceUnregistered", + { reason = "IGNITION_OFF" }) + SDL:DeleteFile() + EXPECT_HMINOTIFICATION("BasicCommunication.OnAppUnregistered", { unexpectedDisconnect = false }) + EXPECT_HMINOTIFICATION("BasicCommunication.OnSDLClose") + end) +end + +--[[ @isSubscribed: OnWayPointChange successful sequence (subscribed) +--! @parameters: +--! pAppId - application number (1, 2, etc.) +--! self - test object +--]] +function commonNavigation.isSubscribed(pAppId, self) + self, pAppId = commonNavigation.getSelfAndParams(pAppId, self) + local mobSession = commonNavigation.getMobileSession(pAppId, self) + self.hmiConnection:SendNotification("Navigation.OnWayPointChange", notification) + mobSession:ExpectNotification("OnWayPointChange", notification) +end + +--[[ @isSubscribed: OnWayPointChange successful sequence (unsubscribed) +--! @parameters: +--! pAppId - application number (1, 2, etc.) +--! self - test object +--]] +function commonNavigation.isUnsubscribed(pAppId, self) + self, pAppId = commonNavigation.getSelfAndParams(pAppId, self) + local mobSession = commonNavigation.getMobileSession(pAppId, self) + self.hmiConnection:SendNotification("Navigation.OnWayPointChange", notification) + mobSession:ExpectNotification("OnWayPointChange"):Times(0) + commonTestCases:DelayedExp(commonNavigation.timeout) +end + +--[[ @getMobileResultCodes: get all available result codes from Mobile API +--! @parameters: none +--! @return: table with result codes +--]] +local function getMobileResultCodes() + local out = {} + for k in pairs(mobile_api_schema.enum["Result"]) do + table.insert(out, k) + end + return out +end + +--[[ @getExpectedResultCodes: get expected result codes from Mobile API for particular RPC +--! @parameters: +--! pFunctionName - name of the RPC +--! @return: table with result codes +--]] +local function getExpectedResultCodes(pFunctionName) + return mobile_api_schema.type["response"].functions[pFunctionName].param.resultCode.resultCodes +end + +--[[ @getHMIResultCodes: get all available result codes from HMI API +--! @parameters: none +--! @return: table with result codes +--]] +local function getHMIResultCodes() + local out = {} + for k in pairs(hmi_api_schema.enum["Result"]) do + table.insert(out, k) + end + return out +end + +--[[ @isContain: verify if table contans particular value +--! @parameters: +--! pTbl - table +--! pValue - value +--! @return: true if value is in table, otherwise - false +--]] +local function isContain(pTbl, pValue) + for _, v in pairs(pTbl) do + if v == pValue then return true end + end + return false +end + +--[[ @getKeysFromItemsTable: extract keys from table of items like { { key1 = value1, key2 = value2 }, ... } +--! @parameters: +--! pTbl - table +--! pKey - key name which going to be extracted from each item +--! @return: table of keys +--]] +function commonNavigation.getKeysFromItemsTable(pTbl, pKey) + local out = {} + for _, item in pairs(pTbl) do + if not isContain(out, item[pKey]) then + table.insert(out, item[pKey]) + end + end + return out +end + +--[[ @getResultCodesMap: create mapping table of result codes: HMI vs Mobile +--! @parameters: none +--! @return: table of items (HMI result code vs Mobile result code) +--]] +local function getResultCodesMap() + local out = {} + for _, v in pairs(getHMIResultCodes()) do + if not isContain(excludedCodes, v) then + if isContain(getMobileResultCodes(), v) then + table.insert(out, { mobile = v, hmi = v }) + else + table.insert(out, { mobile = nil, hmi = v }) + end + end + end + return out +end + +--[[ @getSuccessResultCodes: get success result codes for particular RPC +--! @parameters: +--! pFunctionName - name of the RPC +--! @return: table with result codes +--]] +function commonNavigation.getSuccessResultCodes(pFunctionName) + local out = {} + for _, item in pairs(getResultCodesMap()) do + if isContain(getExpectedResultCodes(pFunctionName), item.mobile) and isContain(successCodes, item.mobile) then + table.insert(out, { mobile = item.mobile, hmi = item.hmi }) + end + end + return out +end + +--[[ @getFailureResultCodes: get failure result codes for particular RPC +--! @parameters: +--! pFunctionName - name of the RPC +--! @return: table with result codes +--]] +function commonNavigation.getFailureResultCodes(pFunctionName) + local out = {} + for _, item in pairs(getResultCodesMap()) do + if isContain(getExpectedResultCodes(pFunctionName), item.mobile) and not isContain(successCodes, item.mobile) then + table.insert(out, { mobile = item.mobile, hmi = item.hmi }) + end + end + return out +end + +--[[ @getUnexpectedResultCodes: get unexpected result codes for particular RPC +--! @parameters: +--! pFunctionName - name of the RPC +--! @return: table with result codes +--]] +function commonNavigation.getUnexpectedResultCodes(pFunctionName) + local out = {} + for _, item in pairs(getResultCodesMap()) do + local success = false + if isContain(successCodes, item.mobile) then success = true end + if item.mobile ~= nil and not isContain(getExpectedResultCodes(pFunctionName), item.mobile) then + table.insert(out, { mobile = item.mobile, hmi = item.hmi, success = success }) + end + end + return out +end + +--[[ @getFilteredResultCodes: get not mapped result codes +--! @parameters: none +--! @return: table with result codes +--]] +function commonNavigation.getUnmappedResultCodes() + local out = {} + for _, item in pairs(getResultCodesMap()) do + if item.mobile == nil then + table.insert(out, { mobile = item.mobile, hmi = item.hmi }) + end + end + return out +end + +--[[ @printResultCodes: print result codes split by group +--! @parameters: +--! pResultCodes - table with all code groups +--]] +function commonNavigation.printResultCodes(pResultCodes) + local function printItem(pItem) + for _, v in pairs(pItem) do + local msg = v.hmi + if v.mobile and v.mobile ~= v.hmi then msg = msg .. "\t" .. v.mobile end + print("", msg) + end + end + print("Success:") + printItem(pResultCodes.success) + print("Failure:") + printItem(pResultCodes.failure) + print("Unexpected:") + printItem(pResultCodes.unexpected) + print("Unmapped:") + printItem(pResultCodes.unmapped) +end + +--[[ @DelayedExp: delay test step for default timeout +--! @parameters: none +--]] +function commonNavigation.DelayedExp() + commonTestCases:DelayedExp(commonNavigation.timeout) +end + +--[[ @getDeviceName: return device name +--! @parameters: none +--]] +function commonNavigation.getDeviceName() + return config.mobileHost .. ":" .. config.mobilePort +end + +--[[ @getDeviceMAC: return device MAC address +--! @parameters: none +--]] +function commonNavigation.getDeviceMAC() + local cmd = "echo -n " .. commonNavigation.getDeviceName() .. " | sha256sum | awk '{printf $1}'" + local handle = io.popen(cmd) + local result = handle:read("*a") + handle:close() + return result +end + +--[[ @protect: make table immutable +--! @parameters: +--! pTbl - mutable table +--! @return: immutable table +--]] +local function protect(pTbl) + local mt = { + __index = pTbl, + __newindex = function(_, k, v) + error("Attempting to change item " .. tostring(k) .. " to " .. tostring(v), 2) + end + } + return setmetatable({}, mt) +end + +return protect(commonNavigation) diff --git a/test_sets/LastMileNavigation.txt b/test_sets/LastMileNavigation.txt new file mode 100644 index 0000000000..55b7903282 --- /dev/null +++ b/test_sets/LastMileNavigation.txt @@ -0,0 +1,72 @@ +./test_scripts/API/Navigation/GetWayPoints/001_GetWayPoints_success_flow.lua +./test_scripts/API/Navigation/GetWayPoints/002_GetWayPoints_DISALLOWED_by_policy.lua +./test_scripts/API/Navigation/GetWayPoints/003_GetWayPoints_UNSUPPORTED_RESOURCE_getWayPointsEnabled_false.lua +./test_scripts/API/Navigation/GetWayPoints/004_GetWayPoints_UNSUPPORTED_RESOURCE_Navi_interface_is_not_available.lua +./test_scripts/API/Navigation/GetWayPoints/005_GetWayPoints_INVALID_DATA.lua +./test_scripts/API/Navigation/GetWayPoints/006_GetWayPoints_GENERIC_ERROR_HMI_did_not_respond.lua +./test_scripts/API/Navigation/GetWayPoints/007_GetWayPoints_GENERIC_ERROR_response_from_HMI_is_invalid.lua +./test_scripts/API/Navigation/GetWayPoints/008_GetWayPoints_IN_USE_one_app.lua +./test_scripts/API/Navigation/GetWayPoints/009_GetWayPoints_IN_USE_two_apps.lua +./test_scripts/API/Navigation/GetWayPoints/010_GetWayPoints_without_wayPoints.lua +./test_scripts/API/Navigation/GetWayPoints/011_GetWayPoints_several_responses.lua +./test_scripts/API/Navigation/GetWayPoints/012_GetWayPoints_boundary_values.lua +./test_scripts/API/Navigation/GetWayPoints/013_GetWayPoints_verify_correlationID_parameter.lua +./test_scripts/API/Navigation/GetWayPoints/014_GetWayPoints_OnResetTimeout.lua +./test_scripts/API/Navigation/GetWayPoints/015_GetWayPoints_empty_wayPoints.lua +./test_scripts/API/Navigation/GetWayPoints/016_GetWayPoints_bound_value_by_parameters.lua +./test_scripts/API/Navigation/GetWayPoints/017_GetWayPoints_out_bound_value_by_parameters.lua +./test_scripts/API/Navigation/GetWayPoints/018_GetWayPoints_fake_parameters.lua +./test_scripts/API/Navigation/GetWayPoints/019_GetWayPoints_duplicated_corr_id.lua +./test_scripts/API/Navigation/GetWayPoints/020_GetWayPoints_mandatory_missed_in_HMIresponse.lua +./test_scripts/API/Navigation/GetWayPoints/021_GetWayPoints_diff_HMI_levells.lua +./test_scripts/API/Navigation/GetWayPoints/022_GetWayPoints_invalid_characters.lua +./test_scripts/API/Navigation/GetWayPoints/023_GetWayPoints_app_not_registered.lua +./test_scripts/API/Navigation/GetWayPoints/024_GetWayPoints_invalid_types_in_HMIresponse.lua +./test_scripts/API/Navigation/GetWayPoints/025_GetWayPoints_Transfering_of_HMI_resultCode_to_mobile.lua +./test_scripts/API/Navigation/OnWayPointChange/001_OnWayPointChange_success_flow.lua +./test_scripts/API/Navigation/OnWayPointChange/002_OnWayPointChange_not_allowed_by_policy.lua +./test_scripts/API/Navigation/OnWayPointChange/003_OnWayPointChange_invalid_notification.lua +./test_scripts/API/Navigation/OnWayPointChange/004_OnWayPointChange_two_apps.lua +./test_scripts/API/Navigation/OnWayPointChange/005_OnWayPointChange_update_internaly_stored_notification_data.lua +./test_scripts/API/Navigation/OnWayPointChange/006_OnWayPointChange_OnlyManadatoryParams.lua +./test_scripts/API/Navigation/OnWayPointChange/007_OnWayPointChange_OnlyManadatoryParamsEmpty_success.lua +./test_scripts/API/Navigation/OnWayPointChange/008_OnWayPointChange_boundary_values_by_parameters.lua +./test_scripts/API/Navigation/OnWayPointChange/009_OnWayPointChange_out_boundary_values_by_parameters.lua +./test_scripts/API/Navigation/OnWayPointChange/010_OnWayPointChange_ImageWithUnknownValue.lua +./test_scripts/API/Navigation/OnWayPointChange/011_OnWayPointChange_invalid_types.lua +./test_scripts/API/Navigation/OnWayPointChange/012_OnWayPointChange_invalid_characters.lua +./test_scripts/API/Navigation/OnWayPointChange/013_OnWayPointChange_invalid_json.lua +./test_scripts/API/Navigation/OnWayPointChange/014_OnWayPointChange_WithInvalidJsonStructure.lua +./test_scripts/API/Navigation/OnWayPointChange/015_OnWayPointChange_WithFakeParams_SuccessWOFakeParams.lua +./test_scripts/API/Navigation/OnWayPointChange/016_OnWayPointChange_WithFakeParamsFromAnotherAPI_SuccessWOFakeParams.lua +./test_scripts/API/Navigation/OnWayPointChange/017_OnWayPointChange_SeveralNotificationsWithIdenticalParams_AllSuccess.lua +./test_scripts/API/Navigation/OnWayPointChange/018_OnWayPointChange_SeveralNotificationsWithDiffParams_AllSuccess.lua +./test_scripts/API/Navigation/OnWayPointChange/019_OnWayPointChange_diff_HMI_levels.lua +./test_scripts/API/Navigation/SubscribeWayPoints/001_SubscribeWayPoints_success_flow.lua +./test_scripts/API/Navigation/SubscribeWayPoints/002_SubscribeWayPoints_DISALLOWED_by_policy.lua +./test_scripts/API/Navigation/SubscribeWayPoints/003_SubscribeWayPoints_IGNORED_already_subscribed_app.lua +./test_scripts/API/Navigation/SubscribeWayPoints/004_SubscribeWayPoints_UNSUPPORTED_RESOURCE_Navi_interface_is_not_available.lua +./test_scripts/API/Navigation/SubscribeWayPoints/005_SubscribeWayPoints_INVALID_DATA.lua +./test_scripts/API/Navigation/SubscribeWayPoints/006_SubscribeWayPoints_GENERIC_ERROR_HMI_did_not_respond.lua +./test_scripts/API/Navigation/SubscribeWayPoints/007_SubscribeWayPoints_GENERIC_ERROR_HMI_respond_with_invalid_data.lua +./test_scripts/API/Navigation/SubscribeWayPoints/008_SubscribeWayPoints_IGN_OFF.lua +./test_scripts/API/Navigation/SubscribeWayPoints/009_SubscribeWayPoints_unexpected_disconnect.lua +./test_scripts/API/Navigation/SubscribeWayPoints/010_SubscribeWayPoints_2_apps.lua +./test_scripts/API/Navigation/SubscribeWayPoints/011_SubscribeWayPoints_fake_another_request_params.lua +./test_scripts/API/Navigation/SubscribeWayPoints/012_SubscribeWayPoints_APP_NOT_REGISTERED.lua +./test_scripts/API/Navigation/SubscribeWayPoints/013_SubscribeWayPoints_diff_HMI_levels.lua +./test_scripts/API/Navigation/SubscribeWayPoints/014_SubscribeWayPoints_Transfering_of_HMI_error_resultCode_to_mobile.lua +./test_scripts/API/Navigation/UnsubscribeWayPoints/001_UnsubscribeWayPoints_success_flow.lua +./test_scripts/API/Navigation/UnsubscribeWayPoints/002_UnsubscribeWayPoints_DISALLOWED_by_policy.lua +./test_scripts/API/Navigation/UnsubscribeWayPoints/003_UnsubscribeWayPoints_IGNORED_already_unsubscribed_app.lua +./test_scripts/API/Navigation/UnsubscribeWayPoints/004_UnsubscribeWayPoints_UNSUPPORTED_RESOURCE_Navi_interface_is_not_available.lua +./test_scripts/API/Navigation/UnsubscribeWayPoints/005_UnsubscribeWayPoints_INVALID_DATA.lua +./test_scripts/API/Navigation/UnsubscribeWayPoints/006_UnsubscribeWayPoints_GENERIC_ERROR_HMI_did_not_respond.lua +./test_scripts/API/Navigation/UnsubscribeWayPoints/007_UnsubscribeWayPoints_GENERIC_ERROR_HMI_respond_with_invalid_data.lua +./test_scripts/API/Navigation/UnsubscribeWayPoints/008_UnsubscribeWayPoints_IGN_OFF.lua +./test_scripts/API/Navigation/UnsubscribeWayPoints/009_UnsubscribeWayPoints_unexpected_disconnect.lua +./test_scripts/API/Navigation/UnsubscribeWayPoints/010_UnsubscribeWayPoints_2_apps.lua +./test_scripts/API/Navigation/UnsubscribeWayPoints/011_UnsubscribeWayPoints_diff_HMI_levels.lua +./test_scripts/API/Navigation/UnsubscribeWayPoints/012_UnsubscribeWayPoints_app_not_registered.lua +./test_scripts/API/Navigation/UnsubscribeWayPoints/013_UnsubscribeWayPoints_fake_another_request_parameters.lua +./test_scripts/API/Navigation/UnsubscribeWayPoints/014_UnsubscribeWayPoints_Transfering_of_HMI_error_resultCode_to_mobile.lua