From bb4475ddc8d856a49f8d51e968ceb52e5e4d41de Mon Sep 17 00:00:00 2001 From: HSavynetska Date: Mon, 18 Jun 2018 11:44:04 +0300 Subject: [PATCH 1/6] Script for reproducing issue 1306 --- ...OMPT_and_VRHELPITEMS_to_default_values.lua | 119 ++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 test_scripts/Defects/4_6/1306_ResetGlobalProperties_does_not_reset_HELPPROMPT_and_VRHELPITEMS_to_default_values.lua diff --git a/test_scripts/Defects/4_6/1306_ResetGlobalProperties_does_not_reset_HELPPROMPT_and_VRHELPITEMS_to_default_values.lua b/test_scripts/Defects/4_6/1306_ResetGlobalProperties_does_not_reset_HELPPROMPT_and_VRHELPITEMS_to_default_values.lua new file mode 100644 index 0000000000..25c321e483 --- /dev/null +++ b/test_scripts/Defects/4_6/1306_ResetGlobalProperties_does_not_reset_HELPPROMPT_and_VRHELPITEMS_to_default_values.lua @@ -0,0 +1,119 @@ +--------------------------------------------------------------------------------------------------- +-- User story: https://github.com/smartdevicelink/sdl_core/issues/1306 +-- +-- Precondition: +-- +-- Delete app_info.dat file. +-- SDL started. Application is registered and activated on HMI. +-- Description: +-- Steps to reproduce: +-- 1) Send SetGlobalProperties from mobile (helpPrompt, timeoutPrompt, vrHelpTitle, vrHelp). ==>successfully set +-- 2) Stop smartDeviceLinkCore in terminal (through ctrl+c) and do not exit from mobile app. +-- 3) Start smartDeviceLinkCore and HMI. +-- 4) Mobile App is registered and activated (HMI lvl FULL) +-- 5) Send SetGlobalProperties from mobile (helpPrompt, timeoutPrompt, vrHelpTitle, vrHelp). ==>successfully set +-- 6) Send ResetGlobalProperties from mobile (helpPrompt, timeoutPrompt, vrHelpTitle, vrHelp) +-- Expected result: +-- 1) SDL should send to HMI UI.SetGlobalProperties("vrHelpTitle", "vrHelp") with default values. +-- 2) SDL should send to HMI TTS.SetGlobalProperties with "helpPrompt" parameter that should be reset to default value +-- (smartDeviceLink.ini file contains default values for "helpPrompt" +-- Actual result: +-- 1) SDL sends to HMI UI.SetGlobalProperties(vrHelpTitle) without vrHelp - not OK +-- 2) SDL sends to HMI TTS.SetGlobalProperties("helpPrompt":[ ]) - empty array - not OK. +--------------------------------------------------------------------------------------------------- +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/Defects/commonDefects') + +--[[ Local Variables ]] +local requestParams = { + helpPrompt = { + { text = "Help prompt", type = "TEXT" } + }, + timeoutPrompt = { + { text = "Timeout prompt", type = "TEXT" } + }, + vrHelpTitle = "VR help title", + vrHelp = { + { position = 1, text = "VR help item" } + } +} + +local UiParams = { + vrHelpTitle = requestParams.vrHelpTitle, + vrHelp = requestParams.vrHelp, +} + +local TtsParams = { + timeoutPrompt = requestParams.timeoutPrompt, + helpPrompt = requestParams.helpPrompt +} + +local allParams = { + requestParams = requestParams, + UiParams = UiParams, + TtsParams = TtsParams +} + +--[[ Local Functions ]] +local function setGlobalPropertiesSUCCES(params, self) + local cid = self.mobileSession1:SendRPC("SetGlobalProperties", params.requestParams) + + params.UiParams.appID = common.getHMIAppId() + EXPECT_HMICALL("UI.SetGlobalProperties", params.UiParams) + :Do(function(_,data) + self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", {}) + end) + + TtsParams.appID = common.getHMIAppId() + EXPECT_HMICALL("TTS.SetGlobalProperties", TtsParams) + :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 ResetGlobalPropertiesSUCCES(params, self) + local cid = self.mobileSession1:SendRPC("SetGlobalProperties", params.requestParams) + + params.UiParams.appID = common.getHMIAppId() + EXPECT_HMICALL("UI.SetGlobalProperties", params.UiParams) + :Do(function(_,data) + self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", {}) + end) + + TtsParams.appID = common.getHMIAppId() + EXPECT_HMICALL("TTS.SetGlobalProperties", TtsParams) + :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 sdlStop(self) + StopSDL() + EXPECT_HMINOTIFICATION("BasicCommunication.OnAppUnregistered", { appID = common.getHMIAppId(), unexpectedDisconnect = true }) + self.mobileSession1:ExpectNotification("OnAppInterfaceUnregistered", {{}}) + EXPECT_HMINOTIFICATION("BasicCommunication.OnSDLClose",{}) +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.rai_n) +runner.Step("Activate App", common.activate_app) + +runner.Title("Test") +runner.Step("Send SetGlobalProperties", setGlobalPropertiesSUCCES, { allParams }) +runner.Step("Stop SDL", sdlStop) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI, PTU", common.rai_n) +runner.Step("Activate App", common.activate_app) +runner.Step("Send SetGlobalProperties", setGlobalPropertiesSUCCES, { allParams }) +runner.Step("Send ResetGlobalProperties", ResetGlobalPropertiesSUCCES, { allParams }) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) From e18ecceae46e7380a2a902c54a2b539e951f1e7c Mon Sep 17 00:00:00 2001 From: HSavynetska Date: Thu, 21 Jun 2018 13:55:34 +0300 Subject: [PATCH 2/6] Update script --- ...OMPT_and_VRHELPITEMS_to_default_values.lua | 69 ++++++++++++------- 1 file changed, 44 insertions(+), 25 deletions(-) rename test_scripts/Defects/{4_6 => 5_0}/1306_ResetGlobalProperties_does_not_reset_HELPPROMPT_and_VRHELPITEMS_to_default_values.lua (70%) diff --git a/test_scripts/Defects/4_6/1306_ResetGlobalProperties_does_not_reset_HELPPROMPT_and_VRHELPITEMS_to_default_values.lua b/test_scripts/Defects/5_0/1306_ResetGlobalProperties_does_not_reset_HELPPROMPT_and_VRHELPITEMS_to_default_values.lua similarity index 70% rename from test_scripts/Defects/4_6/1306_ResetGlobalProperties_does_not_reset_HELPPROMPT_and_VRHELPITEMS_to_default_values.lua rename to test_scripts/Defects/5_0/1306_ResetGlobalProperties_does_not_reset_HELPPROMPT_and_VRHELPITEMS_to_default_values.lua index 25c321e483..6339d54e7f 100644 --- a/test_scripts/Defects/4_6/1306_ResetGlobalProperties_does_not_reset_HELPPROMPT_and_VRHELPITEMS_to_default_values.lua +++ b/test_scripts/Defects/5_0/1306_ResetGlobalProperties_does_not_reset_HELPPROMPT_and_VRHELPITEMS_to_default_values.lua @@ -24,19 +24,15 @@ --[[ Required Shared libraries ]] local runner = require('user_modules/script_runner') local common = require('test_scripts/Defects/commonDefects') +local commonPreconditions = require('user_modules/shared_testcases/commonPreconditions') +local actions = require("user_modules/sequences/actions") --[[ Local Variables ]] local requestParams = { - helpPrompt = { - { text = "Help prompt", type = "TEXT" } - }, - timeoutPrompt = { - { text = "Timeout prompt", type = "TEXT" } - }, + helpPrompt = {{ text = "Help prompt", type = "TEXT" }}, + timeoutPrompt = {{ text = "Timeout prompt", type = "TEXT" }}, vrHelpTitle = "VR help title", - vrHelp = { - { position = 1, text = "VR help item" } - } + vrHelp = {{ position = 1, text = "VR help item" }} } local UiParams = { @@ -56,6 +52,30 @@ local allParams = { } --[[ Local Functions ]] +local function getValueFromIniFile(path_to_ini, parameter_name) + local f = assert(io.open(path_to_ini, "r")) + local fileContent = f:read("*all") + local ParameterValue + ParameterValue = string.match(fileContent, parameter_name .. " =.- (.-)\n") + f:close() + return ParameterValue +end + +local pathToIniFile = commonPreconditions:GetPathToSDL() .. "smartDeviceLink.ini" + +local requesUIparams = { + vrHelpTitle = getValueFromIniFile(pathToIniFile, "HelpTitle"), + vrHelp = {{ position = 1, text = actions.getConfigAppParams(pAppId).appName }} +} + +local paramHP = getValueFromIniFile(pathToIniFile, "HelpPromt") +local paramTP = getValueFromIniFile(pathToIniFile, "TimeOutPromt") + +local requesTTSparams = { + helpPrompt = {{ text = paramHP[1], type = "TEXT"}, {text = paramHP[2], type = "TEXT"}}, + timeoutPrompt = {{ text = paramTP[1], type = "TEXT"}, {text = paramTP[2], type = "TEXT"}} +} + local function setGlobalPropertiesSUCCES(params, self) local cid = self.mobileSession1:SendRPC("SetGlobalProperties", params.requestParams) @@ -65,8 +85,8 @@ local function setGlobalPropertiesSUCCES(params, self) self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", {}) end) - TtsParams.appID = common.getHMIAppId() - EXPECT_HMICALL("TTS.SetGlobalProperties", TtsParams) + params.TtsParams.appID = common.getHMIAppId() + EXPECT_HMICALL("TTS.SetGlobalProperties", params.TtsParams) :Do(function(_,data) self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", {}) end) @@ -74,17 +94,23 @@ local function setGlobalPropertiesSUCCES(params, self) self.mobileSession1:ExpectNotification("OnHashChange") end -local function ResetGlobalPropertiesSUCCES(params, self) - local cid = self.mobileSession1:SendRPC("SetGlobalProperties", params.requestParams) +local function sdlStop(self) + StopSDL() + EXPECT_HMINOTIFICATION("BasicCommunication.OnAppUnregistered", { appID = common.getHMIAppId(), unexpectedDisconnect = true }) + self.mobileSession1:ExpectNotification("OnAppInterfaceUnregistered", {{}}) + EXPECT_HMINOTIFICATION("BasicCommunication.OnSDLClose",{}) +end - params.UiParams.appID = common.getHMIAppId() - EXPECT_HMICALL("UI.SetGlobalProperties", params.UiParams) +local function ResetGlobalProperties(self) + local cid = self.mobileSession1:SendRPC("ResetGlobalProperties", { + properties = { "VRHELPTITLE", "HELPPROMPT", "TIMEOUTPROMPT", "VRHELPITEMS" } + }) + EXPECT_HMICALL("UI.SetGlobalProperties", requesUIparams) :Do(function(_,data) self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", {}) end) - TtsParams.appID = common.getHMIAppId() - EXPECT_HMICALL("TTS.SetGlobalProperties", TtsParams) + EXPECT_HMICALL("TTS.SetGlobalProperties", requesTTSparams) :Do(function(_,data) self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", {}) end) @@ -92,13 +118,6 @@ local function ResetGlobalPropertiesSUCCES(params, self) self.mobileSession1:ExpectNotification("OnHashChange") end -local function sdlStop(self) - StopSDL() - EXPECT_HMINOTIFICATION("BasicCommunication.OnAppUnregistered", { appID = common.getHMIAppId(), unexpectedDisconnect = true }) - self.mobileSession1:ExpectNotification("OnAppInterfaceUnregistered", {{}}) - EXPECT_HMINOTIFICATION("BasicCommunication.OnSDLClose",{}) -end - --[[ Scenario ]] runner.Title("Preconditions") runner.Step("Clean environment", common.preconditions) @@ -113,7 +132,7 @@ runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) runner.Step("RAI, PTU", common.rai_n) runner.Step("Activate App", common.activate_app) runner.Step("Send SetGlobalProperties", setGlobalPropertiesSUCCES, { allParams }) -runner.Step("Send ResetGlobalProperties", ResetGlobalPropertiesSUCCES, { allParams }) +runner.Step("Send ResetGlobalProperties", ResetGlobalProperties) runner.Title("Postconditions") runner.Step("Stop SDL", common.postconditions) From 2d1d564fa4189d55e21e70059ee1a5eecf73455c Mon Sep 17 00:00:00 2001 From: IGetmanets Date: Tue, 5 May 2020 12:35:12 +0300 Subject: [PATCH 3/6] Script 1306 update and moving --- ...OMPT_and_VRHELPITEMS_to_default_values.lua | 79 ++++++++++++------- 1 file changed, 49 insertions(+), 30 deletions(-) rename test_scripts/Defects/{5_0 => 6_1}/1306_ResetGlobalProperties_does_not_reset_HELPPROMPT_and_VRHELPITEMS_to_default_values.lua (77%) diff --git a/test_scripts/Defects/5_0/1306_ResetGlobalProperties_does_not_reset_HELPPROMPT_and_VRHELPITEMS_to_default_values.lua b/test_scripts/Defects/6_1/1306_ResetGlobalProperties_does_not_reset_HELPPROMPT_and_VRHELPITEMS_to_default_values.lua similarity index 77% rename from test_scripts/Defects/5_0/1306_ResetGlobalProperties_does_not_reset_HELPPROMPT_and_VRHELPITEMS_to_default_values.lua rename to test_scripts/Defects/6_1/1306_ResetGlobalProperties_does_not_reset_HELPPROMPT_and_VRHELPITEMS_to_default_values.lua index 6339d54e7f..a72ea4db18 100644 --- a/test_scripts/Defects/5_0/1306_ResetGlobalProperties_does_not_reset_HELPPROMPT_and_VRHELPITEMS_to_default_values.lua +++ b/test_scripts/Defects/6_1/1306_ResetGlobalProperties_does_not_reset_HELPPROMPT_and_VRHELPITEMS_to_default_values.lua @@ -24,7 +24,6 @@ --[[ Required Shared libraries ]] local runner = require('user_modules/script_runner') local common = require('test_scripts/Defects/commonDefects') -local commonPreconditions = require('user_modules/shared_testcases/commonPreconditions') local actions = require("user_modules/sequences/actions") --[[ Local Variables ]] @@ -52,29 +51,53 @@ local allParams = { } --[[ Local Functions ]] -local function getValueFromIniFile(path_to_ini, parameter_name) - local f = assert(io.open(path_to_ini, "r")) - local fileContent = f:read("*all") - local ParameterValue - ParameterValue = string.match(fileContent, parameter_name .. " =.- (.-)\n") - f:close() - return ParameterValue +local function splitString(pInputStr, pSep) + if pSep == nil then + pSep = "%s" + end + local out, i = {}, 1 + for str in string.gmatch(pInputStr, "([^" .. pSep .. "]+)") do + out[i] = str + i = i + 1 + end + return out end -local pathToIniFile = commonPreconditions:GetPathToSDL() .. "smartDeviceLink.ini" - -local requesUIparams = { - vrHelpTitle = getValueFromIniFile(pathToIniFile, "HelpTitle"), - vrHelp = {{ position = 1, text = actions.getConfigAppParams(pAppId).appName }} -} - -local paramHP = getValueFromIniFile(pathToIniFile, "HelpPromt") -local paramTP = getValueFromIniFile(pathToIniFile, "TimeOutPromt") - -local requesTTSparams = { - helpPrompt = {{ text = paramHP[1], type = "TEXT"}, {text = paramHP[2], type = "TEXT"}}, - timeoutPrompt = {{ text = paramTP[1], type = "TEXT"}, {text = paramTP[2], type = "TEXT"}} -} +local function getResetGlobalPropertiesParams() + local uiParams = { + vrHelpTitle = actions.sdl.getSDLIniParameter("HelpTitle"), + vrHelp = {{ position = 1, text = actions.getConfigAppParams().appName }} + } + + local paramHP = splitString( + actions.sdl.getSDLIniParameter("HelpPromt"), + actions.sdl.getSDLIniParameter("TTSDelimiter") + ) + local paramTP = splitString( + actions.sdl.getSDLIniParameter("TimeOutPromt"), + actions.sdl.getSDLIniParameter("TTSDelimiter") + ) + local helpPromptArray = {} + local timeoutPromptArray = {} + + if next(paramHP) then + for i=1, #paramHP do + helpPromptArray[i] = { text = paramHP[i], type = "TEXT" } + end + end + + if next(paramTP) then + for i=1, #paramTP do + timeoutPromptArray[i] = { text = paramTP[i], type = "TEXT" } + end + end + + local ttsParams = { + helpPrompt = helpPromptArray, + timeoutPrompt = timeoutPromptArray + } + return uiParams, ttsParams +end local function setGlobalPropertiesSUCCES(params, self) local cid = self.mobileSession1:SendRPC("SetGlobalProperties", params.requestParams) @@ -94,17 +117,13 @@ local function setGlobalPropertiesSUCCES(params, self) self.mobileSession1:ExpectNotification("OnHashChange") end -local function sdlStop(self) - StopSDL() - EXPECT_HMINOTIFICATION("BasicCommunication.OnAppUnregistered", { appID = common.getHMIAppId(), unexpectedDisconnect = true }) - self.mobileSession1:ExpectNotification("OnAppInterfaceUnregistered", {{}}) - EXPECT_HMINOTIFICATION("BasicCommunication.OnSDLClose",{}) -end - local function ResetGlobalProperties(self) + local requesUIparams, requesTTSparams = getResetGlobalPropertiesParams() + local cid = self.mobileSession1:SendRPC("ResetGlobalProperties", { properties = { "VRHELPTITLE", "HELPPROMPT", "TIMEOUTPROMPT", "VRHELPITEMS" } }) + EXPECT_HMICALL("UI.SetGlobalProperties", requesUIparams) :Do(function(_,data) self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", {}) @@ -127,7 +146,7 @@ runner.Step("Activate App", common.activate_app) runner.Title("Test") runner.Step("Send SetGlobalProperties", setGlobalPropertiesSUCCES, { allParams }) -runner.Step("Stop SDL", sdlStop) +runner.Step("Stop SDL", StopSDL) runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) runner.Step("RAI, PTU", common.rai_n) runner.Step("Activate App", common.activate_app) From 284ae131d505ee14aab962197a40921a6872f045 Mon Sep 17 00:00:00 2001 From: IGetmanets Date: Tue, 5 May 2020 12:38:59 +0300 Subject: [PATCH 4/6] test set for 1306 issue --- test_sets/Defects/6_1/1306.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 test_sets/Defects/6_1/1306.txt diff --git a/test_sets/Defects/6_1/1306.txt b/test_sets/Defects/6_1/1306.txt new file mode 100644 index 0000000000..75a0ec9373 --- /dev/null +++ b/test_sets/Defects/6_1/1306.txt @@ -0,0 +1 @@ +./test_scripts/Defects/6_1/1306_ResetGlobalProperties_does_not_reset_HELPPROMPT_and_VRHELPITEMS_to_default_values.lua From b3a968cdb298bcfb9e6403d06418ad080017c3eb Mon Sep 17 00:00:00 2001 From: Dmitriy Boltovskiy Date: Thu, 22 Oct 2020 17:08:06 -0400 Subject: [PATCH 5/6] Move scripts to release 7.0 --- ...es_not_reset_HELPPROMPT_and_VRHELPITEMS_to_default_values.lua | 0 test_sets/Defects/6_1/1306.txt | 1 - test_sets/Defects/Defects_release_7_0.txt | 1 + 3 files changed, 1 insertion(+), 1 deletion(-) rename test_scripts/Defects/{6_1 => 7_0}/1306_ResetGlobalProperties_does_not_reset_HELPPROMPT_and_VRHELPITEMS_to_default_values.lua (100%) delete mode 100644 test_sets/Defects/6_1/1306.txt diff --git a/test_scripts/Defects/6_1/1306_ResetGlobalProperties_does_not_reset_HELPPROMPT_and_VRHELPITEMS_to_default_values.lua b/test_scripts/Defects/7_0/1306_ResetGlobalProperties_does_not_reset_HELPPROMPT_and_VRHELPITEMS_to_default_values.lua similarity index 100% rename from test_scripts/Defects/6_1/1306_ResetGlobalProperties_does_not_reset_HELPPROMPT_and_VRHELPITEMS_to_default_values.lua rename to test_scripts/Defects/7_0/1306_ResetGlobalProperties_does_not_reset_HELPPROMPT_and_VRHELPITEMS_to_default_values.lua diff --git a/test_sets/Defects/6_1/1306.txt b/test_sets/Defects/6_1/1306.txt deleted file mode 100644 index 75a0ec9373..0000000000 --- a/test_sets/Defects/6_1/1306.txt +++ /dev/null @@ -1 +0,0 @@ -./test_scripts/Defects/6_1/1306_ResetGlobalProperties_does_not_reset_HELPPROMPT_and_VRHELPITEMS_to_default_values.lua diff --git a/test_sets/Defects/Defects_release_7_0.txt b/test_sets/Defects/Defects_release_7_0.txt index 1633ab0ae5..1547a67f1c 100644 --- a/test_sets/Defects/Defects_release_7_0.txt +++ b/test_sets/Defects/Defects_release_7_0.txt @@ -39,3 +39,4 @@ ./test_scripts/Defects/7_0/3532_OnSCU_after_Show_widget_IGN_OFF_ON_Cycle.lua ./test_scripts/Defects/7_0/3532_OnSCU_after_Show_main_IGN_OFF_ON_Cycle.lua ./test_scripts/Defects/7_0/3542_apps_activation_after_resumption.lua +./test_scripts/Defects/7_0/1306_ResetGlobalProperties_does_not_reset_HELPPROMPT_and_VRHELPITEMS_to_default_values.lua From e2378ac7f68f1fab01d44a6ca87ef4df75a54f45 Mon Sep 17 00:00:00 2001 From: Dmitriy Boltovskiy Date: Thu, 22 Oct 2020 17:53:23 -0400 Subject: [PATCH 6/6] Rework script --- ...OMPT_and_VRHELPITEMS_to_default_values.lua | 112 ++++++++---------- 1 file changed, 51 insertions(+), 61 deletions(-) diff --git a/test_scripts/Defects/7_0/1306_ResetGlobalProperties_does_not_reset_HELPPROMPT_and_VRHELPITEMS_to_default_values.lua b/test_scripts/Defects/7_0/1306_ResetGlobalProperties_does_not_reset_HELPPROMPT_and_VRHELPITEMS_to_default_values.lua index a72ea4db18..6cd89c9306 100644 --- a/test_scripts/Defects/7_0/1306_ResetGlobalProperties_does_not_reset_HELPPROMPT_and_VRHELPITEMS_to_default_values.lua +++ b/test_scripts/Defects/7_0/1306_ResetGlobalProperties_does_not_reset_HELPPROMPT_and_VRHELPITEMS_to_default_values.lua @@ -1,35 +1,30 @@ --------------------------------------------------------------------------------------------------- --- User story: https://github.com/smartdevicelink/sdl_core/issues/1306 --- --- Precondition: +-- Issue: https://github.com/smartdevicelink/sdl_core/issues/1306 +--------------------------------------------------------------------------------------------------- +-- Steps: +-- 1. Send SetGlobalProperties from mobile (helpPrompt, timeoutPrompt, vrHelpTitle, vrHelp) +-- 2. Stop smartDeviceLinkCore in terminal (through ctrl+c) and do not exit from mobile app +-- 3. Start smartDeviceLinkCore and HMI +-- 4. Mobile App is registered and activated +-- 5. Send SetGlobalProperties from mobile (helpPrompt, timeoutPrompt, vrHelpTitle, vrHelp) +-- 6. Send ResetGlobalProperties from mobile (helpPrompt, timeoutPrompt, vrHelpTitle, vrHelp) -- --- Delete app_info.dat file. --- SDL started. Application is registered and activated on HMI. --- Description: --- Steps to reproduce: --- 1) Send SetGlobalProperties from mobile (helpPrompt, timeoutPrompt, vrHelpTitle, vrHelp). ==>successfully set --- 2) Stop smartDeviceLinkCore in terminal (through ctrl+c) and do not exit from mobile app. --- 3) Start smartDeviceLinkCore and HMI. --- 4) Mobile App is registered and activated (HMI lvl FULL) --- 5) Send SetGlobalProperties from mobile (helpPrompt, timeoutPrompt, vrHelpTitle, vrHelp). ==>successfully set --- 6) Send ResetGlobalProperties from mobile (helpPrompt, timeoutPrompt, vrHelpTitle, vrHelp) --- Expected result: --- 1) SDL should send to HMI UI.SetGlobalProperties("vrHelpTitle", "vrHelp") with default values. --- 2) SDL should send to HMI TTS.SetGlobalProperties with "helpPrompt" parameter that should be reset to default value +-- SDL does: +-- - send to HMI UI.SetGlobalProperties("vrHelpTitle", "vrHelp") with default values +-- - send to HMI TTS.SetGlobalProperties with "helpPrompt" parameter that should be reset to default value -- (smartDeviceLink.ini file contains default values for "helpPrompt" --- Actual result: --- 1) SDL sends to HMI UI.SetGlobalProperties(vrHelpTitle) without vrHelp - not OK --- 2) SDL sends to HMI TTS.SetGlobalProperties("helpPrompt":[ ]) - empty array - not OK. --------------------------------------------------------------------------------------------------- --[[ Required Shared libraries ]] local runner = require('user_modules/script_runner') -local common = require('test_scripts/Defects/commonDefects') -local actions = require("user_modules/sequences/actions") +local common = require("user_modules/sequences/actions") + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false --[[ Local Variables ]] local requestParams = { helpPrompt = {{ text = "Help prompt", type = "TEXT" }}, - timeoutPrompt = {{ text = "Timeout prompt", type = "TEXT" }}, + timeoutPrompt = {{ text = "Timeout prompt", type = "TEXT" }}, vrHelpTitle = "VR help title", vrHelp = {{ position = 1, text = "VR help item" }} } @@ -65,30 +60,25 @@ end local function getResetGlobalPropertiesParams() local uiParams = { - vrHelpTitle = actions.sdl.getSDLIniParameter("HelpTitle"), - vrHelp = {{ position = 1, text = actions.getConfigAppParams().appName }} + vrHelpTitle = common.sdl.getSDLIniParameter("HelpTitle"), + vrHelp = {{ position = 1, text = common.getConfigAppParams().appName }} } - local paramHP = splitString( - actions.sdl.getSDLIniParameter("HelpPromt"), - actions.sdl.getSDLIniParameter("TTSDelimiter") - ) - local paramTP = splitString( - actions.sdl.getSDLIniParameter("TimeOutPromt"), - actions.sdl.getSDLIniParameter("TTSDelimiter") - ) + local delimiter = common.sdl.getSDLIniParameter("TTSDelimiter") + local paramHP = splitString(common.sdl.getSDLIniParameter("HelpPromt"), delimiter) + local paramTP = splitString(common.sdl.getSDLIniParameter("TimeOutPromt"), delimiter) local helpPromptArray = {} local timeoutPromptArray = {} if next(paramHP) then - for i=1, #paramHP do - helpPromptArray[i] = { text = paramHP[i], type = "TEXT" } + for i = 1, #paramHP do + helpPromptArray[i] = { text = paramHP[i] .. delimiter, type = "TEXT" } end end if next(paramTP) then - for i=1, #paramTP do - timeoutPromptArray[i] = { text = paramTP[i], type = "TEXT" } + for i = 1, #paramTP do + timeoutPromptArray[i] = { text = paramTP[i] .. delimiter, type = "TEXT" } end end @@ -99,59 +89,59 @@ local function getResetGlobalPropertiesParams() return uiParams, ttsParams end -local function setGlobalPropertiesSUCCES(params, self) - local cid = self.mobileSession1:SendRPC("SetGlobalProperties", params.requestParams) +local function sendSetGlobalProperties(pParams) + local cid = common.mobile.getSession():SendRPC("SetGlobalProperties", pParams.requestParams) - params.UiParams.appID = common.getHMIAppId() - EXPECT_HMICALL("UI.SetGlobalProperties", params.UiParams) + pParams.UiParams.appID = common.getHMIAppId() + common.hmi.getConnection():ExpectRequest("UI.SetGlobalProperties", pParams.UiParams) :Do(function(_,data) - self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", {}) + common.hmi.getConnection():SendResponse(data.id, data.method, "SUCCESS", {}) end) - params.TtsParams.appID = common.getHMIAppId() - EXPECT_HMICALL("TTS.SetGlobalProperties", params.TtsParams) + pParams.TtsParams.appID = common.getHMIAppId() + common.hmi.getConnection():ExpectRequest("TTS.SetGlobalProperties", pParams.TtsParams) :Do(function(_,data) - self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", {}) + common.hmi.getConnection():SendResponse(data.id, data.method, "SUCCESS", {}) end) - self.mobileSession1:ExpectResponse(cid, { success = true, resultCode = "SUCCESS"}) - self.mobileSession1:ExpectNotification("OnHashChange") + common.mobile.getSession():ExpectResponse(cid, { success = true, resultCode = "SUCCESS"}) + common.mobile.getSession():ExpectNotification("OnHashChange") end -local function ResetGlobalProperties(self) +local function sendResetGlobalProperties() local requesUIparams, requesTTSparams = getResetGlobalPropertiesParams() - local cid = self.mobileSession1:SendRPC("ResetGlobalProperties", { + local cid = common.mobile.getSession():SendRPC("ResetGlobalProperties", { properties = { "VRHELPTITLE", "HELPPROMPT", "TIMEOUTPROMPT", "VRHELPITEMS" } }) - EXPECT_HMICALL("UI.SetGlobalProperties", requesUIparams) + common.hmi.getConnection():ExpectRequest("UI.SetGlobalProperties", requesUIparams) :Do(function(_,data) - self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", {}) + common.hmi.getConnection():SendResponse(data.id, data.method, "SUCCESS", {}) end) - EXPECT_HMICALL("TTS.SetGlobalProperties", requesTTSparams) + common.hmi.getConnection():ExpectRequest("TTS.SetGlobalProperties", requesTTSparams) :Do(function(_,data) - self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", {}) + common.hmi.getConnection():SendResponse(data.id, data.method, "SUCCESS", {}) end) - self.mobileSession1:ExpectResponse(cid, { success = true, resultCode = "SUCCESS"}) - self.mobileSession1:ExpectNotification("OnHashChange") + common.mobile.getSession():ExpectResponse(cid, { success = true, resultCode = "SUCCESS"}) + common.mobile.getSession():ExpectNotification("OnHashChange") 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.rai_n) -runner.Step("Activate App", common.activate_app) +runner.Step("RAI, PTU", common.app.register) +runner.Step("Activate App", common.app.activate) runner.Title("Test") -runner.Step("Send SetGlobalProperties", setGlobalPropertiesSUCCES, { allParams }) +runner.Step("Send SetGlobalProperties", sendSetGlobalProperties, { allParams }) runner.Step("Stop SDL", StopSDL) runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) -runner.Step("RAI, PTU", common.rai_n) -runner.Step("Activate App", common.activate_app) -runner.Step("Send SetGlobalProperties", setGlobalPropertiesSUCCES, { allParams }) -runner.Step("Send ResetGlobalProperties", ResetGlobalProperties) +runner.Step("RAI, PTU", common.app.registerNoPTU) +runner.Step("Activate App", common.app.activate) +runner.Step("Send SetGlobalProperties", sendSetGlobalProperties, { allParams }) +runner.Step("Send ResetGlobalProperties", sendResetGlobalProperties) runner.Title("Postconditions") runner.Step("Stop SDL", common.postconditions)