-
Notifications
You must be signed in to change notification settings - Fork 60
Add tests for additional submenus and driver distraction #2428
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
Merged
Jack-Byrne
merged 15 commits into
develop
from
feature/additional_submenus_and_dd_limits
Aug 7, 2020
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
3df83ea
Add tests for additional submenus and driver distraction systemCapabi…
Jack-Byrne 06b38fa
Add test set
Jack-Byrne c93d966
Address comments and add extra test cases
Jack-Byrne 76a9e02
Fix test cases
Jack-Byrne bc5294b
Remove 7.0 declarations in each test
Jack-Byrne eb71cff
Update test_scripts/API/Additional_Submenus/004_delete_top_level_subm…
Jack-Byrne 3df62c7
Address comments
Jack-Byrne f83d153
Merge branch 'feature/additional_submenus_and_dd_limits' of github.co…
Jack-Byrne 3bf3e47
Apply suggestions from code review
Jack-Byrne 6f74823
Address comments
Jack-Byrne bc93611
Update test_scripts/API/Additional_Submenus/additional_submenus_commo…
Jack-Byrne 132e2a7
Create hmi params from mobile params
Jack-Byrne 1cbd71f
Fix parentPresent
Jack-Byrne 8e3cef9
Apply suggestions from code review
Jack-Byrne 52aad11
Refactor again
Jack-Byrne 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
42 changes: 42 additions & 0 deletions
42
test_scripts/API/Additional_Submenus/001_additional_submenu_success.lua
This file contains hidden or 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,42 @@ | ||
| --------------------------------------------------------------------------------------------------- | ||
| -- Proposal: | ||
| -- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0148-template-additional-submenus.md#backwards-compatibility | ||
| -- Description: Tests sending a parentID param in a AddSubMenu request | ||
| -- In case: | ||
| -- 1) Mobile application is set to appropriate HMI level and System Context MENU, MAIN | ||
| -- 2) Mobile application sends AddSubMenu SubMenu with menuID = 1 | ||
| -- 3) Mobile sends additional AddSubMenu request with menuID = 99 and parentID = 1 | ||
| -- SDL does: | ||
| -- 1) Sends AddSubMenu requests to HMI with parentID in menu params | ||
| --------------------------------------------------------------------------------------------------- | ||
| -- [[ Required Shared libraries ]] | ||
| local runner = require('user_modules/script_runner') | ||
| local common = require('test_scripts/API/Additional_Submenus/additional_submenus_common') | ||
|
|
||
| -- [[ Test Configuration ]] | ||
| runner.testSettings.isSelfIncluded = false | ||
|
|
||
| --[[ Local Variables ]] | ||
| local requestParams = { | ||
| common.reqParams.AddSubMenu.mob, | ||
| { | ||
| menuID = 99, | ||
| menuName = "SubMenu2", | ||
| parentID = 1 | ||
| } | ||
| } | ||
|
|
||
| --[[ Scenario ]] | ||
| runner.Title("Preconditions") | ||
| runner.Step("Clean environment", common.preconditions) | ||
| runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) | ||
| runner.Step("App registration", common.registerApp) | ||
|
|
||
| runner.Title("Test") | ||
| runner.Step("App activate, HMI SystemContext MAIN", common.activateApp) | ||
| for i, _ in ipairs(requestParams) do | ||
| runner.Step("Add submenu", common.addSubMenu, { requestParams[i] }) | ||
| end | ||
|
|
||
| runner.Title("Postconditions") | ||
| runner.Step("Stop SDL", common.postconditions) | ||
47 changes: 47 additions & 0 deletions
47
test_scripts/API/Additional_Submenus/002_legacy_app_parentID_filtered.lua
This file contains hidden or 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,47 @@ | ||
| --------------------------------------------------------------------------------------------------- | ||
| -- Proposal: | ||
| -- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0148-template-additional-submenus.md#backwards-compatibility | ||
| -- Description: Tests sending a parentID param in a AddSubMenu request with a legacy RPC spec version | ||
| -- In case: | ||
| -- 1) Mobile application is set to appropriate HMI level and System Context MENU, MAIN | ||
| -- 2) Mobile application sends AddSubMenu SubMenu with menuID = 1 | ||
| -- 3) Mobile sends additional AddSubMenu request with menuID = 99 and parentID = 1 | ||
| -- SDL does: | ||
| -- 1) Sends AddSubMenu requests to HMI with no parentID included in the requests | ||
| --------------------------------------------------------------------------------------------------- | ||
| -- [[ Required Shared libraries ]] | ||
| local runner = require('user_modules/script_runner') | ||
| local common = require('test_scripts/API/Additional_Submenus/additional_submenus_common') | ||
|
|
||
| -- [[ Test Configuration ]] | ||
| runner.testSettings.isSelfIncluded = false | ||
| config.application1.registerAppInterfaceParams.syncMsgVersion = { | ||
| majorVersion = 6, | ||
| minorVersion = 0 | ||
| } | ||
|
|
||
| --[[ Local Variables ]] | ||
| local requestParams = { | ||
| common.reqParams.AddSubMenu.mob, | ||
| { | ||
| menuID = 99, | ||
| menuName = "SubMenu2", | ||
| parentID = 1 | ||
| } | ||
| } | ||
|
|
||
|
|
||
| --[[ Scenario ]] | ||
| runner.Title("Preconditions") | ||
| runner.Step("Clean environment", common.preconditions) | ||
| runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) | ||
| runner.Step("App registration", common.registerApp) | ||
|
|
||
| runner.Title("Test") | ||
| runner.Step("App activate, HMI SystemContext MAIN", common.activateApp) | ||
| for i, _ in ipairs(requestParams) do | ||
| runner.Step("Add submenu", common.addSubMenu, { requestParams[i] }) | ||
| end | ||
|
|
||
| runner.Title("Postconditions") | ||
| runner.Step("Stop SDL", common.postconditions) | ||
jacobkeeler marked this conversation as resolved.
Show resolved
Hide resolved
|
||
93 changes: 93 additions & 0 deletions
93
...ts/API/Additional_Submenus/003_delete_nested_submenu_with_nested_submenu_and_commands.lua
This file contains hidden or 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,93 @@ | ||
| --------------------------------------------------------------------------------------------------- | ||
| -- Proposal: | ||
| -- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0148-template-additional-submenus.md#backwards-compatibility | ||
| -- Description: Tests sending a parentID param in a AddSubMenu request | ||
| -- In case: | ||
| -- 1) Mobile application is set to appropriate HMI level and System Context MENU, MAIN | ||
| -- 2) Mobile application sends 3 AddSubMenu requests where each submenu is nested in the previous submenu | ||
| -- 3) Mobile sends 2 Add Command requests to populate the nested submenus | ||
| -- 4) Mobile requests to delete a nested submenu | ||
| -- SDL does: | ||
| -- 1) Sends DeleteSubmenu and DeleteCommand requests for the request submenu and all contents under that submenu | ||
| --------------------------------------------------------------------------------------------------- | ||
| -- [[ Required Shared libraries ]] | ||
| local runner = require('user_modules/script_runner') | ||
| local common = require('test_scripts/API/Additional_Submenus/additional_submenus_common') | ||
|
|
||
| -- [[ Test Configuration ]] | ||
| runner.testSettings.isSelfIncluded = false | ||
|
|
||
| --[[ Local Variables ]] | ||
| local menuIDs = {1, 99, 101} | ||
| local cmdIDs = {44, 45} | ||
| local mobileAddSubMenuRequestParams = { | ||
| common.reqParams.AddSubMenu.mob, | ||
| { | ||
| menuID = menuIDs[2], | ||
| menuName = "SubMenu2", | ||
| parentID = menuIDs[1] | ||
| }, | ||
| { | ||
| menuID = menuIDs[3], | ||
| menuName = "SubMenu3", | ||
| parentID = menuIDs[2] | ||
| } | ||
| } | ||
|
|
||
| local mobileAddCommandRequestParams = { | ||
| { | ||
| cmdID = cmdIDs[1], | ||
| menuParams = { | ||
| parentID = mobileAddSubMenuRequestParams[2].menuID, | ||
| menuName = "Add Command 1" | ||
| } | ||
| }, | ||
| { | ||
| cmdID = cmdIDs[2], | ||
| menuParams = { | ||
| parentID = mobileAddSubMenuRequestParams[3].menuID, | ||
| menuName = "Add Command 2" | ||
| } | ||
| } | ||
| } | ||
|
|
||
| local mobileDeleteSubMenuRequestParams = { | ||
| menuID = menuIDs[2] | ||
| } | ||
|
|
||
| local hmiDeleteSubMenuRequestParams = { | ||
| { | ||
| menuID = mobileAddSubMenuRequestParams[3].menuID | ||
| }, | ||
| { | ||
| menuID = mobileAddSubMenuRequestParams[2].menuID | ||
| } | ||
| } | ||
|
|
||
| local hmiDeleteCommandRequestParams = { | ||
| { | ||
| cmdID = mobileAddCommandRequestParams[1].cmdID | ||
| }, | ||
| { | ||
| cmdID = mobileAddCommandRequestParams[2].cmdID | ||
| } | ||
| } | ||
|
|
||
| --[[ Scenario ]] | ||
| runner.Title("Preconditions") | ||
| runner.Step("Clean environment", common.preconditions) | ||
| runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) | ||
| runner.Step("App registration", common.registerApp) | ||
|
|
||
| runner.Title("Test") | ||
| runner.Step("App activate, HMI SystemContext MAIN", common.activateApp) | ||
| for i, _ in ipairs(mobileAddSubMenuRequestParams) do | ||
| runner.Step("Add additional submenu", common.addSubMenu, { mobileAddSubMenuRequestParams[i] }) | ||
| end | ||
| for i, _ in ipairs(mobileAddCommandRequestParams) do | ||
| runner.Step("Add Commands to nested submenus", common.addCommand, { mobileAddCommandRequestParams[i] }) | ||
| end | ||
| runner.Step("Send DeleteSubMenu", common.DeleteSubMenu, {mobileDeleteSubMenuRequestParams, hmiDeleteCommandRequestParams, hmiDeleteSubMenuRequestParams}) | ||
|
|
||
| runner.Title("Postconditions") | ||
| runner.Step("Stop SDL", common.postconditions) |
96 changes: 96 additions & 0 deletions
96
...PI/Additional_Submenus/004_delete_top_level_submenu_with_nested_submenus_and_commands.lua
This file contains hidden or 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,96 @@ | ||
| --------------------------------------------------------------------------------------------------- | ||
| -- Proposal: | ||
| -- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0148-template-additional-submenus.md#backwards-compatibility | ||
| -- Description: Tests sending a parentID param in a AddSubMenu request | ||
| -- In case: | ||
| -- 1) Mobile application is set to appropriate HMI level and System Context MENU, MAIN | ||
| -- 2) Mobile application sends 3 AddSubMenu requests where each submenu is nested in the previous submenu | ||
| -- 3) Mobile sends 2 Add Command requests to populate the nested submenus | ||
| -- 4) Mobile requests to delete the top level submenu | ||
| -- SDL does: | ||
| -- 1) Sends DeleteSubmenu and DeleteCommand requests for the requested submenu and all contents under that submenu | ||
| --------------------------------------------------------------------------------------------------- | ||
| -- [[ Required Shared libraries ]] | ||
| local runner = require('user_modules/script_runner') | ||
| local common = require('test_scripts/API/Additional_Submenus/additional_submenus_common') | ||
|
|
||
| -- [[ Test Configuration ]] | ||
| runner.testSettings.isSelfIncluded = false | ||
|
|
||
| --[[ Local Variables ]] | ||
| local menuIDs = { 1, 99, 101 } | ||
| local cmdIDs = { 44, 45 } | ||
| local mobileAddSubMenuRequestParams = { | ||
| common.reqParams.AddSubMenu.mob, | ||
| { | ||
| menuID = menuIDs[2], | ||
| menuName = "SubMenu2", | ||
| parentID = menuIDs[1] | ||
| }, | ||
| { | ||
| menuID = menuIDs[3], | ||
| menuName = "SubMenu3", | ||
| parentID = menuIDs[2] | ||
| } | ||
| } | ||
|
|
||
| local mobileAddCommandRequestParams = { | ||
| { | ||
| cmdID = cmdIDs[1], | ||
| menuParams = { | ||
| parentID = mobileAddSubMenuRequestParams[2].menuID, | ||
| menuName = "Add Command 1" | ||
| } | ||
| }, | ||
| { | ||
| cmdID = cmdIDs[2], | ||
| menuParams = { | ||
| parentID = mobileAddSubMenuRequestParams[3].menuID, | ||
| menuName = "Add Command 2" | ||
| } | ||
| } | ||
| } | ||
|
|
||
| local mobileDeleteSubMenuRequestParams = { | ||
| menuID = menuIDs[1] | ||
| } | ||
|
|
||
| local hmiDeleteSubMenuRequestParams = { | ||
| { | ||
| menuID = mobileAddSubMenuRequestParams[2].menuID | ||
| }, | ||
| { | ||
| menuID = mobileAddSubMenuRequestParams[3].menuID | ||
| }, | ||
| { | ||
| menuID = mobileDeleteSubMenuRequestParams.menuID | ||
| } | ||
| } | ||
|
|
||
| local hmiDeleteCommandRequestParams = { | ||
| { | ||
| cmdID = mobileAddCommandRequestParams[1].cmdID | ||
| }, | ||
| { | ||
| cmdID = mobileAddCommandRequestParams[2].cmdID | ||
| } | ||
| } | ||
|
|
||
| --[[ Scenario ]] | ||
| runner.Title("Preconditions") | ||
| runner.Step("Clean environment", common.preconditions) | ||
| runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) | ||
| runner.Step("App registration", common.registerApp) | ||
|
|
||
| runner.Title("Test") | ||
| runner.Step("App activate, HMI SystemContext MAIN", common.activateApp) | ||
| for i, _ in ipairs(mobileAddSubMenuRequestParams) do | ||
| runner.Step("Add additional submenu", common.addSubMenu, { mobileAddSubMenuRequestParams[i] }) | ||
| end | ||
| for i, _ in ipairs(mobileAddCommandRequestParams) do | ||
| runner.Step("Add Commands to nested submenus", common.addCommand, { mobileAddCommandRequestParams[i] }) | ||
| end | ||
| runner.Step("Send DeleteSubMenu", common.DeleteSubMenu, {mobileDeleteSubMenuRequestParams, hmiDeleteCommandRequestParams, hmiDeleteSubMenuRequestParams}) | ||
|
|
||
| runner.Title("Postconditions") | ||
| runner.Step("Stop SDL", common.postconditions) |
48 changes: 48 additions & 0 deletions
48
test_scripts/API/Additional_Submenus/005_duplicate_name_different_level_success.lua
This file contains hidden or 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,48 @@ | ||
| --------------------------------------------------------------------------------------------------- | ||
| -- Proposal: | ||
| -- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0148-template-additional-submenus.md#backwards-compatibility | ||
| -- Description: Tests sending a parentID param in a AddSubMenu request | ||
| -- In case: | ||
| -- 1) Mobile application is set to appropriate HMI level and System Context MENU, MAIN | ||
| -- 2) Mobile application sends AddSubMenu SubMenu with menuID = 1 | ||
| -- 3) Mobile sends additional AddSubMenu requests where a nested submenu has the same menu name as its parent menu | ||
| -- SDL does: | ||
| -- 1) Sends AddSubMenu requests to HMI with parentID in menu params | ||
| --------------------------------------------------------------------------------------------------- | ||
| -- [[ Required Shared libraries ]] | ||
| local runner = require('user_modules/script_runner') | ||
| local common = require('test_scripts/API/Additional_Submenus/additional_submenus_common') | ||
|
|
||
| -- [[ Test Configuration ]] | ||
| runner.testSettings.isSelfIncluded = false | ||
|
|
||
| --[[ Local Variables ]] | ||
| local menuIDs = { 1, 99, 101 } | ||
| local mobileAddSubMenuRequestParams = { | ||
| common.reqParams.AddSubMenu.mob, | ||
| { | ||
| menuID = menuIDs[2], | ||
| menuName = "SubMenu2", | ||
| parentID = menuIDs[1] | ||
| }, | ||
| { | ||
| menuID = menuIDs[3], | ||
| menuName = "SubMenu2", | ||
| parentID = menuIDs[2] | ||
| } | ||
| } | ||
|
|
||
| --[[ Scenario ]] | ||
| runner.Title("Preconditions") | ||
| runner.Step("Clean environment", common.preconditions) | ||
| runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) | ||
| runner.Step("App registration", common.registerApp) | ||
|
|
||
| runner.Title("Test") | ||
| runner.Step("App activate, HMI SystemContext MAIN", common.activateApp) | ||
| for i, _ in ipairs(mobileAddSubMenuRequestParams) do | ||
| runner.Step("Add submenu", common.addSubMenu, { mobileAddSubMenuRequestParams[i] }) | ||
| end | ||
|
|
||
| runner.Title("Postconditions") | ||
| runner.Step("Stop SDL", common.postconditions) |
54 changes: 54 additions & 0 deletions
54
test_scripts/API/Additional_Submenus/006_duplicate_name_same_level_fail.lua
This file contains hidden or 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,54 @@ | ||
| --------------------------------------------------------------------------------------------------- | ||
| -- Proposal: | ||
| -- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0148-template-additional-submenus.md#backwards-compatibility | ||
| -- Description: Tests sending a parentID param in a AddSubMenu request | ||
| -- In case: | ||
| -- 1) Mobile application is set to appropriate HMI level and System Context MENU, MAIN | ||
| -- 2) Mobile application sends AddSubMenu SubMenu with menuID = 1 | ||
| -- 3) Mobile sends additional AddSubMenu requests where two submenus at the same level have a duplicate menuName | ||
| -- SDL does: | ||
| -- 1) Fails the request with result code DUPLICATE_NAME | ||
| --------------------------------------------------------------------------------------------------- | ||
| -- [[ Required Shared libraries ]] | ||
| local runner = require('user_modules/script_runner') | ||
| local common = require('test_scripts/API/Additional_Submenus/additional_submenus_common') | ||
|
|
||
| -- [[ Test Configuration ]] | ||
| runner.testSettings.isSelfIncluded = false | ||
|
|
||
| --[[ Local Variables ]] | ||
| local requestParams = { | ||
| common.reqParams.AddSubMenu.mob, | ||
| { | ||
| menuID = 99, | ||
| menuName = "SubMenu2", | ||
| parentID = 1 | ||
| } | ||
| } | ||
|
|
||
| local duplicateNameRequestParams = { | ||
| menuID = 101, | ||
| menuName = requestParams[2].menuName, | ||
| parentID = requestParams[2].parentID | ||
| } | ||
|
|
||
| local function DuplicateNameMenu() | ||
| local cid = common.getMobileSession():SendRPC("AddSubMenu", duplicateNameRequestParams) | ||
| common.getMobileSession():ExpectResponse(cid, { success = false, resultCode = "DUPLICATE_NAME" }) | ||
| end | ||
|
|
||
| --[[ Scenario ]] | ||
| runner.Title("Preconditions") | ||
| runner.Step("Clean environment", common.preconditions) | ||
| runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) | ||
| runner.Step("App registration", common.registerApp) | ||
|
|
||
| runner.Title("Test") | ||
| runner.Step("App activate, HMI SystemContext MAIN", common.activateApp) | ||
| for i, _ in ipairs(requestParams) do | ||
| runner.Step("Add submenu", common.addSubMenu, { requestParams[i] }) | ||
| end | ||
| runner.Step("Duplicate Name SubMenu", DuplicateNameMenu) | ||
|
|
||
| runner.Title("Postconditions") | ||
| runner.Step("Stop SDL", common.postconditions) |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.