gecko-dev/mobile/android/base/tests/testAboutPage.java.in
Brian Nicholson fe44f36220 Bug 850487 - More code cleanup (@Overrides and unused imports). r=kats
--HG--
extra : rebase_source : 376574e0c41b91c16a6be335584a4a61768bb4a9
2013-03-13 13:20:57 -07:00

65 lines
2.4 KiB
Java

#filter substitution
package @ANDROID_PACKAGE_NAME@.tests;
import @ANDROID_PACKAGE_NAME@.*;
/* Tests related to the about: page:
* - check that about: loads from the awesome bar
* - check that about: loads from Settings/About...
*/
public class testAboutPage extends PixelTest {
@Override
protected int getTestType() {
return TEST_MOCHITEST;
}
public void testAboutPage() {
blockForGeckoReady();
// Load the about: page and verify its title
String url = "about:";
loadAndPaint(url);
Element awesomebar = mDriver.findElement(getActivity(), "awesome_bar_title");
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$")) {
mAsserter.dumpLog("found More item in menu");
mSolo.clickOnText("^More$");
}
if (mSolo.waitForText("^Settings$")) {
mAsserter.dumpLog("found Settings item in menu");
}
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
if (mSolo.waitForText("About (Fennec|Nightly|Aurora|Firefox|Firefox Beta)")) {
mAsserter.dumpLog("found About... title text");
}
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_title");
mAsserter.isnot(awesomebar, null, "Got the awesomebar");
assertMatches(awesomebar.getText(), "About (Fennec|Nightly|Aurora|Firefox|Firefox Beta)", "page title match");
}
}