gecko/mobile/android/base/tests/testAboutPage.java.in
Matt Brubeck 460cc5213b Bug 762632 - Add an assertMatches method to BaseTest for better failure diagnostics [r=kats]
--HG--
extra : rebase_source : cb02e7ffd4f9d7655b315b28e21433fcb8a3c764
2012-06-08 11:43:23 -07:00

54 lines
2.1 KiB
Java

#filter substitution
package @ANDROID_PACKAGE_NAME@.tests;
import @ANDROID_PACKAGE_NAME@.*;
import android.app.Activity;
import android.util.Log;
public class testAboutPage extends BaseTest {
public void testAboutPage() {
setTestType("mochitest");
mActions.expectGeckoEvent("Gecko:Ready").blockForEvent();
// Load the about: page
String url = "about:";
loadUrl(url);
Element awesomebar = mDriver.findElement(getActivity(), "awesome_bar");
mAsserter.isnot(awesomebar, null, "Got the awesomebar");
assertMatches(awesomebar.getText(), "About (Fennec|Nightly|Aurora|Firefox|Firefox Beta)", "page title match");
// Open a new page to remove the about: page from the current tab
url = getAbsoluteUrl("/robocop/robocop_blank_01.html");
loadUrl(url);
// Use the menu to open the Settings
mActions.sendSpecialKey(Actions.SpecialKey.MENU);
// Look for the 'More' menu if this device/OS uses it
if (mSolo.waitForText("^More$")) {
mSolo.clickOnText("^More$");
}
mSolo.waitForText("^Settings$");
mSolo.clickOnText("^Settings$");
// Set up listeners to catch the page load we're about to do
Actions.EventExpecter tabEventExpecter = mActions.expectGeckoEvent("Tab:Added");
Actions.EventExpecter contentEventExpecter = mActions.expectGeckoEvent("DOMContentLoaded");
// Tap on the "About Xxxx" setting
mSolo.waitForText("About (Fennec|Nightly|Aurora|Firefox|Firefox Beta)");
mSolo.clickOnText("About (Fennec|Nightly|Aurora|Firefox|Firefox Beta)");
// Wait for the new tab and page to load
tabEventExpecter.blockForEvent();
contentEventExpecter.blockForEvent();
// Grab the title to make sure the about: page was loaded
awesomebar = mDriver.findElement(getActivity(), "awesome_bar");
mAsserter.isnot(awesomebar, null, "Got the awesomebar");
assertMatches(awesomebar.getText(), "About (Fennec|Nightly|Aurora|Firefox|Firefox Beta)", "page title match");
}
}