HTML and CSS Reference
In-Depth Information
// Check that the name entered is the one expected
assertEquals("Welcome message missing",
browser.getText("id=hello-form:output-message"),
"Hello Clutch Powers");
}
/**
* Scenario: I enter the page.
* Given that I enter page
* When I do nothing
* Then I there will be no greeting displayed
*/
@Test
public void helloyou_OpenPage_GreetingHidden() {
String startUrl = contextPath.toString() + "faces/hello-you.xhtml";
// Open the hello-you page
browser.open(startUrl);
// Check that the "Hello <name>" element is NOT displayed on the screen
assertFalse(browser.isVisible("id=hello-form:output-message"));
}
}
The DefaultSelenium Drone is capable of simulating many kinds of browser interactions. A sample of interesting
methods are highlighted in Table 11-7 .
Table 11-7. Sample of DefaultSelenium Methods Used for Simulating User Interaction
Method
Description
attachFile(fieldLocator, fileLocation)
Used for attaching files in a file input form field
Click(locator)
Clicks a given element with the specified locator
doubleClick(locator)
Double clicks a given element with the specified locator
dragAndDrop(locator, movements)
Simulates a drag and drop from a source to a location
getText(locator)
Gets the text in a given element
isVisible(locator)
Determines if a given element is visible on the screen
Open(url)
Opens a given page
typeKeys(location, value)
Types a value into a given input field
waitForPageToLoad(timeout)
Waits a given number of milliseconds for the page to load
Summary
In this chapter we explored design considerations for developing JSF applications such as security, performance,
and memory consumption. We also looked at how to use the <f:ajax /> tag to Ajaxifying JSF applications. Using
the <f:ajax /> tag it is possible to set up Ajax requests on individual as well as a group of JSF components. To
supplement the <f:ajax /> tag we went behind the scenes to explore the JSF JavaScript API. Lastly we looked
at testing JSF applications using the Aqullian testing framework coupled with the Drone extension that enables
functional testing of the JSF applications.
 
Search WWH ::




Custom Search