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

42 lines
1.4 KiB
Java

#filter substitution
package @ANDROID_PACKAGE_NAME@.tests;
import @ANDROID_PACKAGE_NAME@.*;
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("tabs");
// Add one tab
tabs.click();
Element urlbar = mDriver.findElement("awesomebar_text");
getInstrumentation().waitForIdleSync();
mActions.sendKeys(url);
mAsserter.is(urlbar.getText(), url, "Awesomebar url is fine");
hitEnterAndWait();
// See tab count
Element tabCount = mDriver.findElement("tabs_count");
mAsserter.is(tabCount.getText(), "2", "Number of tabs has increased");
// Click tab list
tabs.click();
Element addTab = mDriver.findElement("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");
}
}