Skip to content

Commit

Permalink
Feature/same app from multiple devices (#2202)
Browse files Browse the repository at this point in the history
* Update user modules for support multiple mobile devices

* Add common module for the same app from multiple devices feature

* Add Registration related scripts for the same app from multiple devices feature

* Add HMI levels related scripts for the same app from multiple devices feature

* Add Protocol related scripts for the same app from multiple devices feature

* Add Subscriptions related scripts for the same app from multiple devices feature

* Add RC related scripts for the same app from multiple devices feature

* Add Security related scripts for the same app from multiple devices feature

* Add Resumption related scripts for the same app from multiple devices feature

* Add NicknameValidation related scripts for the same app from multiple devices feature

* Add FunctionalGroups related scripts for the same app from multiple devices feature

* Add User consent related scripts for the same app from multiple devices feature

* Add Counters validation related scripts for the same app from multiple devices feature

* Add test set for the same app from multiple devices feature

* Update RC common module for backward compatibility
  • Loading branch information
aderiabin authored and ShobhitAd committed Aug 16, 2019
1 parent fe1ec84 commit b2d70d1
Show file tree
Hide file tree
Showing 89 changed files with 10,312 additions and 246 deletions.
8 changes: 6 additions & 2 deletions test_scripts/RC/commonRC.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ commonRC.getHMIConnection = actions.getHMIConnection
commonRC.getMobileSession = actions.getMobileSession
commonRC.policyTableUpdate = actions.policyTableUpdate
commonRC.registerApp = actions.registerApp
commonRC.registerAppWOPTU = actions.registerAppWOPTU
commonRC.getHMIAppId = actions.getHMIAppId
commonRC.jsonFileToTable = utils.jsonFileToTable
commonRC.tableToJsonFile = utils.tableToJsonFile
Expand Down Expand Up @@ -85,6 +84,10 @@ commonRC.LightsNameList = { "FRONT_LEFT_HIGH_BEAM", "FRONT_RIGHT_HIGH_BEAM", "FR
commonRC.readOnlyLightStatus = { "RAMP_UP", "RAMP_DOWN", "UNKNOWN", "INVALID" }

--[[ Common Functions ]]
function commonRC.registerAppWOPTU(pAppId, self)
return actions.registerAppWOPTU(pAppId)
end

function commonRC.getRCAppConfig(tbl)
if tbl then
local out = commonRC.cloneTable(tbl.policy_table.app_policies.default)
Expand All @@ -105,7 +108,7 @@ function commonRC.getRCAppConfig(tbl)
end
end

function actions.getAppDataForPTU(pAppId)
function actions.ptu.getAppData(pAppId)
return {
keep_context = false,
steal_focus = false,
Expand All @@ -125,6 +128,7 @@ local function allowSDL()
name = utils.getDeviceName()
}
})
actions.run.wait(500) -- stabilization delay
end

function commonRC.start(pHMIParams)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
---------------------------------------------------------------------------------------------------
-- Proposal:
-- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0204-same-app-from-multiple-devices.md
-- Description:
-- Register two mobile applications with the same appNames and same appIDs from different mobile devices.
-- The value of "appHMIType" field is set to "DEFAULT" for these applications.
-- Set different HMI levels for applications, send OnHMIStatus notification to SDL and check that SDL does not send it
-- to the App if it is in NONE HMI level. And if not, check whether the value of "hmiLevel" parameter of the
-- notification corresponds to the current HMI level of the application.
--
-- Precondition:
-- 1) SDL and HMI are started
-- 2) Mobile №1 and №2 are connected to SDL
-- 3) App 1 (isMediaApplication = false, appID = 0000001, appName = "Test Application1") is registered from Mobile №1
-- 4) App 2 (isMediaApplication = false, appID = 0000001, appName = "Test Application1") is registered from Mobile №2
--
-- Steps:
-- 1)Activate Application 2
-- Check:
-- SDL sends OnHMIStatus( hmiLevel = FULL ) to Mobile №2
-- SDL does NOT send OnHMIStatus to Mobile №1
-- 2)Activate Application 1
-- Check:
-- SDL sends OnHMIStatus( hmiLevel = BACKGROUND ) to Mobile №2
-- SDL sends OnHMIStatus( hmiLevel = FULL ) to Mobile №1
-- 3)Deactivate Application 1
-- Check:
-- SDL does NOT send OnHMIStatus to Mobile №2
-- SDL sends OnHMIStatus( hmiLevel = BACKGROUND ) to Mobile №1
-- 4)Exit Application 1
-- Check:
-- SDL does NOT send OnHMIStatus to Mobile №2
-- SDL sends OnHMIStatus( hmiLevel = NONE ) to Mobile №1
-- 5)Activate Application 1 once again
-- Check:
-- SDL does NOT send OnHMIStatus to Mobile №2
-- SDL sends OnHMIStatus( hmiLevel = FULL ) to Mobile №1
---------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local common = require('test_scripts/TheSameApp/commonTheSameApp')

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

--[[ Local Data ]]
local devices = {
[1] = { host = "1.0.0.1", port = config.mobilePort },
[2] = { host = "192.168.100.199", port = config.mobilePort },
}

local appParams = {
[1] = {
appName = "Test Application1",
isMediaApplication = false,
appHMIType = { "DEFAULT" },
appID = "0001",
fullAppID = "0000001",
}
}

--[[ Local Functions ]]
local function activateApp2()
common.mobile.getSession(1):ExpectNotification("OnHMIStatus"):Times(0)
common.app.activate(2)
end

local function activateApp1()
common.mobile.getSession(2):ExpectNotification("OnHMIStatus",
{ hmiLevel = "BACKGROUND", audioStreamingState = "NOT_AUDIBLE", systemContext = "MAIN" })
common.app.activate(1)
end

local function deactivateApp1()
common.mobile.getSession(2):ExpectNotification("OnHMIStatus"):Times(0)
common.deactivateApp(1, { hmiLevel = "BACKGROUND", audioStreamingState = "NOT_AUDIBLE", systemContext = "MAIN" })
end

local function exitApp1()
common.mobile.getSession(2):ExpectNotification("OnHMIStatus"):Times(0)
common.exitApp(1)
end

local function reActivateApp1()
common.mobile.getSession(2):ExpectNotification("OnHMIStatus"):Times(0)
common.app.activate(1)
end

--[[ Scenario ]]
runner.Title("Preconditions")
runner.Step("Clean environment", common.preconditions)
runner.Step("Start SDL and HMI", common.start)
runner.Step("Connect two mobile devices to SDL", common.connectMobDevices, {devices})
runner.Step("Register App 1 from Device 1", common.registerAppEx, {1, appParams[1], 1})
runner.Step("Register App 1 from device 2", common.registerAppEx, {2, appParams[1], 2})

runner.Title("Test")
runner.Step("Activate App 1 from Device 2", activateApp2)
runner.Step("Activate App 1 from Device 1", activateApp1)
runner.Step("Deactivate App 1 from Device 1", deactivateApp1)
runner.Step("Exit App 1 from Device 1", exitApp1)
runner.Step("Activate App 1 from Device 1 again", reActivateApp1)

runner.Title("Postconditions")
runner.Step("Remove mobile devices", common.clearMobDevices, {devices})
runner.Step("Stop SDL", common.postconditions)
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
---------------------------------------------------------------------------------------------------
-- Proposal:
-- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0204-same-app-from-multiple-devices.md
-- Description:
-- Register two mobile applications with the same appNames and different appIDs from different mobile devices.
-- The value of "appHMIType" field is set to "DEFAULT" for these applications.
-- Set different HMI levels for applications, send OnHMIStatus notification to SDL and check that SDL does not send it
-- to the App if it is in NONE HMI level. And if not, check whether the value of "hmiLevel" parameter of the
-- notification corresponds to the current HMI level of the application.
--
-- Precondition:
-- 1)SDL and HMI are started
-- 2)Mobile №1 and №2 are connected to SDL
-- 3)App 1 (isMediaApplication = false, appID = 0000001, appName = "Test Application1") is registered from Mobile №1
-- 4)App 2 (isMediaApplication = false, appID = 00000022, appName = "Test Application1") is registered from Mobile №2
--
-- Steps:
-- 1)Activate Application 1
-- Check:
-- SDL sends OnHMIStatus( hmiLevel = FULL ) to Mobile №1
-- SDL does NOT send OnHMIStatus to Mobile №2
-- 2)Activate Application 2
-- Check:
-- SDL sends OnHMIStatus( hmiLevel = BACKGROUND ) to Mobile №1
-- SDL sends OnHMIStatus( hmiLevel = FULL ) to Mobile №2
-- 3)Deactivate Application 2
-- Check:
-- SDL does NOT send OnHMIStatus to Mobile №1
-- SDL sends OnHMIStatus( hmiLevel = BACKGROUND ) to Mobile №2
-- 4)Exit Application 2
-- Check:
-- SDL does NOT send OnHMIStatus to Mobile №1
-- SDL sends OnHMIStatus( hmiLevel = NONE ) to Mobile №2
-- 5)Activate Application 2 once again
-- Check:
-- SDL does NOT send OnHMIStatus to Mobile №1
-- SDL sends OnHMIStatus( hmiLevel = FULL ) to Mobile №2
---------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local common = require('test_scripts/TheSameApp/commonTheSameApp')

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

--[[ Local Data ]]
local devices = {
[1] = { host = "1.0.0.1", port = config.mobilePort },
[2] = { host = "192.168.100.199", port = config.mobilePort },
}

local appParams = {
[1] = {
appName = "Test Application1",
isMediaApplication = false,
appHMIType = { "DEFAULT" },
appID = "0001",
fullAppID = "0000001",
},
[2] = {
appName = "Test Application1",
isMediaApplication = false,
appHMIType = { "DEFAULT" },
appID = "00022",
fullAppID = "00000022",
},
}

--[[ Local Functions ]]
local function activateApp1()
common.mobile.getSession(2):ExpectNotification("OnHMIStatus"):Times(0)
common.app.activate(1)
end

local function activateApp2()
common.mobile.getSession(1):ExpectNotification("OnHMIStatus",
{ hmiLevel = "BACKGROUND", audioStreamingState = "NOT_AUDIBLE", systemContext = "MAIN" })
common.app.activate(2)
end

local function deactivateApp2()
common.mobile.getSession(1):ExpectNotification("OnHMIStatus"):Times(0)
common.deactivateApp(2, { hmiLevel = "BACKGROUND", audioStreamingState = "NOT_AUDIBLE", systemContext = "MAIN" })
end

local function exitApp2()
common.mobile.getSession(1):ExpectNotification("OnHMIStatus"):Times(0)
common.exitApp(2)
end

local function reActivateApp2()
common.mobile.getSession(1):ExpectNotification("OnHMIStatus"):Times(0)
common.app.activate(2)
end

--[[ Scenario ]]
runner.Title("Preconditions")
runner.Step("Clean environment", common.preconditions)
runner.Step("Start SDL and HMI", common.start)
runner.Step("Connect two mobile devices to SDL", common.connectMobDevices, {devices})
runner.Step("Register App 1 from Device 1", common.registerAppEx, {1, appParams[1], 1})
runner.Step("Register App 2 from Device 2 (app name the same as from App 1)", common.registerAppEx, {2, appParams[2], 2})

runner.Title("Test")
runner.Step("Activate App 1 from Device 1", activateApp1)
runner.Step("Activate App 2 from Device 2", activateApp2)
runner.Step("Deactivate App 2 from Device 2", deactivateApp2)
runner.Step("Exit App 2 from Device 2", exitApp2)
runner.Step("Activate App 2 from Device 2 again", reActivateApp2)

runner.Title("Postconditions")
runner.Step("Remove mobile devices", common.clearMobDevices, {devices})
runner.Step("Stop SDL", common.postconditions)
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
---------------------------------------------------------------------------------------------------
-- Proposal:
-- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0204-same-app-from-multiple-devices.md
-- Description:
-- Register two mobile applications with the same appName and same appID from different mobile devices.
-- The value of "appHMIType" field is set to "MEDIA" for these applications.
-- Set different HMI levels for applications, send OnHMIStatus notification to SDL and check that SDL does not send it
-- to the App if it is in NONE HMI level. And if not, check whether the value of "hmiLevel" parameter of the
-- notification corresponds to the current HMI level of the application.
--
-- Precondition:
-- 1)SDL and HMI are started
-- 2)Mobile №1 and №2 are connected to SDL
-- 3)App 1 (isMediaApplication = false, appID = 0000001, appName = "Test Application1") is registered from Mobile №1
-- 4)App 2 (isMediaApplication = false, appID = 0000001, appName = "Test Application1") is registered from Mobile №2
--
-- Steps:
-- 1)Activate Application 2
-- CheckSDL:
-- SDL sends OnHMIStatus( hmiLevel = FULL ) to Mobile №2
-- SDL does NOT send OnHMIStatus to Mobile №1
-- 2)Activate Application 1
-- Check:
-- SDL sends OnHMIStatus( hmiLevel = BACKGROUND ) to Mobile №2
-- SDL sends OnHMIStatus( hmiLevel = FULL ) to Mobile №1
-- 3)Deactivate Application 1
-- Check:
-- SDL does NOT send OnHMIStatus to Mobile №2
-- SDL sends OnHMIStatus( hmiLevel = LIMITED ) to Mobile №1
-- 4)Activate Application 2 once again
-- Check:
-- SDL sends OnHMIStatus( hmiLevel = FULL ) to Mobile №2
-- SDL sends OnHMIStatus( hmiLevel = BACKGROUND ) to Mobile №1
-- 5)Deactivate Application 2
-- Check:
-- SDL sends OnHMIStatus( hmiLevel = LIMITED ) to Mobile №2
-- SDL does NOT send OnHMIStatus to Mobile №1
-- 6)Exit Application 1
-- Check:
-- SDL does NOT send OnHMIStatus to Mobile №2
-- SDL sends OnHMIStatus( hmiLevel = NONE ) to Mobile №1
-- 7)Activate Application 1
-- Check:
-- SDL sends OnHMIStatus( hmiLevel = BACKGROUND ) to Mobile №2
-- SDL sends OnHMIStatus( hmiLevel = FULL ) to Mobile №1
---------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local common = require('test_scripts/TheSameApp/commonTheSameApp')

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

--[[ Local Data ]]
local devices = {
[1] = { host = "1.0.0.1", port = config.mobilePort },
[2] = { host = "192.168.100.199", port = config.mobilePort },
}

local appParams = {
[1] = {
appName = "Test Application1",
isMediaApplication = true,
appHMIType = { "MEDIA" },
appID = "0001",
fullAppID = "0000001",
}
}

--[[ Local Functions ]]
local function activateApp2()
common.mobile.getSession(1):ExpectNotification("OnHMIStatus"):Times(0)
common.app.activate(2)
end

local function activateApp1()
common.mobile.getSession(2):ExpectNotification("OnHMIStatus",
{ hmiLevel = "BACKGROUND", audioStreamingState = "NOT_AUDIBLE", systemContext = "MAIN" })
common.app.activate(1)
end

local function deactivateApp1()
common.mobile.getSession(2):ExpectNotification("OnHMIStatus"):Times(0)
common.deactivateApp(1, { hmiLevel = "LIMITED", audioStreamingState = "AUDIBLE", systemContext = "MAIN" })
end

local function reActivateApp2()
common.mobile.getSession(1):ExpectNotification("OnHMIStatus",
{ hmiLevel = "BACKGROUND", audioStreamingState = "NOT_AUDIBLE", systemContext = "MAIN" })
common.app.activate(2)
end

local function deactivateApp2()
common.mobile.getSession(1):ExpectNotification("OnHMIStatus"):Times(0)
common.deactivateApp(2, { hmiLevel = "LIMITED", audioStreamingState = "AUDIBLE", systemContext = "MAIN" })
end

local function exitApp1()
common.mobile.getSession(2):ExpectNotification("OnHMIStatus"):Times(0)
common.exitApp(1)
end

local function reActivateApp1()
common.mobile.getSession(2):ExpectNotification("OnHMIStatus",
{ hmiLevel = "BACKGROUND", audioStreamingState = "NOT_AUDIBLE", systemContext = "MAIN" })
common.app.activate(1)
end

--[[ Scenario ]]
runner.Title("Preconditions")
runner.Step("Clean environment", common.preconditions)
runner.Step("Start SDL and HMI", common.start)
runner.Step("Connect two mobile devices to SDL", common.connectMobDevices, {devices})
runner.Step("Register Media App 1 from Device 1", common.registerAppEx, {1, appParams[1], 1})
runner.Step("Register Media App 1 from Device 2", common.registerAppEx, {2, appParams[1], 2})

runner.Title("Test")
runner.Step("Activate App 1 from Device 2", activateApp2)
runner.Step("Activate App 1 from Device 1", activateApp1)
runner.Step("Deactivate App 1 from Device 1", deactivateApp1)
runner.Step("Activate App 1 from Device 2 once again", reActivateApp2)
runner.Step("Deactivate App 1 from Device 2", deactivateApp2)
runner.Step("Exit App 1 from Device 1", exitApp1)
runner.Step("Activate App 1 from Device 1 again", reActivateApp1)

runner.Title("Postconditions")
runner.Step("Remove mobile devices", common.clearMobDevices, {devices})
runner.Step("Stop SDL", common.postconditions)
Loading

0 comments on commit b2d70d1

Please sign in to comment.