diff --git a/app/src/androidTest/java/com/wallet/crypto/trustapp/AccountTest.java b/app/src/androidTest/java/com/wallet/crypto/trustapp/AccountTest.java new file mode 100644 index 000000000..97499d374 --- /dev/null +++ b/app/src/androidTest/java/com/wallet/crypto/trustapp/AccountTest.java @@ -0,0 +1,47 @@ +package com.wallet.crypto.trustapp; + +import android.content.Context; +import android.support.test.InstrumentationRegistry; +import android.support.test.runner.AndroidJUnit4; + +import com.wallet.crypto.trustapp.controller.Controller; +import com.wallet.crypto.trustapp.model.VMAccount; + +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * Instrumentation test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class AccountTest { + @Test + public void useAppContext() throws Exception { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getTargetContext(); + } + + @Test + public void deleteAccountTest() { + Controller controller = Controller.get(); + VMAccount account = controller.createAccount("test password"); + assert(account != null); + + try { + controller.deleteAccount(account.getAddress()); + } catch (Exception e) { + assert(false); + } + + assert(controller.getAccount(account.getAddress()) != null); + } + + @Test + public void createAccountTest() { + Controller controller = Controller.get(); + VMAccount account = controller.createAccount("test password"); + assert(account != null); + } +} diff --git a/app/src/androidTest/java/com/wallet/crypto/trustapp/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/wallet/crypto/trustapp/ScreengrabTest.java similarity index 54% rename from app/src/androidTest/java/com/wallet/crypto/trustapp/ExampleInstrumentedTest.java rename to app/src/androidTest/java/com/wallet/crypto/trustapp/ScreengrabTest.java index d6029e74a..992e31362 100644 --- a/app/src/androidTest/java/com/wallet/crypto/trustapp/ExampleInstrumentedTest.java +++ b/app/src/androidTest/java/com/wallet/crypto/trustapp/ScreengrabTest.java @@ -2,20 +2,32 @@ package com.wallet.crypto.trustapp; import android.content.Context; import android.support.test.InstrumentationRegistry; +import android.support.test.rule.ActivityTestRule; import android.support.test.runner.AndroidJUnit4; +import com.wallet.crypto.trustapp.views.TransactionListActivity; + +import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; +//import tools.fastlane.screengrab.Screengrab; + /** * Instrumentation test, which will execute on an Android device. * * @see Testing documentation */ @RunWith(AndroidJUnit4.class) -public class ExampleInstrumentedTest { +public class ScreengrabTest { + + @Rule + public ActivityTestRule activityRule = new ActivityTestRule<>(TransactionListActivity.class); + @Test - public void useAppContext() throws Exception { + public void takeTestScreenshot() throws Exception { + //Screengrab.screenshot("test_screenshot"); + // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); } diff --git a/app/src/main/java/com/wallet/crypto/trustapp/controller/Controller.java b/app/src/main/java/com/wallet/crypto/trustapp/controller/Controller.java index 832f61253..815c8bea8 100644 --- a/app/src/main/java/com/wallet/crypto/trustapp/controller/Controller.java +++ b/app/src/main/java/com/wallet/crypto/trustapp/controller/Controller.java @@ -418,10 +418,6 @@ public class Controller { return ""; } - public void refreshTransactions(TransactionListActivity txnList, OnTaskCompleted listener) { - new GetTransactionsTask(mAccounts, listener).execute(); - } - public ESTransaction findTransaction(String address, String txn_hash) { List txns = mTransactions.get(address);