Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
he9lin committed Apr 15, 2012
1 parent bf273a3 commit 8737e38
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ public final void testBrowsesOffers() throws JSONException {
signoutUser();
createUser();
JSONObject offer = createOffer(listing.getString("id"));
solo.clickOnScreen(Fixtures.ACTIVITY_X, Fixtures.MENU_Y);
// Click on sellings
solo.clickOnScreen(300, 50);
clickOnMyActivityMainTab();
solo.clickOnText("我要卖");
assertTrue(solo.searchText(listing.getString("title")));
assertTrue(solo.searchText(offer.getString("price")));
assertTrue(solo.searchText("等待确认"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ public UserBrowsesWantsTests() {
}

private void refreshMyActivity() {
solo.clickOnScreen(Fixtures.BROWSE_X, Fixtures.MENU_Y);
solo.clickOnView(solo.getView(R.id.main_rbtn_MyActivity));
clickOnBrowseMainTab();
clickOnMyActivityMainTab();
}

public final void testBrowsesListings() throws JSONException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public final void testUserMakesOfferWithoutLogin() throws JSONException {
solo.enterText(1, userJSON.getString("password"));

clickOnSigninButton();
solo.waitForActivity("ListingActivity");
solo.assertCurrentActivity("ListingActivity", ListingActivity.class);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ public final void testUserModifyPrice() throws JSONException {

clickOnMyActivityMainTab();

// Click on sellings
solo.clickOnScreen(300, 50);
solo.clickOnText("我要卖");
solo.clickOnText(listing.getString("title"));
assertTrue(solo.searchText("37.37"));
solo.assertCurrentActivity("Should be on offer page", ProvideActivity.class);
Expand All @@ -58,10 +57,9 @@ public final void testUserSendsMessage() throws JSONException {
createUser();
createOffer(listing.getString("id"));

solo.clickOnScreen(Fixtures.ACTIVITY_X, Fixtures.MENU_Y); // my activity
clickOnMyActivityMainTab();

// Click on sellings
solo.clickOnScreen(300, 50);
solo.clickOnText("我要卖");
solo.clickOnText(listing.getString("title"));
assertTrue(solo.searchText("37.37"));
solo.assertCurrentActivity("Should be on offer page", ProvideActivity.class);
Expand Down
17 changes: 14 additions & 3 deletions src/jieqoo/android/KASS/models/test/AccountTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@
*/
package jieqoo.android.KASS.models.test;

import org.json.JSONException;
import org.json.JSONObject;

import jieqoo.android.KASS.Main;
import jieqoo.android.KASS.models.Account;
import jieqoo.android.KASS.models.IntentMeta;
import jieqoo.android.KASS.models.RESTListener;
import jieqoo.android.KASS.test.Factory;
import junit.framework.TestCase;

import org.json.JSONException;
import org.json.JSONObject;

/**
* @author linhe
*
Expand Down Expand Up @@ -114,4 +116,13 @@ public void onError(Object response) {
assertFalse(Factory.acquireAuth());
assertTrue(called);
}

public final void testRegisterAndConsumeAfterAuthenticationIntention() {
IntentMeta im = new IntentMeta(Main.class);
account.registerAfterAuthenticationIntention(im);
IntentMeta im2 = account.consumeAfterAuthenticationIntention();
assertNotNull(im2);
assertEquals(Main.class, im2.getActivityClass());
assertNull(account.consumeAfterAuthenticationIntention());
}
}

0 comments on commit 8737e38

Please sign in to comment.