2011-12-16 11:27:52 -08:00
|
|
|
#filter substitution
|
|
|
|
package @ANDROID_PACKAGE_NAME@.tests;
|
|
|
|
|
|
|
|
import @ANDROID_PACKAGE_NAME@.*;
|
2012-01-05 18:36:17 -08:00
|
|
|
import android.app.Activity;
|
2011-12-16 11:27:52 -08:00
|
|
|
|
2012-01-05 07:20:22 -08:00
|
|
|
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";
|
2012-01-05 18:36:17 -08:00
|
|
|
mActions.expectGeckoEvent("Gecko:Ready").blockForEvent();
|
2012-01-05 18:36:17 -08:00
|
|
|
Element tabs = mDriver.findElement(getActivity(), "tabs");
|
2012-01-05 07:20:22 -08:00
|
|
|
// Add one tab
|
2012-01-05 18:36:17 -08:00
|
|
|
Activity awesomeBarActivity = getActivityFromClick(tabs);
|
2012-01-05 07:20:22 -08:00
|
|
|
|
|
|
|
getInstrumentation().waitForIdleSync();
|
2012-01-05 18:36:17 -08:00
|
|
|
Element urlbar = mDriver.findElement(awesomeBarActivity, "awesomebar_text");
|
2012-01-05 07:20:22 -08:00
|
|
|
mActions.sendKeys(url);
|
|
|
|
mAsserter.is(urlbar.getText(), url, "Awesomebar url is fine");
|
2012-01-05 18:36:17 -08:00
|
|
|
hitEnterAndWait();
|
2012-01-05 07:20:22 -08:00
|
|
|
|
|
|
|
// See tab count
|
2012-01-05 18:36:17 -08:00
|
|
|
Element tabCount = mDriver.findElement(getActivity(), "tabs_count");
|
2012-01-05 07:20:22 -08:00
|
|
|
mAsserter.is(tabCount.getText(), "2", "Number of tabs has increased");
|
|
|
|
|
|
|
|
// Click tab list
|
2012-01-05 18:36:17 -08:00
|
|
|
Activity tabTray = getActivityFromClick(tabs);
|
|
|
|
Element addTab = mDriver.findElement(tabTray, "add_tab");
|
2012-01-05 07:20:22 -08:00
|
|
|
|
|
|
|
//Add another tab
|
|
|
|
addTab.click();
|
|
|
|
getInstrumentation().waitForIdleSync();
|
|
|
|
mActions.sendKeys(url2);
|
|
|
|
getInstrumentation().waitForIdleSync();
|
|
|
|
mAsserter.is(urlbar.getText(), url2, "URL is still fine");
|
|
|
|
|
2012-01-05 18:36:17 -08:00
|
|
|
hitEnterAndWait();
|
2012-01-05 07:20:22 -08:00
|
|
|
//Check tab count another time.
|
|
|
|
mAsserter.is(tabCount.getText(), "3", "Number of tabs has increased");
|
|
|
|
}
|
2011-12-16 11:27:52 -08:00
|
|
|
}
|