mobile/android/base/tests/testAboutPage.java.in
author Lucas Rocha <lucasr@mozilla.com>
Thu, 23 Aug 2012 19:27:11 +0100
changeset 105458 fde4b39fa70805ed32e7f6989146f7079c4a1f22
parent 105209 78d6548c9c2340e6d974ca03911a894be412bc29
child 107495 09c5ad99ae92299f99c8809a53e66f86181969f5
permissions -rw-r--r--
Bug 771380 - Reorganize toolbar layout to better handle dynamic icons (r=sriram) * * * fold me * * * title fix

#filter substitution
package @ANDROID_PACKAGE_NAME@.tests;

import @ANDROID_PACKAGE_NAME@.*;
import android.app.Activity;
import android.util.Log;

public class testAboutPage extends PixelTest {
    @Override
    protected int getTestType() {
        return TEST_MOCHITEST;
    }

    public void testAboutPage() {
        mActions.expectGeckoEvent("Gecko:Ready").blockForEvent();

        // Load the about: page
        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$")) {
            mSolo.clickOnText("^More$");
        }

        mSolo.waitForText("^Settings$");
        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
        mSolo.waitForText("About (Fennec|Nightly|Aurora|Firefox|Firefox Beta)");
        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");
    }
}