2013-11-07 16:18:51 +00:00
|
|
|
package org.mozilla.gecko.tests;
|
2012-02-12 05:52:59 +00:00
|
|
|
|
2014-04-02 05:00:47 +00:00
|
|
|
import org.mozilla.gecko.Actions;
|
|
|
|
import org.mozilla.gecko.Element;
|
|
|
|
import org.mozilla.gecko.R;
|
2012-02-12 05:52:59 +00:00
|
|
|
|
2012-09-18 16:36:40 +00:00
|
|
|
/* Tests related to the about: page:
|
2013-07-18 23:02:48 +00:00
|
|
|
* - check that about: loads from the URL bar
|
2012-09-18 16:36:40 +00:00
|
|
|
* - check that about: loads from Settings/About...
|
|
|
|
*/
|
2012-08-23 15:20:42 +00:00
|
|
|
public class testAboutPage extends PixelTest {
|
2013-12-04 04:21:33 +00:00
|
|
|
private void ensureTitleMatches(final String regex) {
|
2014-02-12 02:08:56 +00:00
|
|
|
Element urlBarTitle = mDriver.findElement(getActivity(), R.id.url_bar_title);
|
2013-12-04 04:21:33 +00:00
|
|
|
mAsserter.isnot(urlBarTitle, null, "Got the URL bar title");
|
|
|
|
assertMatches(urlBarTitle.getText(), regex, "page title match");
|
|
|
|
}
|
|
|
|
|
2012-02-12 05:52:59 +00:00
|
|
|
public void testAboutPage() {
|
2012-10-25 19:37:39 +00:00
|
|
|
blockForGeckoReady();
|
2012-02-12 05:52:59 +00:00
|
|
|
|
2013-12-04 04:21:33 +00:00
|
|
|
// Load the about: page and verify its title.
|
2012-02-12 05:52:59 +00:00
|
|
|
String url = "about:";
|
2012-08-23 15:20:42 +00:00
|
|
|
loadAndPaint(url);
|
2012-02-12 05:52:59 +00:00
|
|
|
|
2013-12-04 04:21:33 +00:00
|
|
|
ensureTitleMatches("About (Fennec|Nightly|Aurora|Firefox|Firefox Beta)");
|
2012-02-12 05:52:59 +00:00
|
|
|
|
2013-12-04 04:21:33 +00:00
|
|
|
// Open a new page to remove the about: page from the current tab.
|
2012-02-12 05:52:59 +00:00
|
|
|
url = getAbsoluteUrl("/robocop/robocop_blank_01.html");
|
2013-08-19 20:33:49 +00:00
|
|
|
inputAndLoadUrl(url);
|
2012-02-12 05:52:59 +00:00
|
|
|
|
2013-12-04 04:21:33 +00:00
|
|
|
// At this point the page title should have been set.
|
|
|
|
ensureTitleMatches("Browser Blank Page 01");
|
|
|
|
|
|
|
|
// Set up listeners to catch the page load we're about to do.
|
2012-03-23 15:43:10 +00:00
|
|
|
Actions.EventExpecter tabEventExpecter = mActions.expectGeckoEvent("Tab:Added");
|
|
|
|
Actions.EventExpecter contentEventExpecter = mActions.expectGeckoEvent("DOMContentLoaded");
|
|
|
|
|
2013-06-26 17:57:52 +00:00
|
|
|
selectSettingsItem("Mozilla", "About (Fennec|Nightly|Aurora|Firefox|Firefox Beta)");
|
2012-02-12 05:52:59 +00:00
|
|
|
|
|
|
|
// Wait for the new tab and page to load
|
2012-03-23 15:43:10 +00:00
|
|
|
tabEventExpecter.blockForEvent();
|
|
|
|
contentEventExpecter.blockForEvent();
|
2012-02-12 05:52:59 +00:00
|
|
|
|
2013-04-19 03:18:09 +00:00
|
|
|
tabEventExpecter.unregisterListener();
|
|
|
|
contentEventExpecter.unregisterListener();
|
|
|
|
|
2013-12-04 04:21:33 +00:00
|
|
|
// Grab the title to make sure the about: page was loaded.
|
|
|
|
ensureTitleMatches("About (Fennec|Nightly|Aurora|Firefox|Firefox Beta)");
|
2012-02-12 05:52:59 +00:00
|
|
|
}
|
|
|
|
}
|