Bug 716937 - Make the testBookmark test actually pass. r=jmaher

Previously it would type in a URL and then attempt to verify it
as something else. Fix so that it doesn't try to verify a wrong
URL.
This commit is contained in:
Kartikaya Gupta 2012-01-10 14:15:18 -05:00
parent 55837d51d2
commit d43e5e5177
2 changed files with 11 additions and 11 deletions

View File

@ -73,15 +73,20 @@ abstract class BaseTest extends ActivityInstrumentationTestCase2<Activity> {
Instrumentation inst = getInstrumentation();
Instrumentation.ActivityMonitor monitor = inst.addMonitor((String)null, null, false);
element.click();
return inst.waitForMonitor(monitor);
Activity activity = inst.waitForMonitor(monitor);
getInstrumentation().waitForIdleSync();
return activity;
}
protected final Activity clickOnAwesomeBar() {
Element awesomebar = mDriver.findElement(mActivity, "awesome_bar");
return getActivityFromClick(awesomebar);
}
protected final void enterUrl(String url) {
mActions.expectGeckoEvent("Gecko:Ready").blockForEvent();
Element awesomebar = mDriver.findElement(mActivity, "awesome_bar");
Activity awesomeBarActivity = getActivityFromClick(awesomebar);
getInstrumentation().waitForIdleSync();
Activity awesomeBarActivity = clickOnAwesomeBar();
Element urlbar = mDriver.findElement(awesomeBarActivity, "awesomebar_text");
mActions.sendKeys(url);
mAsserter.is(urlbar.getText(), url, "Awesomebar URL typed properly");
@ -100,10 +105,7 @@ abstract class BaseTest extends ActivityInstrumentationTestCase2<Activity> {
}
protected final void verifyUrl(String url) {
Element awesomebar = mDriver.findElement(mActivity, "awesome_bar");
Activity awesomeBarActivity = getActivityFromClick(awesomebar);
getInstrumentation().waitForIdleSync();
Activity awesomeBarActivity = clickOnAwesomeBar();
Element urlbar = mDriver.findElement(awesomeBarActivity, "awesomebar_text");
mAsserter.is(urlbar.getText(), url, "Awesomebar URL stayed the same");
}

View File

@ -13,10 +13,8 @@ public class testBookmark extends BaseTest {
mActions.sendSpecialKey(Actions.SpecialKey.DOWN);
hitEnterAndWait();
verifyUrl(URL);
//Click the Top item in the history list.
getInstrumentation().waitForIdleSync();
clickOnAwesomeBar();
mActions.sendSpecialKey(Actions.SpecialKey.RIGHT);
mActions.sendSpecialKey(Actions.SpecialKey.RIGHT);
getInstrumentation().waitForIdleSync();