Class CommandCenter
java.lang.Object
com.onenetwork.platform.tools.test.ui.components.Component
com.onenetwork.platform.tools.test.ui.components.Container
com.onenetwork.platform.tools.test.ui.components.Frame
com.onenetwork.platform.tools.test.ui.CommandCenter
- All Implemented Interfaces:
IDesktop
public class CommandCenter extends Frame implements IDesktop
Used to interact with the Command Center, performing actions such as logging in with a given
username/password and opening menu items.
Several system properties are read each time CommandCenter is instantiated to set specific attributes:
web.protocol | http or https. Defaults to http. |
server.host.name | Server hostname for login. Defaults to localhost. |
CommandCenter.width | Browser window will be resized to this width after login. (Tests run more consistently when they run with identical browser dimensions each time.) |
CommandCenter.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
ACTIVE_ROLE
protected static PlatformLogger
LOG
static org.openqa.selenium.By
NEO_ACCEPT_TERMS
static org.openqa.selenium.By
NEO_CC_HEADERS
static org.openqa.selenium.By
NEO_HEADER
static org.openqa.selenium.By
NEO_NAV_BAR
static org.openqa.selenium.By
NEO_SLIDER_FRAME
static org.openqa.selenium.By
ONE_HEADER
protected java.lang.String
password
static org.openqa.selenium.By
ROLES
static org.openqa.selenium.By
SWITCH_ROLE
static org.openqa.selenium.By
SWITCH_USER
protected org.openqa.selenium.WebElement
tabBodiesEl
protected org.openqa.selenium.WebElement
tabStripEl
static org.openqa.selenium.By
TAKE_TO_NEO_BUTTON
protected static java.lang.String
url
static org.openqa.selenium.By
USER_MENU_HEADER
protected java.lang.String
userName
Fields inherited from class com.onenetwork.platform.tools.test.ui.components.Frame
iframeEl, parentFrame
-
Constructor Summary
Constructors Constructor Description CommandCenter()
Constructs an instance of this class along with an instance ofUIContext
, which is heavily used by the rest of the API.CommandCenter(UIContext context)
Constructs an instance of this class which will utilize the providedUIContext
instance.CommandCenter(UIContext context, java.lang.String url)
-
Method Summary
Modifier and Type Method Description Tab
awaitNewActiveTab(Tab lastKnownActiveTab)
Given a last known active tab, awaits a new tab to open and become active, then returns that Tab.void
clickBlipper()
void
clickNotification()
void
closeAllTabs()
Closes all currently open tabs.void
closeTabByName(java.lang.String tabName)
void
execJsToOpenTabFromMenuPath(java.lang.String... path)
Executes javascript to open a tab from a menu path.Tab
getActiveTab()
Returns the active tab in Command Center.java.lang.String
getActiveTabTitle()
Return title for current active tab.java.util.List<java.lang.String>
getAllRoles()
Return list of roles for currently logged in userNotifierButton
getChatButton()
Returns the Chat ButtonNotifierButton
in the Command Center, or throws aNoSuchElementException
if none was found.ChatWindow
getChatWindow()
Returns the chat windowWindow
in the Command Center, or throws aNoSuchElementException
if none was found.static java.util.Properties
getCommandCenterProperties()
static java.lang.String
getCommandCenterProperty(java.lang.String key)
Returns specific command center property valueGlobalSearch
getGlobalSearch()
java.util.ArrayList<java.lang.String>
getListOfMenuNames()
NotifierButton
getNotificationsButton()
Returns the Notifications ButtonNotifierButton
in the Command Center, or throws aNoSuchElementException
if none was found.Tab
getTab(int tabPos)
Creates a newTab
instance which represents the tab in Command Center at the provided [tabPos].protected Tab
getTab(int tabPos, org.openqa.selenium.WebElement tabHeaderEl)
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 Command Centerprotected static void
killBrowserAndDriver()
protected static void
killBrowserErrorWindow()
static CommandCenter
login(java.lang.String username)
Preferred method of getting a CommandCenter session - this login method caches CommandCenter sessions to maximize test speed.static CommandCenter
login(java.lang.String username, java.lang.Class<? extends UIContext> uiContextClass)
Likelogin(String)
, but allows the caller to specify a concrete subclass to be used for UIContext.void
login(java.lang.String userName, java.lang.String password)
Logs into Command Center with the given [userName] and [password].void
login(java.lang.String userName, java.lang.String password, java.lang.String url)
Logs into Command Center 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 Command Center and closes the browser windowvoid
logout(boolean closeWindow)
Logs out of Command Center and optionally closes the browser windowvoid
logoutUsingButton()
Logs out of Command Center using Logout button and closes the browser windowvoid
openFavoriteMenu(java.lang.String path)
Tab
openLinkInNewTab(java.lang.String url, java.lang.String title)
Tab
openPanelInNewTab(java.lang.String panelName, org.json.JSONObject config, java.lang.String title)
Tab
openTabByName(java.lang.String tabName)
Tab
openTabFromMenu(java.lang.String... path)
Opens a newTab
from the menu.protected void
openTabFromMenuPath(java.lang.String... path)
Deprecated.void
openTools()
Tab
openWebActionInNewTab(java.lang.String webActionName, org.json.JSONObject config, java.lang.String title)
void
refreshTab()
Clicks the green Refresh button in Command Center.void
reinit()
Reinitializes this Command Center component without a relogin.void
reset()
It will close all Tabs and take you at the fresh login state.void
setTabBodiesEl(org.openqa.selenium.WebElement tabBodiesEl)
void
setTabStripEl(org.openqa.selenium.WebElement tabStripEl)
void
showSessionInformation()
Opens the "Session Information" tab by clicking the associated Tools menu item in Command Center.void
showUserProfile()
void
switchRole(java.lang.String roleName)
Switches the role for the logged in user.void
switchRole(java.lang.String roleName, java.lang.String siteName)
Switches the role for the logged in user based on site name.void
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
switchRoleThroughControls(java.lang.String roleName)
Deprecated.void
switchTheme(java.lang.String themeName)
NeoDesktop
switchToNeo()
Call to this method switches context from currently openedCommandCenter
and logs in toNeoDesktop
void
switchUser(java.lang.String userName)
Switches to specified user, using UI controls only (no JS shortcuts).protected void
updateTabElements()
void
viewAllChatRooms()
Methods inherited from class com.onenetwork.platform.tools.test.ui.components.Frame
getDriver, getIFrameEl, getParentFrame, getSearchContext, getTLV, getUIContext, setParentFrame, switchDriver
Methods inherited from class com.onenetwork.platform.tools.test.ui.components.Container
clickAction, clickAction, clickMenuItem, clickOneLogo, createFieldFromLabel, findXTypeFromInput, getActions, getActions, getButton, getCC1InnerTab, getComponent, getDashboard, getFieldByLabel, getFieldByLabelCC15, getFieldByLabelFlux, getFieldByLabelNew, getFieldByMultiLineLabel, getFieldByName, getFieldError, getFilterOverlayPanel, getFormPanel, getGrid, getGridByClass, getGrids, getLink, getMenu, getMessagePanel, getMessagePanelFlux, getNotificationCollaboration, getProbelmDetail, getProblemList, getReadOnlyFieldByLabelCC15, getReport, getReports, getSearchPageContext, getTabPanel, getTabPanelByClass, getTemplateDisplay, getTreePanel, getWindow, getWindows, getXTypeFromFormItem, getXTypeFromId, getXTypeFromLabel, isRequired, waitForSuccessMessage
Methods inherited from class com.onenetwork.platform.tools.test.ui.components.Component
getEl, getId, isDisplayed, isRequired
-
Field Details
-
LOG
-
tabStripEl
protected org.openqa.selenium.WebElement tabStripEl -
tabBodiesEl
protected org.openqa.selenium.WebElement tabBodiesEl -
url
protected static java.lang.String url -
userName
protected java.lang.String userName -
password
protected java.lang.String password -
ONE_HEADER
public static final org.openqa.selenium.By ONE_HEADER -
USER_MENU_HEADER
public static final org.openqa.selenium.By USER_MENU_HEADER -
SWITCH_ROLE
public static final org.openqa.selenium.By SWITCH_ROLE -
SWITCH_USER
public static final org.openqa.selenium.By SWITCH_USER -
ROLES
public static final org.openqa.selenium.By ROLES -
ACTIVE_ROLE
public static final org.openqa.selenium.By ACTIVE_ROLE -
NEO_SLIDER_FRAME
public static final org.openqa.selenium.By NEO_SLIDER_FRAME -
NEO_ACCEPT_TERMS
public static final org.openqa.selenium.By NEO_ACCEPT_TERMS -
TAKE_TO_NEO_BUTTON
public static final org.openqa.selenium.By TAKE_TO_NEO_BUTTON -
NEO_NAV_BAR
public static final org.openqa.selenium.By NEO_NAV_BAR -
NEO_CC_HEADERS
public static final org.openqa.selenium.By NEO_CC_HEADERS -
NEO_HEADER
public static final org.openqa.selenium.By NEO_HEADER
-
-
Constructor Details
-
CommandCenter
public CommandCenter()Constructs an instance of this class along with an instance ofUIContext
, which is heavily used by the rest of the API. This will use a URL based on System properties web.protocol (http if not found) and server.host.name (localhost if not found). -
CommandCenter
Constructs an instance of this class which will utilize the providedUIContext
instance. This will create a URL based on System properties web.protocol (http if not found) and server.host.name (localhost if not found). -
CommandCenter
- Parameters:
url
- home page URL, for example http://localhost/oms
-
-
Method Details
-
login
public void login(java.lang.String userName, java.lang.String password)Logs into Command Center with the given [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) -
login
public void login(java.lang.String userName, java.lang.String password, java.lang.String url)Logs into Command Center with the given [url], [userName] and [password]. -
logout
public void logout()Logs out of Command Center and closes the browser window -
logout
public void logout(boolean closeWindow)Logs out of Command Center and optionally closes the browser window -
killBrowserErrorWindow
protected static void killBrowserErrorWindow() -
killBrowserAndDriver
protected static void killBrowserAndDriver() -
logoutUsingButton
public void logoutUsingButton()Logs out of Command Center using Logout button and closes the browser window -
switchRoleThroughControls
@Deprecated public void switchRoleThroughControls(java.lang.String roleName)Deprecated.Switches the role for the logged in user, using UI controls only (no JS shortcuts). 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
- role name to switch to
-
switchUser
public void switchUser(java.lang.String userName)Switches to specified user, using UI controls only (no JS shortcuts). Current user should of role InstanceAdminUser so that switchUser option is available in UI.- Parameters:
userName
- user name to switch to
-
switchRole
public void switchRole(java.lang.String roleName)Switches the role for the logged in user.- Parameters:
roleName
- role name to switch to
-
switchRole
public void 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 void 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
-
openLinkInNewTab
-
openPanelInNewTab
public Tab openPanelInNewTab(java.lang.String panelName, org.json.JSONObject config, java.lang.String title) -
openWebActionInNewTab
public Tab openWebActionInNewTab(java.lang.String webActionName, org.json.JSONObject config, java.lang.String title) -
openTabFromMenu
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 Command Center.
-
getTab
Creates a newTab
instance which represents the tab in Command Center 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 -
getTab
-
refreshTab
public void refreshTab()Clicks the green Refresh button in Command Center. -
awaitNewActiveTab
Given a last known active tab, awaits a new tab to open and become active, then returns that Tab.- Parameters:
lastKnownActiveTab
- last known active tab (callgetActiveTab()
, then invoke your action which launches a new tab, then call this method, giving the tab you fetched earlier
-
getActiveTab
Returns the active tab in Command Center. Throws an exception if there is no active tab. WARNING: to reliably get a await the opening of a new tab which is launched by some UI action other than the openTab methods in this class, useawaitNewActiveTab(Tab)
. -
openTabFromMenuPath
@Deprecated protected void openTabFromMenuPath(java.lang.String... path)Deprecated. -
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) -
setTabStripEl
public void setTabStripEl(org.openqa.selenium.WebElement tabStripEl)- Specified by:
setTabStripEl
in interfaceIDesktop
- Parameters:
tabStripEl
- the tabStripEl to set
-
setTabBodiesEl
public void setTabBodiesEl(org.openqa.selenium.WebElement tabBodiesEl)- Parameters:
tabBodiesEl
- the tabBodiesEl to set
-
updateTabElements
protected void updateTabElements() -
openFavoriteMenu
public void openFavoriteMenu(java.lang.String path) -
closeAllTabs
public void closeAllTabs()Closes all currently open tabs. -
login
Preferred method of getting a CommandCenter session - this login method caches CommandCenter sessions to maximize test speed. On a call to this method, the behavior is:- Open a new window if the given user does not yet have a CommandCenter window
- If the user already has a CommandCenter window, reuse it (closing all tabs before proceeding)
- On JVM shutdown, close all open CommandCenter windows
-
login
public static CommandCenter login(java.lang.String username, java.lang.Class<? extends UIContext> uiContextClass)Likelogin(String)
, but allows the caller to specify a concrete subclass to be used for UIContext. (Must have a no-args constructor) -
openTabByName
-
closeTabByName
public void closeTabByName(java.lang.String tabName) -
openTools
public void openTools() -
switchTheme
public void switchTheme(java.lang.String themeName) -
getChatButton
Returns the Chat ButtonNotifierButton
in the Command Center, or throws aNoSuchElementException
if none was found.- Returns:
- chat button of the Command Center.
-
getNotificationsButton
Returns the Notifications ButtonNotifierButton
in the Command Center, or throws aNoSuchElementException
if none was found.- Returns:
- notifications button of the Command Center.
-
getChatWindow
Returns the chat windowWindow
in the Command Center, or throws aNoSuchElementException
if none was found. -
showUserProfile
public void showUserProfile() -
showSessionInformation
public void showSessionInformation()Opens the "Session Information" tab by clicking the associated Tools menu item in Command Center. -
reset
public void reset()It will close all Tabs and take you at the fresh login state. -
reinit
public void reinit()Reinitializes this Command Center component without a relogin. Useful in cases where the underlying command center window was refreshed. -
getUrl
public static java.lang.String getUrl()- Returns:
- resolved host name
-
getUserProfileContext
public org.json.JSONObject getUserProfileContext()Returns a JSON representing the user's context from the Desktop object in Command Center- Specified by:
getUserProfileContext
in interfaceIDesktop
-
getActiveTabTitle
public java.lang.String getActiveTabTitle()Return title for current active tab. It should be use in scenarios where new tab is get opened as a result of clicking on link and getTitle of Tab fails because title gets changed after tab initialization.- Returns:
- String title of active tab
-
getAllRoles
public java.util.List<java.lang.String> getAllRoles()Return list of roles for currently logged in user- Returns:
-
clickBlipper
public void clickBlipper() -
clickNotification
public void clickNotification() -
viewAllChatRooms
public void viewAllChatRooms() -
getListOfMenuNames
public java.util.ArrayList<java.lang.String> getListOfMenuNames() -
getGlobalSearch
-
getCommandCenterProperties
public static java.util.Properties getCommandCenterProperties()- Returns:
- the all command center properties
-
getCommandCenterProperty
public static java.lang.String getCommandCenterProperty(java.lang.String key)Returns specific command center property value- Parameters:
key
-- Returns:
-
switchToNeo
Call to this method switches context from currently openedCommandCenter
and logs in toNeoDesktop
-