2013-11-07 08:18:51 -08:00
|
|
|
package org.mozilla.gecko.tests;
|
2012-02-11 21:52:59 -08:00
|
|
|
|
2014-04-01 22:00:47 -07:00
|
|
|
import org.mozilla.gecko.Actions;
|
|
|
|
import org.mozilla.gecko.Element;
|
|
|
|
import org.mozilla.gecko.R;
|
2012-02-11 21:52:59 -08:00
|
|
|
|
2012-09-18 09:36:40 -07:00
|
|
|
/* Tests related to the about: page:
|
2013-07-18 16:02:48 -07:00
|
|
|
* - check that about: loads from the URL bar
|
2012-09-18 09:36:40 -07:00
|
|
|
* - check that about: loads from Settings/About...
|
|
|
|
*/
|
2012-08-23 08:20:42 -07:00
|
|
|
public class testAboutPage extends PixelTest {
|
2013-12-03 20:21:33 -08:00
|
|
|
private void ensureTitleMatches(final String regex) {
|
2014-02-11 18:08:56 -08:00
|
|
|
Element urlBarTitle = mDriver.findElement(getActivity(), R.id.url_bar_title);
|
2013-12-03 20:21:33 -08:00
|
|
|
mAsserter.isnot(urlBarTitle, null, "Got the URL bar title");
|
|
|
|
assertMatches(urlBarTitle.getText(), regex, "page title match");
|
|
|
|
}
|
|
|
|
|
2012-02-11 21:52:59 -08:00
|
|
|
public void testAboutPage() {
|
2012-10-25 12:37:39 -07:00
|
|
|
blockForGeckoReady();
|
2012-02-11 21:52:59 -08:00
|
|
|
|
2013-12-03 20:21:33 -08: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
|
|
|
|
2014-09-16 13:56:52 -07:00
|
|
|
ensureTitleMatches(StringHelper.ABOUT_LABEL);
|
2012-02-11 21:52:59 -08:00
|
|
|
|
2013-12-03 20:21:33 -08:00
|
|
|
// Open a new page to remove the about: page from the current tab.
|
2014-09-16 13:56:52 -07:00
|
|
|
url = getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_01_URL);
|
2013-08-19 13:33:49 -07:00
|
|
|
inputAndLoadUrl(url);
|
2012-02-11 21:52:59 -08:00
|
|
|
|
2013-12-03 20:21:33 -08:00
|
|
|
// At this point the page title should have been set.
|
2014-09-16 13:56:52 -07:00
|
|
|
ensureTitleMatches(StringHelper.ROBOCOP_BLANK_PAGE_01_TITLE);
|
2013-12-03 20:21:33 -08:00
|
|
|
|
|
|
|
// Set up listeners to catch the page load we're about to do.
|
2012-03-23 08:43:10 -07:00
|
|
|
Actions.EventExpecter tabEventExpecter = mActions.expectGeckoEvent("Tab:Added");
|
|
|
|
Actions.EventExpecter contentEventExpecter = mActions.expectGeckoEvent("DOMContentLoaded");
|
|
|
|
|
2014-09-16 13:56:52 -07:00
|
|
|
selectSettingsItem(StringHelper.MOZILLA_SECTION_LABEL, StringHelper.ABOUT_LABEL);
|
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
|
|
|
|
2013-04-18 20:18:09 -07:00
|
|
|
tabEventExpecter.unregisterListener();
|
|
|
|
contentEventExpecter.unregisterListener();
|
|
|
|
|
2013-12-03 20:21:33 -08:00
|
|
|
// Grab the title to make sure the about: page was loaded.
|
2014-09-16 13:56:52 -07:00
|
|
|
ensureTitleMatches(StringHelper.ABOUT_LABEL);
|
2012-02-11 21:52:59 -08:00
|
|
|
}
|
|
|
|
}
|