org.seleniuminspector
Class SeleniumTestCase

java.lang.Object
  extended by org.junit.Assert
      extended by org.seleniuminspector.SeleniumTestCase

public abstract class SeleniumTestCase
extends org.junit.Assert

A base class for TestCase classes using the SeleniumInspector framework. It provides access to the APIs for loading and inspecting Web pages. Rich possibilities for inspecting contents of Web pages can be accessed using the hierarchy of ElementInspector classes. Each instance of ElementInspector (or actually of its subclasses) corresponds to an appropriate DOM element and provides various possibilities for inspection (style inspection, JavaScript-based element/function inspection, etc.), and navigation though child elements. In fact ElementInspectors are not restricted to simple DOM elements, and there is a hierarchy of inspectors that even allow inspecting the entire JSF components. (todo in fact this hierarchy is being created currently)

The root access points to inspecting page contents are the window(), and elementById() functions.

Note, that there are a lot of component-specific deprecated classes and constants in this class. Avoid using them, they are going to be removed and integrated into the ElementInspector hierarchy.


Nested Class Summary
protected static class SeleniumTestCase.EventType
           
 
Constructor Summary
SeleniumTestCase()
           
 
Method Summary
protected  void assertConversionErrorOccured(boolean errorExpected)
           
protected  void assertNoAlert(java.lang.String messagePrefix)
           
protected  void assertPageAvailable(java.lang.String pageUrl, java.lang.String expectedPageTitle)
           
protected  void assertPageContainsErrorIcon(boolean shouldContainIcon)
           
protected  void createEvent(ElementInspector containerElement, java.lang.String elementPath, SeleniumTestCase.EventType eventType, java.lang.String eventName, int keyCode, boolean shiftPressed)
           
protected  ElementInspector element(java.lang.String elementLocator)
           
static com.thoughtworks.selenium.Selenium getSelenium()
           
protected  java.lang.String getUniqueName(java.lang.String originalName)
          Using current page as list of names, generate unique name (such as "Group23")
protected  boolean isMessageTextPresent(java.lang.String text)
           
protected  void openAndWait(java.lang.String pageUrl)
           
protected  void openAndWait(java.lang.String applicationContextPrefix, java.lang.String applicationPage)
           
static void sleep(long millis)
           
protected  void waitForPageToLoad()
           
protected static WindowInspector window()
           
 
Methods inherited from class org.junit.Assert
assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertThat, assertThat, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SeleniumTestCase

public SeleniumTestCase()
Method Detail

getSelenium

public static com.thoughtworks.selenium.Selenium getSelenium()

sleep

public static void sleep(long millis)

openAndWait

protected void openAndWait(java.lang.String pageUrl)

openAndWait

protected void openAndWait(java.lang.String applicationContextPrefix,
                           java.lang.String applicationPage)

waitForPageToLoad

protected void waitForPageToLoad()

assertPageAvailable

protected void assertPageAvailable(java.lang.String pageUrl,
                                   java.lang.String expectedPageTitle)

assertNoAlert

protected void assertNoAlert(java.lang.String messagePrefix)

getUniqueName

protected java.lang.String getUniqueName(java.lang.String originalName)
Using current page as list of names, generate unique name (such as "Group23")

Parameters:
originalName - an original name
Returns:
unique item name to create

isMessageTextPresent

protected boolean isMessageTextPresent(java.lang.String text)

assertPageContainsErrorIcon

protected void assertPageContainsErrorIcon(boolean shouldContainIcon)

assertConversionErrorOccured

protected void assertConversionErrorOccured(boolean errorExpected)

createEvent

protected void createEvent(ElementInspector containerElement,
                           java.lang.String elementPath,
                           SeleniumTestCase.EventType eventType,
                           java.lang.String eventName,
                           int keyCode,
                           boolean shiftPressed)

window

protected static WindowInspector window()
Returns:
an ElementInspector instance that corresponds to the currently tested window

element

protected ElementInspector element(java.lang.String elementLocator)
Parameters:
elementLocator - Selenium element locator
Returns:
ElementInspector for an element referred by the specified locator
See Also:
Selenium


Copyright © 1998-2009 TeamDev Ltd. All Rights Reserved.