Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add script(s) for issue 2353 #2509

Merged
merged 2 commits into from
Feb 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions test_scripts/Defects/7_1/2353_1_Request.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---------------------------------------------------------------------------------------------------
-- Issue: https://github.com/SmartDeviceLink/sdl_core/issues/2353
---------------------------------------------------------------------------------------------------
-- Description: Check SDL is able to proceed with request from HMI after cut off of fake parameters
-- Scenario: request that SDL should transfer to mobile app
--
-- Steps:
-- 1. HMI sends request with fake parameter
-- SDL does:
-- - cut off fake parameters
-- - check whether request is valid
-- - proceed with request in case if it's valid and transfer it to App
---------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local common = require('test_scripts/AppServices/commonAppServices')

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

--[[ Local Variables ]]
local manifest = {
serviceName = common.getConfigAppParams().appName,
serviceType = "MEDIA",
allowAppConsumers = true,
rpcSpecVersion = common.getConfigAppParams().syncMsgVersion,
mediaServiceManifest = {}
}

--[[ Local Functions ]]
local function ptUpdate(tbl)
tbl.policy_table.app_policies[common.getConfigAppParams().fullAppID] = common.getAppServiceProducerConfig(1);
end

local function sendPerformAppServiceInteraction()
local hmiReq = {
serviceUri = "mobile:sample.service.uri",
serviceID = common.getAppServiceID(),
fakeParam = "123"
}
local mobReq = {
originApp = common.sdl.getSDLIniParameter("HMIOriginID"),
serviceID = hmiReq.serviceID,
serviceUri = hmiReq.serviceUri
}
local mobRes = {
serviceSpecificResult = "SPECIFIC_RESULT",
success = true,
resultCode = "SUCCESS"
}
local hmiRes = {
result = {
code = 0, -- SUCCESS
method = "AppService.PerformAppServiceInteraction",
serviceSpecificResult = mobRes.serviceSpecificResult
}
}
local cid = common.getHMIConnection():SendRequest("AppService.PerformAppServiceInteraction", hmiReq)
common.getMobileSession():ExpectRequest("PerformAppServiceInteraction", mobReq)
:Do(function(_, data)
common.getMobileSession():SendResponse(data.rpcFunctionId, data.rpcCorrelationId, mobRes)
end)
:ValidIf(function(_, data)
if data.payload.fakeParam then
return false, "Unexpected 'fakeParam' is received"
end
return true
end)
common.getHMIConnection():ExpectResponse(cid, hmiRes)
end

--[[ Scenario ]]
runner.Title("Preconditions")
runner.Step("Clean environment", common.preconditions)
runner.Step("Start SDL, HMI, connect regular mobile, start Session", common.start)
runner.Step("Register App", common.registerApp)
runner.Step("PTU", common.policyTableUpdate, { ptUpdate })
runner.Step("Activate App", common.activateApp)
runner.Step("Publish App Service", common.publishMobileAppService, { manifest })

runner.Title("Test")
runner.Step("HMI sends PerformAppServiceInteraction", sendPerformAppServiceInteraction)

runner.Title("Postconditions")
runner.Step("Stop SDL, restore SDL settings and PPT", common.postconditions)
74 changes: 74 additions & 0 deletions test_scripts/Defects/7_1/2353_2_Response.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---------------------------------------------------------------------------------------------------
-- Issue: https://github.com/SmartDeviceLink/sdl_core/issues/2353
---------------------------------------------------------------------------------------------------
-- Description: Check SDL is able to proceed with response from HMI after cut off of fake parameters
-- Scenario: response that SDL should transfer to mobile app
--
-- Steps:
-- 1. App sends request to SDL
-- SDL does:
-- - transfer this request to HMI
-- 2. HMI responds with fake parameter
-- SDL does:
-- - cut off fake parameters
-- - check whether response is valid
-- - proceed with response in case if it's valid and transfer it to App
---------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local common = require("user_modules/sequences/actions")
local utils = require("user_modules/utils")

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

--[[ Local Functions ]]
local function ptUpdate(pTbl)
pTbl.policy_table.app_policies[common.app.getParams().fullAppID].groups = { "Base-4", "PropriataryData-1" }
end

local function sendReadDID()
local params = {
ecuName = 2000,
didLocation = {
56832
}
}
local exp = {
didResult = {
{
resultCode = "SUCCESS",
didLocation = params.didLocation[1],
data = "some_data"
}
}
}
local dataFromHMI = utils.cloneTable(exp)
dataFromHMI.didResult[1].fakeParam = "123"
local cid = common.getMobileSession():SendRPC("ReadDID", params)
common.getHMIConnection():ExpectRequest("VehicleInfo.ReadDID")
:Do(function(_, data)
common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", dataFromHMI)
end)
common.getMobileSession():ExpectResponse(cid, { success = true, resultCode = "SUCCESS", didResult = exp.didResult })
:ValidIf(function(_, data)
if data.payload.didResult[1].fakeParam then
return false, "Unexpected 'fakeParam' is received"
end
return true
end)
end

--[[ Scenario ]]
runner.Title("Preconditions")
runner.Step("Clean environment", common.preconditions)
runner.Step("Start SDL, HMI, connect regular mobile, start Session", common.start)
runner.Step("Register App", common.registerApp)
runner.Step("PTU", common.policyTableUpdate, { ptUpdate })
runner.Step("Activate App", common.activateApp)

runner.Title("Test")
runner.Step("App sends ReadDID", sendReadDID)

runner.Title("Postconditions")
runner.Step("Stop SDL, restore SDL settings and PPT", common.postconditions)
63 changes: 63 additions & 0 deletions test_scripts/Defects/7_1/2353_3_Notification.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---------------------------------------------------------------------------------------------------
-- Issue: https://github.com/SmartDeviceLink/sdl_core/issues/2353
---------------------------------------------------------------------------------------------------
-- Description: Check SDL is able to proceed with notification from HMI after cut off of fake parameters
-- Scenario: notification that SDL should transfer to mobile app
--
-- Steps:
-- 1. HMI sends notification with fake parameter
-- SDL does:
-- - cut off fake parameters
-- - check whether notification is valid
-- - proceed with notification in case if it's valid and transfer it to App
---------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local common = require("user_modules/sequences/actions")
local utils = require("user_modules/utils")

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

--[[ Local Functions ]]
local function sendOnSCU()
local expDataToMobile = {
systemCapability = {
systemCapabilityType = "DISPLAYS",
displayCapabilities = {
{
displayName = "MainDisplayName",
windowCapabilities = {
{
windowID = 0,
templatesAvailable = { "Tmpl1", "Tmpl2" }
}
}
}
}
}
}
local dataFromHMI = utils.cloneTable(expDataToMobile)
dataFromHMI.appID = common.getHMIAppId()
dataFromHMI.systemCapability.fakeParam = "123"
common.getHMIConnection():SendNotification("BasicCommunication.OnSystemCapabilityUpdated", dataFromHMI)
common.getMobileSession():ExpectNotification("OnSystemCapabilityUpdated", expDataToMobile)
:ValidIf(function(_, data)
if data.payload.systemCapability.fakeParam then
return false, "Unexpected 'fakeParam' is received"
end
return true
end)
end

--[[ Scenario ]]
runner.Title("Preconditions")
runner.Step("Clean environment", common.preconditions)
runner.Step("Start SDL, HMI, connect regular mobile, start Session", common.start)
runner.Step("Register App", common.registerAppWOPTU)

runner.Title("Test")
runner.Step("HMI sends OnSystemCapabilityUpdated", sendOnSCU)

runner.Title("Postconditions")
runner.Step("Stop SDL, restore SDL settings and PPT", common.postconditions)
3 changes: 3 additions & 0 deletions test_sets/Defects/Defects_release_7_1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@
./test_scripts/Defects/7_1/1597_4_PerformAudioPassThru_Unsupported_Speech_Type.lua
./test_scripts/Defects/7_1/2803_Resumption_of_HMI_level_of_2nd_app.lua
./test_scripts/Defects/7_1/3406_SetAppIcon_spec_chars_in_syncFileName.lua
./test_scripts/Defects/7_1/2353_1_Request.lua
./test_scripts/Defects/7_1/2353_2_Response.lua
./test_scripts/Defects/7_1/2353_3_Notification.lua