Skip to content

Commit

Permalink
Merge branch 'master' of github.com:rapidftr/RapidFTR---Android
Browse files Browse the repository at this point in the history
  • Loading branch information
kishoreyekkanti committed Feb 11, 2013
2 parents c976144 + c3da08b commit e6c50d2
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.rapidftr.activity.pages.LoginPage;
import com.rapidftr.activity.pages.SearchChildrenPage;
import com.rapidftr.activity.pages.ViewAllChildrenPage;
import com.rapidftr.repository.ChildRepository;

public abstract class BaseActivityIntegrationTest extends ActivityInstrumentationTestCase2<LoginActivity> {

Expand All @@ -18,6 +19,9 @@ public abstract class BaseActivityIntegrationTest extends ActivityInstrumentatio
public RapidFtrApplication application;


RapidFtrApplication context = RapidFtrApplication.getApplicationInstance() ;
ChildRepository repository=context.getInjector().getInstance(ChildRepository.class);

final String ALPHA_NUM = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";

public BaseActivityIntegrationTest() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.rapidftr.activity;

import android.content.Context;
import android.net.wifi.WifiManager;
import android.test.suitebuilder.annotation.Smoke;
import com.rapidftr.R;

Expand Down Expand Up @@ -47,4 +49,27 @@ public void testUserIsAlertedWhenAttemptingToLogoutWhileSyncInProgress() throws
solo.assertCurrentActivity("should log out and go to login page", LoginActivity.class);
}

public void testUserAbleToLoginOfflineAfterOneSuccessfulLogin(){
loginPage.login();
solo.waitForText("Login Successful");
boolean wifi=false;
turnWifi(wifi);
System.out.println("hello");
}



protected void turnWifi(boolean status) {
try {
WifiManager wifiManager = (WifiManager) getInstrumentation()
.getTargetContext().getSystemService(Context.WIFI_SERVICE);
// WifiManager wifiManager = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE);
wifiManager.setWifiEnabled(status);
} catch (Exception ignored) {
// don't interrupt test execution, if there
// is no permission for that action
}
}


}

0 comments on commit e6c50d2

Please sign in to comment.