2012-02-11 21:52:59 -08:00
|
|
|
#filter substitution
|
|
|
|
package @ANDROID_PACKAGE_NAME@.tests;
|
|
|
|
|
|
|
|
import @ANDROID_PACKAGE_NAME@.*;
|
|
|
|
import android.app.Activity;
|
|
|
|
import android.util.Log;
|
|
|
|
|
2012-09-18 09:36:40 -07:00
|
|
|
/* Tests related to the about: page:
|
|
|
|
* - check that about: loads from the awesome bar
|
|
|
|
* - check that about: loads from Settings/About...
|
|
|
|
*/
|
2012-08-23 08:20:42 -07:00
|
|
|
public class testAboutPage extends PixelTest {
|
2012-06-27 16:56:49 -07:00
|
|
|
@Override
|
|
|
|
protected int getTestType() {
|
|
|
|
return TEST_MOCHITEST;
|
|
|
|
}
|
|
|
|
|
2012-02-11 21:52:59 -08:00
|
|
|
public void testAboutPage() {
|
|
|
|
mActions.expectGeckoEvent("Gecko:Ready").blockForEvent();
|
|
|
|
|
2012-09-18 09:36:40 -07:00
|
|
|
// Load the about: page and verify its title
|
2012-02-11 21:52:59 -08:00
|
|
|
String url = "about:";
|
2012-08-23 08:20:42 -07:00
|
|
|
loadAndPaint(url);
|
2012-02-11 21:52:59 -08:00
|
|
|
|
2012-08-23 11:27:11 -07:00
|
|
|
Element awesomebar = mDriver.findElement(getActivity(), "awesome_bar_title");
|
2012-06-10 16:44:50 -07:00
|
|
|
mAsserter.isnot(awesomebar, null, "Got the awesomebar");
|
|
|
|
assertMatches(awesomebar.getText(), "About (Fennec|Nightly|Aurora|Firefox|Firefox Beta)", "page title match");
|
2012-02-11 21:52:59 -08:00
|
|
|
|
|
|
|
// 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$")) {
|
2012-09-18 09:36:40 -07:00
|
|
|
mAsserter.dumpLog("found More item in menu");
|
2012-02-11 21:52:59 -08:00
|
|
|
mSolo.clickOnText("^More$");
|
|
|
|
}
|
|
|
|
|
2012-09-18 09:36:40 -07:00
|
|
|
if (mSolo.waitForText("^Settings$")) {
|
|
|
|
mAsserter.dumpLog("found Settings item in menu");
|
|
|
|
}
|
2012-02-11 21:52:59 -08:00
|
|
|
mSolo.clickOnText("^Settings$");
|
|
|
|
|
2012-03-23 08:43:10 -07:00
|
|
|
// 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");
|
|
|
|
|
2012-02-11 21:52:59 -08:00
|
|
|
// Tap on the "About Xxxx" setting
|
2012-09-18 09:36:40 -07:00
|
|
|
if (mSolo.waitForText("About (Fennec|Nightly|Aurora|Firefox|Firefox Beta)")) {
|
|
|
|
mAsserter.dumpLog("found About... title text");
|
|
|
|
}
|
2012-06-10 16:44:50 -07:00
|
|
|
mSolo.clickOnText("About (Fennec|Nightly|Aurora|Firefox|Firefox Beta)");
|
2012-02-11 21:52:59 -08:00
|
|
|
|
|
|
|
// Wait for the new tab and page to load
|
2012-03-23 08:43:10 -07:00
|
|
|
tabEventExpecter.blockForEvent();
|
|
|
|
contentEventExpecter.blockForEvent();
|
2012-02-11 21:52:59 -08:00
|
|
|
|
|
|
|
// Grab the title to make sure the about: page was loaded
|
2012-08-23 11:27:11 -07:00
|
|
|
awesomebar = mDriver.findElement(getActivity(), "awesome_bar_title");
|
2012-06-10 16:44:50 -07:00
|
|
|
mAsserter.isnot(awesomebar, null, "Got the awesomebar");
|
|
|
|
assertMatches(awesomebar.getText(), "About (Fennec|Nightly|Aurora|Firefox|Firefox Beta)", "page title match");
|
2012-02-11 21:52:59 -08:00
|
|
|
}
|
|
|
|
}
|