Skip to content

Commit

Permalink
Merge pull request #2218 from smartdevicelink/feature/widget_support
Browse files Browse the repository at this point in the history
Feature/widget support
  • Loading branch information
Jack-Byrne authored Aug 26, 2019
2 parents 50900b8 + be162f5 commit d74a0f4
Show file tree
Hide file tree
Showing 95 changed files with 7,159 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,25 @@
-- Proposal: https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0147-template-color-scheme.md
--
-- Description:
-- SDL Core should track the number of attempted SetDisplayLayout requests with the current template and REJECT
-- SDL Core should track the number of attempted SetDisplayLayout requests with the current template and REJECT
-- any beyond the first with the reason "Using SetDisplayLayout to change the color scheme may only be done once.
-- However, The color scheme can be changed if the layout is also changed.
--
-- Preconditions: Send SetDisplayLayout with a layout and a color scheme.
--
-- Steps: Send additional SetDisplayLayout with a different layout and a different color scheme.
--
-- Expected result:
-- Expected result:
-- SDL Core returns SUCCESS
-- Note: since "SetDisplayLayout" is deprecated SDL has to respond with WARNINGS to mobile in success case
---------------------------------------------------------------------------------------------------

--[[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local commonSmoke = require('test_scripts/Smoke/commonSmoke')

local function getRequestParams()
return {
return {
displayLayout = "ONSCREEN_PRESETS",
dayColorScheme = {
primaryColor = {
Expand All @@ -32,7 +33,7 @@ local function getRequestParams()
end

local function getRequestParams2()
return {
return {
displayLayout = "MEDIA",
dayColorScheme = {
primaryColor = {
Expand All @@ -53,7 +54,7 @@ local function setDisplayWithColorsSuccess(self)
end)
self.mobileSession1:ExpectResponse(cid, {
success = true,
resultCode = "SUCCESS"
resultCode = "WARNINGS"
})
end

Expand All @@ -66,7 +67,7 @@ local function setDisplayWithColorsAndNewLayoutSuccess(self)
end)
self.mobileSession1:ExpectResponse(cid, {
success = true,
resultCode = "SUCCESS"
resultCode = "WARNINGS"
})
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
-- Proposal: https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0147-template-color-scheme.md
--
-- Description:
-- SDL Core should track the number of attempted SetDisplayLayout requests with the current template and REJECT
-- SDL Core should track the number of attempted SetDisplayLayout requests with the current template and REJECT
-- any beyond the first with the reason "Using SetDisplayLayout to change the color scheme may only be done once.
--
-- Preconditions: Send SetDisplayLayout with a layout and a color scheme.
--
-- Steps: Send additional SetDisplayLayout with same layout but use a different color scheme
--
-- Expected result:
-- Expected result:
-- SDL Core returns REJECTED
-- Note: since "SetDisplayLayout" is deprecated SDL has to respond with WARNINGS to mobile in success case
---------------------------------------------------------------------------------------------------


Expand All @@ -19,7 +20,7 @@ local runner = require('user_modules/script_runner')
local commonSmoke = require('test_scripts/Smoke/commonSmoke')

local function getRequestParams()
return {
return {
displayLayout = "ONSCREEN_PRESETS",
dayColorScheme = {
primaryColor = {
Expand All @@ -32,7 +33,7 @@ local function getRequestParams()
end

local function getRequestParams2()
return {
return {
displayLayout = "ONSCREEN_PRESETS",
dayColorScheme = {
primaryColor = {
Expand All @@ -53,7 +54,7 @@ local function setDisplayWithColorsSuccess(self)
end)
self.mobileSession1:ExpectResponse(cid, {
success = true,
resultCode = "SUCCESS"
resultCode = "WARNINGS"
})
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,25 @@
-- Proposal: https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0147-template-color-scheme.md
--
-- Description:
-- SDL Core should track the number of attempted SetDisplayLayout requests with the current template and REJECT
-- SDL Core should track the number of attempted SetDisplayLayout requests with the current template and REJECT
-- any beyond the first with the reason "Using SetDisplayLayout to change the color scheme may only be done once.
-- Sending A SetDisplayLayout with the same color should still return success.
--
-- Preconditions: Send SetDisplayLayout with a layout and a color scheme.
--
-- Steps: Send additional SetDisplayLayout with same layout and the same color scheme.
--
-- Expected result:
-- Expected result:
-- SDL Core returns SUCCESS
-- Note: since "SetDisplayLayout" is deprecated SDL has to respond with WARNINGS to mobile in success case
---------------------------------------------------------------------------------------------------

--[[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local commonSmoke = require('test_scripts/Smoke/commonSmoke')

local function getRequestParams()
return {
return {
displayLayout = "ONSCREEN_PRESETS",
dayColorScheme = {
primaryColor = {
Expand All @@ -40,7 +41,7 @@ local function setDisplayWithColorsSuccess(self)
end)
self.mobileSession1:ExpectResponse(cid, {
success = true,
resultCode = "SUCCESS"
resultCode = "WARNINGS"
})
end

Expand All @@ -53,7 +54,7 @@ local function setDisplayWithSameColorsSuccess(self)
end)
self.mobileSession1:ExpectResponse(cid, {
success = true,
resultCode = "SUCCESS"
resultCode = "WARNINGS"
})
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
-- SDL transfers the UI part of request with allowed parameters to HMI
-- SDL receives UI part of response from HMI with "SUCCESS" result code
-- SDL transfers response to mobile app
-- Note: since "SetDisplayLayout" is deprecated SDL has to respond with WARNINGS to mobile in success case
---------------------------------------------------------------------------------------------------

--[[ Required Shared libraries ]]
Expand Down Expand Up @@ -220,7 +221,7 @@ local function setDisplaySuccess(self)
end)
self.mobileSession1:ExpectResponse(cid, {
success = true,
resultCode = "SUCCESS",
resultCode = "WARNINGS",
displayCapabilities = responseParams.displayCapabilities,
buttonCapabilities = responseParams.buttonCapabilities,
softButtonCapabilities = responseParams.softButtonCapabilities,
Expand Down
1 change: 1 addition & 0 deletions test_scripts/Smoke/commonSmoke.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ commonSmoke.minTimeout = 500
local function allowSDL(self)
self.hmiConnection:SendNotification("SDL.OnAllowSDLFunctionality",
{ allowed = true, source = "GUI", device = { id = commonSmoke.getDeviceMAC(), name = commonSmoke.getDeviceName() }})
utils.wait(commonSmoke.minTimeout)
end

--[[Module functions]]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---------------------------------------------------------------------------------------------------
-- Proposal: https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0216-widget-support.md
--
-- Description: Check that SDL transfer `OnSystemCapabilitiesUpdated` notification from HMI to an App
-- which created a widget after `CreateWindow` response
--
-- Preconditions:
-- 1) SDL and HMI are started
-- 2) App is registered
-- Steps:
-- 1) App creates new widget
-- SDL does:
-- - proceed with `CreateWindow` request successfully
-- - not send `OnSystemCapabilityUpdated` to App
-- 2) HMI sends `OnSystemCapabilityUpdated` to SDL
-- SDL does:
-- - transfer `OnSystemCapabilityUpdated` notification to App
---------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local common = require('test_scripts/WidgetSupport/common')

--[[ Local Functions ]]
local function sendCreateWindow()
local createWindowParams = {
windowID = 2,
windowName = "Name",
type = "WIDGET"
}
local cid = common.getMobileSession():SendRPC("CreateWindow", createWindowParams)
common.getHMIConnection():ExpectRequest("UI.CreateWindow")
:Do(function(_, data)
common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", {})
end)
common.getMobileSession():ExpectResponse(cid, { success = true, resultCode = "SUCCESS" })
common.getMobileSession():ExpectNotification("OnSystemCapabilityUpdated")
:Times(0)
end

local function sendOnSCU()
local paramsToSDL = common.getOnSystemCapabilityParams()
paramsToSDL.appID = common.getHMIAppId()
common.getHMIConnection():SendNotification("BasicCommunication.OnSystemCapabilityUpdated", paramsToSDL)
common.getMobileSession():ExpectNotification("OnSystemCapabilityUpdated", common.getOnSystemCapabilityParams())
end

--[[ Scenario ]]
common.Title("Precondition")
common.Step("Clean environment and Back-up/update PPT", common.precondition)
common.Step("Start SDL, HMI, connect Mobile, start Session", common.start)
common.Step("App registration", common.registerAppWOPTU)
common.Step("App activation", common.activateApp)

common.Title("Test")
common.Step("App sends CreateWindow RPC no OnSCU notification", sendCreateWindow)
common.Step("HMI sends OnSCU notification", sendOnSCU)

common.Title("Postconditions")
common.Step("Stop SDL, restore SDL settings and PPT", common.postcondition)
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---------------------------------------------------------------------------------------------------
-- Proposal: https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0216-widget-support.md
--
-- Description: Check that SDL transfer `OnSystemCapabilitiesUpdated` notification from HMI to an App
-- which sent `Show` RPC with `templateConfiguration` parameter for main window after `Show` response
--
-- Preconditions:
-- 1) SDL and HMI are started
-- 2) App is registered
-- Steps:
-- 1) App sends `Show` request with `templateConfiguration` for main window (windowID is not defined)
-- SDL does:
-- - proceed with `Show` request successfully
-- - not send `OnSystemCapabilityUpdated` to App
-- 2) HMI sends `OnSystemCapabilityUpdated` to SDL
-- SDL does:
-- - transfer `OnSystemCapabilityUpdated` notification to App
---------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local common = require('test_scripts/WidgetSupport/common')

--[[ Local Functions ]]
local function sendShow()
local showParams = {
mainField1 = "MainField1",
templateConfiguration = {
template = "Template1"
}
}
local cid = common.getMobileSession():SendRPC("Show", showParams)
common.getHMIConnection():ExpectRequest("UI.Show")
:Do(function(_, data)
common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", {})
end)
common.getMobileSession():ExpectResponse(cid, { success = true, resultCode = "SUCCESS" })
common.getMobileSession():ExpectNotification("OnSystemCapabilityUpdated")
:Times(0)
end

local function sendOnSCU()
local paramsToSDL = common.getOnSystemCapabilityParams()
paramsToSDL.appID = common.getHMIAppId()
common.getHMIConnection():SendNotification("BasicCommunication.OnSystemCapabilityUpdated", paramsToSDL)
common.getMobileSession():ExpectNotification("OnSystemCapabilityUpdated", common.getOnSystemCapabilityParams())
end

--[[ Scenario ]]
common.Title("Precondition")
common.Step("Clean environment and Back-up/update PPT", common.precondition)
common.Step("Start SDL, HMI, connect Mobile, start Session", common.start)
common.Step("App registration", common.registerAppWOPTU)
common.Step("App activation", common.activateApp)

common.Title("Test")
common.Step("App sends Show RPC no OnSCU notification", sendShow)
common.Step("HMI sends OnSCU notification", sendOnSCU)

common.Title("Postconditions")
common.Step("Stop SDL, restore SDL settings and PPT", common.postcondition)
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---------------------------------------------------------------------------------------------------
-- Proposal: https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0216-widget-support.md
--
-- Description: Check that SDL transfer `OnSystemCapabilitiesUpdated` notification from HMI to an App
-- which sent `Show` RPC with `templateConfiguration` parameter for widget window after `Show` response
--
-- Preconditions:
-- 1) SDL and HMI are started
-- 2) App is registered
-- 3) App creates new widget
-- Steps:
-- 1) App sends `Show` request with `templateConfiguration` for widget window
-- SDL does:
-- - proceed with `Show` request successfully
-- - not send `OnSystemCapabilityUpdated` to App
-- 2) HMI sends `OnSystemCapabilityUpdated` to SDL
-- SDL does:
-- - transfer `OnSystemCapabilityUpdated` notification to App
---------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local common = require('test_scripts/WidgetSupport/common')

--[[ Local Variables ]]
local createWindowParams = {
windowID = 1,
windowName = "Name",
type = "WIDGET"
}

--[[ Local Functions ]]
local function sendShow()
local showParams = {
mainField1 = "MainField1",
windowID = createWindowParams.windowID,
templateConfiguration = {
template = "Template1"
}
}
local cid = common.getMobileSession():SendRPC("Show", showParams)
common.getHMIConnection():ExpectRequest("UI.Show")
:Do(function(_, data)
common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", {})
end)
common.getMobileSession():ExpectResponse(cid, { success = true, resultCode = "SUCCESS" })
common.getMobileSession():ExpectNotification("OnSystemCapabilityUpdated")
:Times(0)
end

local function sendOnSCU()
local paramsToSDL = common.getOnSystemCapabilityParams()
paramsToSDL.appID = common.getHMIAppId()
common.getHMIConnection():SendNotification("BasicCommunication.OnSystemCapabilityUpdated", paramsToSDL)
common.getMobileSession():ExpectNotification("OnSystemCapabilityUpdated", common.getOnSystemCapabilityParams())
end

--[[ Scenario ]]
common.Title("Precondition")
common.Step("Clean environment and Back-up/update PPT", common.precondition)
common.Step("Start SDL, HMI, connect Mobile, start Session", common.start)
common.Step("App registration", common.registerAppWOPTU)
common.Step("App activation", common.activateApp)
common.Step("Create widget", common.createWindow, { createWindowParams })
common.Step("Activate widget", common.activateWidgetFromNoneToFULL, { createWindowParams.windowID })

common.Title("Test")
common.Step("App sends Show RPC no OnSCU notification", sendShow)
common.Step("HMI sends OnSCU notification", sendOnSCU)

common.Title("Postconditions")
common.Step("Stop SDL, restore SDL settings and PPT", common.postcondition)
Loading

0 comments on commit d74a0f4

Please sign in to comment.