Class 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.protocolhttp or https. Defaults to http.
server.host.nameServer hostname for login. Defaults to localhost.
NeoDesktop.widthBrowser window will be resized to this width after login. (Tests run more consistently when they run with identical browser dimensions each time.)
NeoDesktop.heightBrowser window will be resized to this height after login. (Tests run more consistently when they run with identical browser dimensions each time.)
selenium.timeouts.implicitlyWaitWill be set on WebDriver.Timeouts.implicitlyWait(long, TimeUnit) before login. Value should be provided in seconds.
selenium.timeouts.scriptTimeoutWill be set on WebDriver.Timeouts.setScriptTimeout(long, TimeUnit) before login. Value should be provided in seconds.
  • Field Details

  • Constructor Details

  • 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
      Specified by:
      logout in interface IDesktop
    • logout

      public void logout​(boolean closeWindow)
      Logs out of Neo Desktop and optionally closes the browser window
      Specified by:
      logout in interface IDesktop
      Parameters:
      closeWindow - whether to close the browser window
    • killBrowserErrorWindow

      protected static void killBrowserErrorWindow()
    • killBrowserAndDriver

      protected static void killBrowserAndDriver()
    • openPerspectiveFromMenu

      public IPerspective openPerspectiveFromMenu​(java.lang.String... path)
      Opens a new Tab 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

      public IPerspective getPerspective​(int tabPos)
      Creates a new Tab 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

      protected IPerspective getPerspective​(org.openqa.selenium.WebElement perspectiveEl)
    • 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

      public static NeoDesktop login​(java.lang.String username)
    • login

      public void login​(java.lang.String userName, java.lang.String password)
      Logs into Neo UI with the given [userName] and [password].
      Specified by:
      login in interface IDesktop
      Parameters:
      userName -
      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].
      Specified by:
      login in interface IDesktop
      Parameters:
      userName -
      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

      public CommandCenter switchToCommandCenter()
      Call to this method switches context from currently opened NeoDesktop and logs in to CommandCenter
    • getNeoUserProfile

      public NeoUserProfile getNeoUserProfile()
      This method returns the User profile popper NeoUserProfile web element
      Returns:
      NeoUserProfile
    • refresh

      public IPerspective refresh()
    • getActivePerspective

      public IPerspective getActivePerspective()
      returns the currently open/active IPerspective
      Returns:
    • getGlobalSideBar

      public NeoGlobalSidebar getGlobalSideBar()
      returns the component object NeoGlobalSidebar of the Neo Desktop UI for direct interaction with Side bar elements
      Returns:
    • setNeoGlobalSideBar

      public void setNeoGlobalSideBar​(NeoGlobalSidebar neoGlobalSideBar)
      Parameters:
      neoGlobalSideBar - the neoGlobalSideBar to set
    • switchToHome

      public NeoPerspective switchToHome()
      Switches the active Perspective to the Home screen of the user
      Returns:
    • manageFavorites

      public IPerspective manageFavorites()
      Opens the Manage Favorites Screen and returns its IPerspective
      Returns:
    • openFavorites

      public IPerspective openFavorites​(java.lang.String favoriteName)
      Opens the favorite from a list of favorite menus based on the name of parameter passed
      Parameters:
      favoriteName -
      Returns:
      IPerspective
    • openPerspective

      public IPerspective openPerspective​(java.lang.String perspectiveName)
      This method opens a IPerspective from a list of open perspective based on the name passed in the parameter
      Parameters:
      perspectiveName -
      Returns:
    • closePerpective

      public IPerspective closePerpective​(java.lang.String perspectiveName)
      This method closes the IPerspective 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 to
      siteName - 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 to
      roleType - role type of role
      entName - enterprise name of role
      orgName - organization name of role
      siteName - 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

      public IPerspective openFrequentlyVisited​(java.lang.String freqVisitedName)
      Opens the Frequently visited Screens by the user and returns its NeoPerspective as the active perspective
      Returns:
      NeoPerspective
    • openQuickLinks

      public IPerspective openQuickLinks​(java.lang.String... quickLinkName)
      Opens the Quick Links Screens by the user and returns its NeoPerspective as the active perspective
      Returns:
      NeoPerspective
    • openProblem

      public NeoPerspective openProblem​(java.lang.String problemName, java.lang.String severity)
      Opens the problem based on the problem Name and severity from the NeoProblemWidget on the Global Sidebar. Note that problem count must be non-zero. Zero count elements are non-clickable Also this returns the currently open problem NeoPerspective
      Parameters:
      problemName -
      severity -
      Returns:
      NeoPerspective
    • openAlert

      public NeoPerspective openAlert​(java.lang.String alertName, java.lang.String priority)
      Opens the alert perpective based on the alert Name and priority from the NeoAlertWidget on the Global Sidebar. Note that problem count must be non-zero. Zero count elements are non-clickable Also this returns the currently open problem NeoPerspective
      Parameters:
      alertName -
      priority -
      Returns:
      NeoPerspective
    • openPerspectiveFromMenuUsingControl

      public IPerspective openPerspectiveFromMenuUsingControl​(java.lang.String... path)
      Opens a new NeoPerspective 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

      public 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 interface IDesktop
      Parameters:
      tabStripEl - the tabStripEl to set
    • updateTabElements

      protected void updateTabElements()
    • switchUser

      public NeoDesktop switchUser​(java.lang.String username)
      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 interface IDesktop
    • 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

      public IPerspective openPerspectiveUsingControls​(java.lang.String menuName)
      Performs the search on menu search bar and opens the perspective
      Returns:
      IPerspective