-
Notifications
You must be signed in to change notification settings - Fork 60
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 main menu updating tests #2435
Merged
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
121 changes: 121 additions & 0 deletions
121
test_scripts/API/MainMenuUpdating/001_dynamic_update_capabilities_success.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
--------------------------------------------------------------------------------------------------- | ||
-- 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 correct 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 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) |
86 changes: 86 additions & 0 deletions
86
test_scripts/API/MainMenuUpdating/002_on_update_file_success.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
--------------------------------------------------------------------------------------------------- | ||
-- 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 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) |
81 changes: 81 additions & 0 deletions
81
test_scripts/API/MainMenuUpdating/003_on_update_sub_menu_success.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
--------------------------------------------------------------------------------------------------- | ||
-- 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 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) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i like how you added
appID = nil
on the other notification that it is added dynamically to