com.ibm.team.fvt.tests.web
Class WebFolderElement

java.lang.Object
  extended by com.ibm.team.fvt.tests.web.WebPageElement
      extended by com.ibm.team.fvt.tests.web.WebElementWrapper
          extended by com.ibm.team.fvt.tests.web.WebFolderElement

public class WebFolderElement
extends WebElementWrapper

Class to handle a folder web element in a web page. A folder may contain multiple folders, which may be several levels deep.

Following features are available on a folder:

Following internal features are available for a folder:


Constructor Summary
WebFolderElement(WebPage page, WebBrowserElement element, org.openqa.selenium.By expandBy, org.openqa.selenium.By expansionBy, org.openqa.selenium.By containerBy)
           
WebFolderElement(WebPage page, WebBrowserElement element, org.openqa.selenium.By expandBy, org.openqa.selenium.By expansionBy, org.openqa.selenium.By containerBy, WebFolderElement parentFolder)
           
WebFolderElement(WebPage page, WebBrowserElement element, WebFolderElement parentFolder)
           
 
Method Summary
 void collapse()
          Collapse the folder.
 void expand()
          Expand the folder.
 java.util.List<WebFolderElement> getAllLeaves()
          Return all leaves of the current folder.
 java.util.List<java.lang.String> getAllPaths()
          Return path for all leaves of the current folder.
 java.util.List<WebFolderElement> getChildren()
          Returns the folder's children.
 WebFolderElement getFolder(java.lang.String folderPath)
          Gets the sub-folder for the given path.
 java.lang.String getPath()
          Returns the path of the current folder.
 java.lang.String getText()
          Return the text of the expandable element.
 WebFolderElement searchFolder(java.lang.String folder)
          Searches the folder with the given name in the hierarchy starting from current folder.
 void select()
          Select the folder.
 WebFolderElement selectFolder(java.lang.String folderPath)
          Selects the sub-folder for the given path.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebFolderElement

public WebFolderElement(WebPage page,
                        WebBrowserElement element,
                        org.openqa.selenium.By expandBy,
                        org.openqa.selenium.By expansionBy,
                        org.openqa.selenium.By containerBy)

WebFolderElement

public WebFolderElement(WebPage page,
                        WebBrowserElement element,
                        org.openqa.selenium.By expandBy,
                        org.openqa.selenium.By expansionBy,
                        org.openqa.selenium.By containerBy,
                        WebFolderElement parentFolder)

WebFolderElement

public WebFolderElement(WebPage page,
                        WebBrowserElement element,
                        WebFolderElement parentFolder)
Method Detail

collapse

public void collapse()
Collapse the folder.


expand

public void expand()
Expand the folder.


getAllLeaves

public java.util.List<WebFolderElement> getAllLeaves()
Return all leaves of the current folder.

Returns:
All folder leaves as a List of WebFolderElement.

getAllPaths

public java.util.List<java.lang.String> getAllPaths()
Return path for all leaves of the current folder.

Returns:
All paths as a List of String.

getChildren

public final java.util.List<WebFolderElement> getChildren()
Returns the folder's children.

Returns:
The list of children as a List of WebFolderElement.

getFolder

public WebFolderElement getFolder(java.lang.String folderPath)
Gets the sub-folder for the given path. If path has several segments, then the search occurs recursively through sub-folders levels to match each segment of the given path.

For example, "JKE Banking/JKE Enterprise Project/Business Goals" accesses the Business Goals sub-sub-folder. To access the top folder or project folder just enter the folder name, ex. "JKE Banking".

Parameters:
folderPath - The folder path. Might be a simple name or a fully-qualified path using '/' character for segment delimiter.
Returns:
The selected folder as a WebFolderElement or null if no folder was not found for the given folder path.

getPath

public java.lang.String getPath()
Returns the path of the current folder.

The path is made of all containing folders texts separated by /'s plus the folder text (e.g. "/Custom Reports/Sample Report Definitions/CCM").

TODO: It seems to be a really costly operation, needs to be improved...


getText

public java.lang.String getText()
Return the text of the expandable element.

Overrides to return the text of the expandable element.

Overrides:
getText in class WebElementWrapper
Returns:
The text as a String.

searchFolder

public WebFolderElement searchFolder(java.lang.String folder)
Searches the folder with the given name in the hierarchy starting from current folder.

There's no indication if the returned folder is the unique one with the given name in the hierarchy, as the first matching folder (deepest first) is returned.

Parameters:
folder - The folder to search in the hierarchy. That might be either a name or a path (absolute or relative).
Returns:
The first folder matching the given name as a WebFolderElement or null if none was found.

select

public void select()
Select the folder.


selectFolder

public WebFolderElement selectFolder(java.lang.String folderPath)
                              throws ScenarioFailedError
Selects the sub-folder for the given path. If path has several segments, then the search occurs recursively through sub-folders levels to match each segment of the given path.

For example, "JKE Banking/JKE Enterprise Project/Business Goals" accesses the Business Goals sub-folder. To access the top folder or project folder just enter the folder name, ex. "JKE Banking".

Parameters:
folderPath - The folder path. Might be a simple name or a fully-qualified path using '/' character for segment delimiter.
Returns:
The selected folder as a WebFolderElement.
Throws:
ScenarioFailedError - if no folder was not found for the given folder path.