Skip to content

Commit

Permalink
Update version for v2.0.1-beta1 release
Browse files Browse the repository at this point in the history
Improve reliability of UI tests
  • Loading branch information
codinguser committed Nov 4, 2015
1 parent e6dcef8 commit a304308
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
4 changes: 3 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ apply plugin: 'io.fabric'
def versionMajor = 2
def versionMinor = 0
def versionPatch = 1
def versionBuild = 0
def versionBuild = 1

def buildTime() {
def df = new SimpleDateFormat("yyyyMMdd HH:mm 'UTC'")
Expand Down Expand Up @@ -138,11 +138,13 @@ afterEvaluate {
output.eachLine {
def serial = it.split("\\s")[0]
commandLine "$adb -s $serial shell pm grant $android.productFlavors.development.applicationId android.permission.SET_ANIMATION_SCALE".split(' ')
commandLine "$adb -s $serial shell pm grant $android.productFlavors.development.applicationId android.permission.WRITE_EXTERNAL_STORAGE".split(' ')
}
}

task grantAnimationPermissionProduction(type: Exec, dependsOn: 'installProductionDebug'){
commandLine "$adb -e shell pm grant $android.defaultConfig.applicationId android.permission.SET_ANIMATION_SCALE".split(' ')
commandLine "$adb -e shell pm grant $android.defaultConfig.applicationId android.permission.WRITE_EXTERNAL_STORAGE".split(' ')
}
// When launching individual tests from Android Studio, it seems that only the assemble tasks
// get called directly, not the install* versions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.gnucash.android.test.ui;

import android.Manifest;
import android.app.AlertDialog;
import android.content.pm.PackageManager;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
Expand Down Expand Up @@ -48,8 +49,10 @@
import org.gnucash.android.ui.account.AccountsActivity;
import org.junit.After;
import org.junit.Before;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;

import java.io.File;
import java.util.Currency;
Expand All @@ -68,6 +71,7 @@
import static org.hamcrest.Matchers.allOf;

@RunWith(AndroidJUnit4.class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class ExportTransactionsTest extends
ActivityInstrumentationTestCase2<AccountsActivity> {

Expand Down Expand Up @@ -136,7 +140,7 @@ public void testOfxExport(){
}

@Test
public void shouldNotOfferXmlExportInSingleEntryMode(){
public void whenInSingleEntry_shouldHideXmlExportOption(){
PreferenceManager.getDefaultSharedPreferences(mAcccountsActivity)
.edit().putBoolean(mAcccountsActivity.getString(R.string.key_use_double_entry), false)
.commit();
Expand Down Expand Up @@ -174,7 +178,7 @@ public void testExport(ExportFormat format){
mAcccountsActivity.requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE}, 0x23);

onView(withId(android.R.id.button1)).perform(click());
onView(withId(AlertDialog.BUTTON_POSITIVE)).perform(click());
}
}

Expand Down Expand Up @@ -216,7 +220,7 @@ public void testDeleteTransactionsAfterExport(){
* Does not work on Travis yet
*/
@Test
public void shouldCreateExportSchedule(){
public void testShouldCreateExportSchedule(){
DrawerActions.openDrawer(R.id.drawer_layout);
onView(withText(R.string.nav_menu_export)).perform(click());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,17 @@ public boolean isInputModified(){
public BigDecimal getValue(){
evaluate();
String amountString = getCleanString();
if (amountString.isEmpty() || !amountString.matches("\\d+")) //value should contain atleast one digit
if (amountString.isEmpty())
return null;
try { //catch any exceptions in the conversion e.g. if a string with only "-" is entered
return new BigDecimal(amountString);
} catch (Exception e){
String msg = "Error parsing amount string " + amountString + " from CalculatorEditText";
Log.i(getClass().getSimpleName(), msg, e);
Crashlytics.log(msg);
Crashlytics.logException(e);
return null;
return new BigDecimal(amountString);
}
}

/**
Expand Down

0 comments on commit a304308

Please sign in to comment.