|
1 package org.mozilla.gecko.tests; |
|
2 |
|
3 import org.mozilla.gecko.Actions; |
|
4 import org.mozilla.gecko.Element; |
|
5 import org.mozilla.gecko.R; |
|
6 |
|
7 /* Tests related to the about: page: |
|
8 * - check that about: loads from the URL bar |
|
9 * - check that about: loads from Settings/About... |
|
10 */ |
|
11 public class testAboutPage extends PixelTest { |
|
12 private void ensureTitleMatches(final String regex) { |
|
13 Element urlBarTitle = mDriver.findElement(getActivity(), R.id.url_bar_title); |
|
14 mAsserter.isnot(urlBarTitle, null, "Got the URL bar title"); |
|
15 assertMatches(urlBarTitle.getText(), regex, "page title match"); |
|
16 } |
|
17 |
|
18 public void testAboutPage() { |
|
19 blockForGeckoReady(); |
|
20 |
|
21 // Load the about: page and verify its title. |
|
22 String url = "about:"; |
|
23 loadAndPaint(url); |
|
24 |
|
25 ensureTitleMatches("About (Fennec|Nightly|Aurora|Firefox|Firefox Beta)"); |
|
26 |
|
27 // Open a new page to remove the about: page from the current tab. |
|
28 url = getAbsoluteUrl("/robocop/robocop_blank_01.html"); |
|
29 inputAndLoadUrl(url); |
|
30 |
|
31 // At this point the page title should have been set. |
|
32 ensureTitleMatches("Browser Blank Page 01"); |
|
33 |
|
34 // Set up listeners to catch the page load we're about to do. |
|
35 Actions.EventExpecter tabEventExpecter = mActions.expectGeckoEvent("Tab:Added"); |
|
36 Actions.EventExpecter contentEventExpecter = mActions.expectGeckoEvent("DOMContentLoaded"); |
|
37 |
|
38 selectSettingsItem("Mozilla", "About (Fennec|Nightly|Aurora|Firefox|Firefox Beta)"); |
|
39 |
|
40 // Wait for the new tab and page to load |
|
41 tabEventExpecter.blockForEvent(); |
|
42 contentEventExpecter.blockForEvent(); |
|
43 |
|
44 tabEventExpecter.unregisterListener(); |
|
45 contentEventExpecter.unregisterListener(); |
|
46 |
|
47 // Grab the title to make sure the about: page was loaded. |
|
48 ensureTitleMatches("About (Fennec|Nightly|Aurora|Firefox|Firefox Beta)"); |
|
49 } |
|
50 } |