gecko/mobile/android/base/tests/testNewTab.java.in

43 lines
1.6 KiB
Java

#filter substitution
package @ANDROID_PACKAGE_NAME@.tests;
import @ANDROID_PACKAGE_NAME@.*;
import android.app.Activity;
public class testNewTab extends BaseTest {
public void testNewTab() {
// TODO: find a better way to not hardcode this url
String url = "http://mochi.test:8888/tests/robocop/robocop_blank_01.html";
String url2 = "http://mochi.test:8888/tests/robocop/robocop_blank_02.html";
mActions.expectGeckoEvent("Gecko:Ready").blockForEvent();
Element tabs = mDriver.findElement(getActivity(), "tabs");
// Add one tab
Activity awesomeBarActivity = getActivityFromClick(tabs);
getInstrumentation().waitForIdleSync();
Element urlbar = mDriver.findElement(awesomeBarActivity, "awesomebar_text");
mActions.sendKeys(url);
mAsserter.is(urlbar.getText(), url, "Awesomebar url is fine");
hitEnterAndWait();
// See tab count
Element tabCount = mDriver.findElement(getActivity(), "tabs_count");
mAsserter.is(tabCount.getText(), "2", "Number of tabs has increased");
// Click tab list
Activity tabTray = getActivityFromClick(tabs);
Element addTab = mDriver.findElement(tabTray, "add_tab");
//Add another tab
addTab.click();
getInstrumentation().waitForIdleSync();
mActions.sendKeys(url2);
getInstrumentation().waitForIdleSync();
mAsserter.is(urlbar.getText(), url2, "URL is still fine");
hitEnterAndWait();
//Check tab count another time.
mAsserter.is(tabCount.getText(), "3", "Number of tabs has increased");
}
}