Class NeoDesktop
java.lang.Object
com.onenetwork.platform.tools.test.ui.neo.components.NeoComponent
com.onenetwork.platform.tools.test.ui.neo.components.NeoContainer
com.onenetwork.platform.tools.test.ui.neo.components.NeoFrame
com.onenetwork.platform.tools.test.ui.neo.NeoDesktop
- All Implemented Interfaces:
IDesktop
public class NeoDesktop extends NeoFrame implements IDesktop
Used to interact with the NeoDesktop UI, performing actions such as logging in with a given
username/password and opening menu items, favorites, User setting etc.
Several system properties are read each time NeoDesktop is instantiated to set specific attributes:
web.protocol | http or https. Defaults to http. |
server.host.name | Server hostname for login. Defaults to localhost. |
NeoDesktop.width | Browser window will be resized to this width after login. (Tests run more consistently when they run with identical browser dimensions each time.) |
NeoDesktop.height | Browser window will be resized to this height after login. (Tests run more consistently when they run with identical browser dimensions each time.) |
selenium.timeouts.implicitlyWait | Will be set on WebDriver.Timeouts.implicitlyWait(long, TimeUnit) before login. Value should be provided in seconds. |
selenium.timeouts.scriptTimeout | Will be set on WebDriver.Timeouts.setScriptTimeout(long, TimeUnit) before login. Value should be provided in seconds. |
-
Field Summary
Fields Modifier and Type Field Description static org.openqa.selenium.By
ACCEPT_CC_SWITCH
static org.openqa.selenium.By
ACTIVE_PERSPECTIVE
static org.openqa.selenium.By
CC_SWITCH
protected int
curerntLoginCount
static org.openqa.selenium.By
GLOBAL_SIDEBAR
protected static PlatformLogger
LOG
protected static int
maxLoginCount
protected int
maxTabAllowed
static org.openqa.selenium.By
NEO_CC_HEADERS
static org.openqa.selenium.By
NEO_HEADER
static org.openqa.selenium.By
NEO_MENU_HEADER
protected NeoGlobalSidebar
neoGlobalSideBar
static org.openqa.selenium.By
ONE_HEADER
protected java.lang.String
password
protected org.openqa.selenium.WebElement
perspectiveZero
static org.openqa.selenium.By
REFRESH
static org.openqa.selenium.By
SHOW_USER_PROFILE_OPTS
protected java.lang.String
tabExceededBehavior
protected org.openqa.selenium.WebElement
tabStripEl
protected static java.lang.String
url
static org.openqa.selenium.By
USER_PROFILE_COMPONENT
protected java.lang.String
userName
Fields inherited from class com.onenetwork.platform.tools.test.ui.neo.components.NeoFrame
iframeEl, parentFrame
Fields inherited from class com.onenetwork.platform.tools.test.ui.neo.components.NeoContainer
COMPONENT_NAME
Fields inherited from class com.onenetwork.platform.tools.test.ui.neo.components.NeoComponent
context, driver, element
-
Constructor Summary
Constructors Constructor Description NeoDesktop()
NeoDesktop(NeoUIContext context)
NeoDesktop(NeoUIContext context, java.lang.String url)
-
Method Summary
Modifier and Type Method Description void
closeAll()
Closes all the currently opened Perspectives and navigates back to the Home Screen of the userIPerspective
closePerpective(java.lang.String perspectiveName)
This method closes theIPerspective
from the list of opened perpective based on the name in the parametervoid
execJsToOpenTabFromMenuPath(java.lang.String... path)
Executes javascript to open a tab from a menu path.IPerspective
getActivePerspective()
returns the currently open/activeIPerspective
java.util.ArrayList<java.lang.String>
getAllMenuItems()
Deprecated.NeoGlobalSidebar
getGlobalSideBar()
returns the component objectNeoGlobalSidebar
of the Neo Desktop UI for direct interaction with Side bar elementsjava.util.ArrayList<java.lang.String>
getListOfMenuNames()
NeoUserProfile
getNeoUserProfile()
This method returns the User profile popperNeoUserProfile
web elementIPerspective
getPerspective(int tabPos)
Creates a newTab
instance which represents the tab in Neo Desktop at the provided [tabPos].protected IPerspective
getPerspective(org.openqa.selenium.WebElement perspectiveEl)
int
getTabCount()
Returns the total number of open tabsprotected java.lang.Integer
getTabOpenedByMenuItem(int numTabElements)
static java.lang.String
getUrl()
org.json.JSONObject
getUserProfileContext()
Returns a JSON representing the user's context from the Desktop object in Neo Desktopjava.lang.String
getUserRole()
This method returns the value of role user is currently logged in with.protected static void
killBrowserAndDriver()
protected static void
killBrowserErrorWindow()
static NeoDesktop
login(java.lang.String username)
void
login(java.lang.String userName, java.lang.String password)
Logs into Neo UI with the given [userName] and [password].void
login(java.lang.String userName, java.lang.String password, java.lang.String url)
Logs into NeoUI with the given [url], [userName] and [password].static void
login(java.lang.String userName, java.lang.String password, java.lang.String loginUrl, int width, int height, org.openqa.selenium.By header, AbstractUIContext context)
void
logout()
Logs out of Neo Desktop and closes the browser windowvoid
logout(boolean closeWindow)
Logs out of Neo Desktop and optionally closes the browser windowIPerspective
manageFavorites()
Opens the Manage Favorites Screen and returns itsIPerspective
NeoPerspective
openAlert(java.lang.String alertName, java.lang.String priority)
Opens the alert perpective based on the alert Name and priority from theNeoAlertWidget
on the Global Sidebar.IPerspective
openFavorites(java.lang.String favoriteName)
Opens the favorite from a list of favorite menus based on the name of parameter passedIPerspective
openFrequentlyVisited(java.lang.String freqVisitedName)
Opens the Frequently visited Screens by the user and returns itsNeoPerspective
as the active perspectiveIPerspective
openPanelInNewTab(java.lang.String panelName, org.json.JSONObject config, java.lang.String title)
Opens the panel in new Perspective in the Neo UI based on the panel class, config and title.IPerspective
openPerspective(java.lang.String perspectiveName)
This method opens aIPerspective
from a list of open perspective based on the name passed in the parameterIPerspective
openPerspectiveFromMenu(java.lang.String... path)
Opens a newTab
from the menu.IPerspective
openPerspectiveFromMenuUsingControl(java.lang.String... path)
Opens a newNeoPerspective
from the menu.IPerspective
openPerspectiveUsingControls(java.lang.String menuName)
Performs the search on menu search bar and opens the perspectiveNeoPerspective
openProblem(java.lang.String problemName, java.lang.String severity)
Opens the problem based on the problem Name and severity from theNeoProblemWidget
on the Global Sidebar.IPerspective
openQuickLinks(java.lang.String... quickLinkName)
Opens the Quick Links Screens by the user and returns itsNeoPerspective
as the active perspectiveIPerspective
performGlobalSearch()
Performs the GlobalSearch based on the global search elements setIPerspective
refresh()
void
setMaxTabAllowed(int maxTabAllowed)
void
setNeoGlobalSideBar(NeoGlobalSidebar neoGlobalSideBar)
void
setTabExceededBehavior(java.lang.String tabExceededBehavior)
void
setTabStripEl(org.openqa.selenium.WebElement tabStripEl)
java.lang.Object
switchRole(java.lang.String roleName)
Switches the role for the logged in user.java.lang.Object
switchRole(java.lang.String roleName, java.lang.String siteName)
Switches the role for the logged in user based on site name.java.lang.Object
switchRole(java.lang.String roleName, java.lang.String roleType, java.lang.String entName, java.lang.String orgName, java.lang.String siteName)
Switches the role for the logged in user.void
switchRoleUsingButton(java.lang.String roleName)
Deprecated.CommandCenter
switchToCommandCenter()
Call to this method switches context from currently openedNeoDesktop
and logs in toCommandCenter
NeoPerspective
switchToHome()
Switches the active Perspective to the Home screen of the userNeoDesktop
switchUser(java.lang.String username)
Switches to specified user, using UI controls only (no JS shortcuts).protected void
updateTabElements()
Methods inherited from class com.onenetwork.platform.tools.test.ui.neo.components.NeoFrame
getDriver, getIFrameEl, getSearchContext, getUIContext, switchDriver
Methods inherited from class com.onenetwork.platform.tools.test.ui.neo.components.NeoContainer
getAdvancedTable, getButton, getDashboard, getFieldByLabel, getFieldByLabel, getGrid, getGrids, getLink, getNeoMessagePanel, getNeoPivotTable, getNeoTabbedPane, getReport, getReports, getWindow, isRequired, openFilterPanel
Methods inherited from class com.onenetwork.platform.tools.test.ui.neo.components.NeoComponent
getEl, getFieldErrorMessage, getTooltipMessage, isDisplayed, setMultipleValues, setValue
-
Field Details
-
LOG
-
tabStripEl
protected org.openqa.selenium.WebElement tabStripEl -
maxTabAllowed
protected int maxTabAllowed -
tabExceededBehavior
protected java.lang.String tabExceededBehavior -
url
protected static java.lang.String url -
userName
protected java.lang.String userName -
password
protected java.lang.String password -
neoGlobalSideBar
-
perspectiveZero
protected org.openqa.selenium.WebElement perspectiveZero -
curerntLoginCount
protected int curerntLoginCount -
maxLoginCount
protected static int maxLoginCount -
NEO_HEADER
public static final org.openqa.selenium.By NEO_HEADER -
NEO_CC_HEADERS
public static final org.openqa.selenium.By NEO_CC_HEADERS -
NEO_MENU_HEADER
public static final org.openqa.selenium.By NEO_MENU_HEADER -
CC_SWITCH
public static final org.openqa.selenium.By CC_SWITCH -
ACCEPT_CC_SWITCH
public static final org.openqa.selenium.By ACCEPT_CC_SWITCH -
SHOW_USER_PROFILE_OPTS
public static final org.openqa.selenium.By SHOW_USER_PROFILE_OPTS -
USER_PROFILE_COMPONENT
public static final org.openqa.selenium.By USER_PROFILE_COMPONENT -
GLOBAL_SIDEBAR
public static final org.openqa.selenium.By GLOBAL_SIDEBAR -
REFRESH
public static final org.openqa.selenium.By REFRESH -
ONE_HEADER
public static final org.openqa.selenium.By ONE_HEADER -
ACTIVE_PERSPECTIVE
public static final org.openqa.selenium.By ACTIVE_PERSPECTIVE
-
-
Constructor Details
-
NeoDesktop
public NeoDesktop() -
NeoDesktop
-
NeoDesktop
- Parameters:
url
- home page URL, for example http://localhost/oms
-
-
Method Details
-
setMaxTabAllowed
public void setMaxTabAllowed(int maxTabAllowed)- Parameters:
maxTabAllowed
- the maxTabAllowed to set
-
setTabExceededBehavior
public void setTabExceededBehavior(java.lang.String tabExceededBehavior)- Parameters:
tabExceededBehavior
- the tabExceededBehavior to set
-
logout
public void logout()Logs out of Neo Desktop and closes the browser window -
logout
public void logout(boolean closeWindow)Logs out of Neo Desktop and optionally closes the browser window -
killBrowserErrorWindow
protected static void killBrowserErrorWindow() -
killBrowserAndDriver
protected static void killBrowserAndDriver() -
openPerspectiveFromMenu
Opens a newTab
from the menu. The [path] is an array of [1..N] Strings where each item is the label of a nested menu item. For example, the 1st string will always be the label of a top-level menu item, and if that opens a submenu, the 2nd string will be the label of one of its submenu items, and so on.- Parameters:
path
-- Returns:
- An instance which will serve as the interface for the tab that has just been opened in Neo Desktop.
-
getPerspective
Creates a newTab
instance which represents the tab in Neo Desktop at the provided [tabPos].- Parameters:
tabPos
-- Returns:
- An instance which will serve as the interface for the tab at [tabPos].
-
getTabCount
public int getTabCount()Returns the total number of open tabs -
getPerspective
-
execJsToOpenTabFromMenuPath
public void execJsToOpenTabFromMenuPath(java.lang.String... path)Executes javascript to open a tab from a menu path. Does not attempt to fetch the associated Tab object afterward -
getTabOpenedByMenuItem
protected java.lang.Integer getTabOpenedByMenuItem(int numTabElements) -
login
-
login
public void login(java.lang.String userName, java.lang.String password)Logs into Neo UI with the given [userName] and [password]. -
login
public void login(java.lang.String userName, java.lang.String password, java.lang.String url)Logs into NeoUI with the given [url], [userName] and [password]. -
login
public static void login(java.lang.String userName, java.lang.String password, java.lang.String loginUrl, int width, int height, org.openqa.selenium.By header, AbstractUIContext context) -
getUrl
public static java.lang.String getUrl()- Returns:
- resolved host name
-
switchToCommandCenter
Call to this method switches context from currently openedNeoDesktop
and logs in toCommandCenter
-
getNeoUserProfile
This method returns the User profile popperNeoUserProfile
web element- Returns:
NeoUserProfile
-
refresh
-
getActivePerspective
returns the currently open/activeIPerspective
- Returns:
-
getGlobalSideBar
returns the component objectNeoGlobalSidebar
of the Neo Desktop UI for direct interaction with Side bar elements- Returns:
-
setNeoGlobalSideBar
- Parameters:
neoGlobalSideBar
- the neoGlobalSideBar to set
-
switchToHome
Switches the active Perspective to the Home screen of the user- Returns:
-
manageFavorites
Opens the Manage Favorites Screen and returns itsIPerspective
- Returns:
-
openFavorites
Opens the favorite from a list of favorite menus based on the name of parameter passed- Parameters:
favoriteName
-- Returns:
IPerspective
-
openPerspective
This method opens aIPerspective
from a list of open perspective based on the name passed in the parameter- Parameters:
perspectiveName
-- Returns:
-
closePerpective
This method closes theIPerspective
from the list of opened perpective based on the name in the parameter- Parameters:
perspectiveName
-- Returns:
-
getAllMenuItems
@Deprecated public java.util.ArrayList<java.lang.String> getAllMenuItems()Deprecated.Returns set of menu/fav names for the current user- Returns:
Set
-
getListOfMenuNames
public java.util.ArrayList<java.lang.String> getListOfMenuNames() -
switchRoleUsingButton
@Deprecated public void switchRoleUsingButton(java.lang.String roleName)Deprecated.This method changes the role of the user from current role to the roleName parameter passed to the method Needed only to test the switch role functionality itself, not intended for use by typical tests which are switching to a role to test business fucntionality. Due to stability reason api is deprecated instead do use switchRole apis- Parameters:
roleName
-
-
switchRole
public java.lang.Object switchRole(java.lang.String roleName)Switches the role for the logged in user.- Parameters:
roleName
- role name to switch to
-
switchRole
public java.lang.Object switchRole(java.lang.String roleName, java.lang.String siteName)Switches the role for the logged in user based on site name.- Parameters:
roleName
- role name to switch tositeName
- site name of role
-
switchRole
public java.lang.Object switchRole(java.lang.String roleName, java.lang.String roleType, java.lang.String entName, java.lang.String orgName, java.lang.String siteName)Switches the role for the logged in user.- Parameters:
roleName
- role name to switch toroleType
- role type of roleentName
- enterprise name of roleorgName
- organization name of rolesiteName
- site name of role
-
getUserRole
public java.lang.String getUserRole()This method returns the value of role user is currently logged in with. This method is used specifically for testing purpose to check the user role- Returns:
String
-
openFrequentlyVisited
Opens the Frequently visited Screens by the user and returns itsNeoPerspective
as the active perspective- Returns:
NeoPerspective
-
openQuickLinks
Opens the Quick Links Screens by the user and returns itsNeoPerspective
as the active perspective- Returns:
NeoPerspective
-
openProblem
Opens the problem based on the problem Name and severity from theNeoProblemWidget
on the Global Sidebar. Note that problem count must be non-zero. Zero count elements are non-clickable Also this returns the currently open problemNeoPerspective
- Parameters:
problemName
-severity
-- Returns:
NeoPerspective
-
openAlert
Opens the alert perpective based on the alert Name and priority from theNeoAlertWidget
on the Global Sidebar. Note that problem count must be non-zero. Zero count elements are non-clickable Also this returns the currently open problemNeoPerspective
- Parameters:
alertName
-priority
-- Returns:
NeoPerspective
-
openPerspectiveFromMenuUsingControl
Opens a newNeoPerspective
from the menu. The [path] is an array of [1..N] Strings where each item is the label of a nested menu item.- Parameters:
path
-- Returns:
IPerspective
-
performGlobalSearch
Performs the GlobalSearch based on the global search elements set- Returns:
IPerspective
-
closeAll
public void closeAll()Closes all the currently opened Perspectives and navigates back to the Home Screen of the user -
setTabStripEl
public void setTabStripEl(org.openqa.selenium.WebElement tabStripEl)- Specified by:
setTabStripEl
in interfaceIDesktop
- Parameters:
tabStripEl
- the tabStripEl to set
-
updateTabElements
protected void updateTabElements() -
switchUser
Switches to specified user, using UI controls only (no JS shortcuts). Current user must be of role InstanceAdminUser so that switchUser option is available in UI.- Parameters:
userName
- user name to switch to
-
getUserProfileContext
public org.json.JSONObject getUserProfileContext()Returns a JSON representing the user's context from the Desktop object in Neo Desktop- Specified by:
getUserProfileContext
in interfaceIDesktop
-
openPanelInNewTab
public IPerspective openPanelInNewTab(java.lang.String panelName, org.json.JSONObject config, java.lang.String title)Opens the panel in new Perspective in the Neo UI based on the panel class, config and title.- Parameters:
panelName
-config
-title
-- Returns:
-
openPerspectiveUsingControls
Performs the search on menu search bar and opens the perspective- Returns:
IPerspective
-