From 34fd8232c73271ca0d11a636bca88de0565175f9 Mon Sep 17 00:00:00 2001 From: JackLivio Date: Wed, 22 Jul 2020 11:41:13 -0400 Subject: [PATCH 1/3] Add main menu updating tests --- ...01_dynamic_update_capabilities_success.lua | 136 ++++++++++++++++++ .../002_on_update_file_success.lua | 90 ++++++++++++ .../003_on_update_sub_menu_success.lua | 85 +++++++++++ 3 files changed, 311 insertions(+) create mode 100644 test_scripts/API/MainMenuUpdating/001_dynamic_update_capabilities_success.lua create mode 100644 test_scripts/API/MainMenuUpdating/002_on_update_file_success.lua create mode 100644 test_scripts/API/MainMenuUpdating/003_on_update_sub_menu_success.lua diff --git a/test_scripts/API/MainMenuUpdating/001_dynamic_update_capabilities_success.lua b/test_scripts/API/MainMenuUpdating/001_dynamic_update_capabilities_success.lua new file mode 100644 index 0000000000..9f4c2e6620 --- /dev/null +++ b/test_scripts/API/MainMenuUpdating/001_dynamic_update_capabilities_success.lua @@ -0,0 +1,136 @@ +--------------------------------------------------------------------------------------------------- +-- Description: +-- HMI sends capability with DynamicUpdateCapabilities parameter + +-- Pre-conditions: +-- a. HMI and SDL are started +-- b. appID is registered and activated on SDL +-- c. appID is currently in Background, Full or Limited HMI level + +-- Steps: +-- HMI sends DISPLAYS system capability update with Dynamic Update capabilities + +-- Expected: +-- Mobile receives capability update with corrent params. +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/Smoke/commonSmoke') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +--[[ Local Variables ]] +local addSubMenuParams = { + menuLayout = "TILES", + menuID = 44991234, + menuName = "sickMenu" +} + +local setGlobalPropertiesParams = { + menuLayout = "TILES" +} + +local successResponse = { + success = true, + resultCode = "SUCCESS" +} + +local onSystemCapabilityUpdatedParams = { + systemCapability = { + systemCapabilityType = "DISPLAYS", + displayCapabilities = { + { + displayName = "displayName", + windowTypeSupported = { + { + type = "MAIN", + maximumNumberOfWindows = 1 + }, + { + type = "WIDGET", + maximumNumberOfWindows = 2 + } + }, + windowCapabilities = { + { + dynamicUpdateCapabilities = { + supportedDynamicImageFieldNames = {"subMenuIcon", "menuIcon"}, + supportsDynamicSubMenus = true + }, + menuLayoutsAvailable = { "LIST", "TILES" }, + textFields = { + { + name = "mainField1", + characterSet = "TYPE2SET", + width = 1, + rows = 1 + } + }, + imageFields = { + { + name = "choiceImage", + imageTypeSupported = { "GRAPHIC_PNG" + }, + imageResolution = { + resolutionWidth = 35, + resolutionHeight = 35 + } + } + }, + imageTypeSupported = { + "STATIC" + }, + templatesAvailable = { + "Template1", "Template2", "Template3", "Template4", "Template5" + }, + numCustomPresetsAvailable = 100, + buttonCapabilities = { + { + longPressAvailable = true, + name = "VOLUME_UP", + shortPressAvailable = true, + upDownAvailable = false + } + }, + softButtonCapabilities = { + { + shortPressAvailable = true, + longPressAvailable = true, + upDownAvailable = true, + imageSupported = true, + textSupported = true + } + } + } + } + } + } + } +} + +--[[ Local Functions ]] +local function updateDisplayCapabilities() + local mobileSession = common.getMobileSession() + local hmi = common.getHMIConnection() + onSystemCapabilityUpdatedParams.appID = common.getHMIAppId() + hmi:SendNotification("BasicCommunication.OnSystemCapabilityUpdated", onSystemCapabilityUpdatedParams) + + onSystemCapabilityUpdatedParams.appID = nil + mobileSession:ExpectNotification("OnSystemCapabilityUpdated", onSystemCapabilityUpdatedParams) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Update Preloaded PT", common.updatePreloadedPT) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("Sending Dynamic Update Capabilities", updateDisplayCapabilities) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/MainMenuUpdating/002_on_update_file_success.lua b/test_scripts/API/MainMenuUpdating/002_on_update_file_success.lua new file mode 100644 index 0000000000..d3b4dbda84 --- /dev/null +++ b/test_scripts/API/MainMenuUpdating/002_on_update_file_success.lua @@ -0,0 +1,90 @@ +--------------------------------------------------------------------------------------------------- +-- HMI requests a missing cmdIcon be updated from mobile + +-- Pre-conditions: +-- a. HMI and SDL are started +-- b. appID is registered and activated on SDL +-- c. mobile sends an addcommand with an image that does not exist + +-- Steps: +-- User opens the menu, and the hmi sends UI.OnUpdateFile + +-- Expected: +-- Mobile receives notification that the file should be updated +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/Smoke/commonSmoke') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false +local missingFile = "missing_file.png" +local addCommandParams = { + cmdID = 50, + cmdIcon = { + value = missingFile, + imageType = "DYNAMIC" + }, + menuParams = { + position = 4, + menuName = "Command Missing Image" + } +} + +local onSystemContextParams = { + systemContext = "MENU" +} + +local onUpdateFileParams = { + fileName = missingFile +} + +local hmiOnUpdateFileParams = { + fileName = missingFile, + appID = nil +} + + +--[[ Local Functions ]] +local function AddCommandNoImage() + local mobileSession = common.getMobileSession() + local hmi = common.getHMIConnection() + local cid = mobileSession:SendRPC("AddCommand", addCommandParams) + + --hmi side: expect UI.AddCommand request + local hmiCommands = addCommandParams + hmiCommands.cmdIcon.value = common.getPathToFileInStorage(missingFile) + hmi:ExpectRequest("UI.AddCommand", hmiCommands) + :Do(function(_,data) + --hmi side: sending UI.AddCommand response + hmi:SendResponse(data.id, data.method, "SUCCESS", {}) + end) + + --mobile side: expect AddCommand response + mobileSession:ExpectResponse(cid, { success = true, resultCode = "SUCCESS" }) +end + + +local function ShowMenuRequestFile() + local mobileSession = common.getMobileSession() + local hmi = common.getHMIConnection() + hmiOnUpdateFileParams.appID = common.getHMIAppId() + hmi:SendNotification("UI.OnUpdateFile", hmiOnUpdateFileParams) + mobileSession:ExpectNotification("OnUpdateFile", onUpdateFileParams) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Update Preloaded PT", common.updatePreloadedPT) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("Add command with non-existing image", AddCommandNoImage) +runner.Step("Show menu and request File", ShowMenuRequestFile) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) diff --git a/test_scripts/API/MainMenuUpdating/003_on_update_sub_menu_success.lua b/test_scripts/API/MainMenuUpdating/003_on_update_sub_menu_success.lua new file mode 100644 index 0000000000..df655a4f3b --- /dev/null +++ b/test_scripts/API/MainMenuUpdating/003_on_update_sub_menu_success.lua @@ -0,0 +1,85 @@ +--------------------------------------------------------------------------------------------------- +-- HMI requests a subemenu is populated + +-- Pre-conditions: +-- a. HMI and SDL are started +-- b. appID is registered and activated on SDL +-- c. mobile sends an addSubMenu request with no other contents + +-- Steps: +-- User opens the menu, and the hmi sends UI.OnUpdateSubMenu + +-- Expected: +-- Mobile receives notification that the submenu should be updated +--------------------------------------------------------------------------------------------------- + +--[[ Required Shared libraries ]] +local runner = require('user_modules/script_runner') +local common = require('test_scripts/Smoke/commonSmoke') + +--[[ Test Configuration ]] +runner.testSettings.isSelfIncluded = false + +local addSubMenu = { + menuID = 50, + menuName = "Sub Menu" +} + +local addSubMenuHMI = { + menuID = 50, + menuParams = { + menuName = "Sub Menu" + } +} + +local onSystemContextParams = { + systemContext = "MENU" +} + +local onUpdateSubMenu = { + menuID = 50, + updateSubCells = true +} + + +--[[ Local Functions ]] +local function AddSubMenuNoCommands() + local mobileSession = common.getMobileSession() + local hmi = common.getHMIConnection() + local cid = mobileSession:SendRPC("AddSubMenu", addSubMenu) + + --hmi side: expect UI.AddCommand request + hmi:ExpectRequest("UI.AddSubMenu", addSubMenuHMI) + :Do(function(_,data) + --hmi side: sending UI.AddCommand response + hmi:SendResponse(data.id, data.method, "SUCCESS", {}) + end) + + --mobile side: expect AddCommand response + mobileSession:ExpectResponse(cid, { success = true, resultCode = "SUCCESS" }) +end + + +local function ShowMenuRequestCommands() + local mobileSession = common.getMobileSession() + local hmi = common.getHMIConnection() + onUpdateSubMenu.appID = common.getHMIAppId() + hmi:SendNotification("UI.OnUpdateSubMenu", onUpdateSubMenu) + onUpdateSubMenu.appID = nil + mobileSession:ExpectNotification("OnUpdateSubMenu", onUpdateSubMenu) +end + +--[[ Scenario ]] +runner.Title("Preconditions") +runner.Step("Clean environment", common.preconditions) +runner.Step("Update Preloaded PT", common.updatePreloadedPT) +runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) +runner.Step("RAI", common.registerApp) +runner.Step("Activate App", common.activateApp) + +runner.Title("Test") +runner.Step("Add command with non-existing image", AddSubMenuNoCommands) +runner.Step("Show menu and request submenu commands", ShowMenuRequestCommands) + +runner.Title("Postconditions") +runner.Step("Stop SDL", common.postconditions) From 20d86bb2acd25dd2e81c519354a4a25411ceb35a Mon Sep 17 00:00:00 2001 From: JackLivio Date: Wed, 5 Aug 2020 14:53:01 -0400 Subject: [PATCH 2/3] Address comments --- .../001_dynamic_update_capabilities_success.lua | 17 +---------------- .../002_on_update_file_success.lua | 4 ---- .../003_on_update_sub_menu_success.lua | 4 ---- 3 files changed, 1 insertion(+), 24 deletions(-) diff --git a/test_scripts/API/MainMenuUpdating/001_dynamic_update_capabilities_success.lua b/test_scripts/API/MainMenuUpdating/001_dynamic_update_capabilities_success.lua index 9f4c2e6620..13bbbf4591 100644 --- a/test_scripts/API/MainMenuUpdating/001_dynamic_update_capabilities_success.lua +++ b/test_scripts/API/MainMenuUpdating/001_dynamic_update_capabilities_success.lua @@ -11,7 +11,7 @@ -- HMI sends DISPLAYS system capability update with Dynamic Update capabilities -- Expected: --- Mobile receives capability update with corrent params. +-- Mobile receives capability update with correct params. --------------------------------------------------------------------------------------------------- --[[ Required Shared libraries ]] @@ -22,21 +22,6 @@ local common = require('test_scripts/Smoke/commonSmoke') runner.testSettings.isSelfIncluded = false --[[ Local Variables ]] -local addSubMenuParams = { - menuLayout = "TILES", - menuID = 44991234, - menuName = "sickMenu" -} - -local setGlobalPropertiesParams = { - menuLayout = "TILES" -} - -local successResponse = { - success = true, - resultCode = "SUCCESS" -} - local onSystemCapabilityUpdatedParams = { systemCapability = { systemCapabilityType = "DISPLAYS", diff --git a/test_scripts/API/MainMenuUpdating/002_on_update_file_success.lua b/test_scripts/API/MainMenuUpdating/002_on_update_file_success.lua index d3b4dbda84..ec0fe3465d 100644 --- a/test_scripts/API/MainMenuUpdating/002_on_update_file_success.lua +++ b/test_scripts/API/MainMenuUpdating/002_on_update_file_success.lua @@ -32,10 +32,6 @@ local addCommandParams = { } } -local onSystemContextParams = { - systemContext = "MENU" -} - local onUpdateFileParams = { fileName = missingFile } diff --git a/test_scripts/API/MainMenuUpdating/003_on_update_sub_menu_success.lua b/test_scripts/API/MainMenuUpdating/003_on_update_sub_menu_success.lua index df655a4f3b..2c61baa5e0 100644 --- a/test_scripts/API/MainMenuUpdating/003_on_update_sub_menu_success.lua +++ b/test_scripts/API/MainMenuUpdating/003_on_update_sub_menu_success.lua @@ -32,10 +32,6 @@ local addSubMenuHMI = { } } -local onSystemContextParams = { - systemContext = "MENU" -} - local onUpdateSubMenu = { menuID = 50, updateSubCells = true From 1b84d39acdcb0e2a2f10b1d038af8f57a3af4565 Mon Sep 17 00:00:00 2001 From: JackLivio Date: Tue, 18 Aug 2020 15:37:24 -0400 Subject: [PATCH 3/3] Add test set --- test_sets/main_menu_updating_and_pagination.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 test_sets/main_menu_updating_and_pagination.txt diff --git a/test_sets/main_menu_updating_and_pagination.txt b/test_sets/main_menu_updating_and_pagination.txt new file mode 100644 index 0000000000..aa66ebf405 --- /dev/null +++ b/test_sets/main_menu_updating_and_pagination.txt @@ -0,0 +1,3 @@ +./test_scripts/API/MainMenuUpdating/001_dynamic_update_capabilities_success.lua +./test_scripts/API/MainMenuUpdating/003_on_update_sub_menu_success.lua +./test_scripts/API/MainMenuUpdating/002_on_update_file_success.lua