Skip to content

Commit

Permalink
Merge pull request #197 from odk-x/demo
Browse files Browse the repository at this point in the history
2.1.9 release
  • Loading branch information
wbrunette authored Dec 16, 2021
2 parents 67d4ac0 + 81ec22c commit 87f0f33
Show file tree
Hide file tree
Showing 13 changed files with 162 additions and 246 deletions.
11 changes: 5 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,20 @@
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.3'
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:4.9.8'
classpath 'com.google.gms:google-services:4.3.5'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.5.2'
classpath 'com.android.tools.build:gradle:4.2.2'
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:4.23.4'
classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'
}
}

allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven {
url "https://jitpack.io"
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
18 changes: 5 additions & 13 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
gradle.ext.gradleConfigVersion = 150

if ( !gradle.ext.has('workspacePath') ) {
def env = System.getProperties();
logger.warn("tables/settings.gradle System.getProperties().stringPropertyNames(): " + env.stringPropertyNames());
def path = System.getProperty('com.android.studio.gradle.project.path');
if ( path != null ) {
logger.warn("tables/settings.gradle Found value for System.getProperty('com.android.studio.gradle.project.path')");
gradle.ext.workspacePath = (new File(path)).getParentFile().getAbsolutePath();
} else {
logger.warn("tables/settings.gradle No value found for System.getProperty('com.android.studio.gradle.project.path')");
gradle.ext.workspacePath = new File("..").getAbsolutePath();
}
gradle.ext.gradleConfigVersion = 155

if (!gradle.ext.has('workspacePath')) {
logger.warn("rootDir: " + rootDir.getAbsolutePath());
gradle.ext.workspacePath = rootDir.getParentFile().getAbsolutePath();
}

logger.warn('tables/settings.gradle -- gradle.ext.workspacePath: ' + gradle.ext.workspacePath)
Expand Down
29 changes: 13 additions & 16 deletions tables_app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ android {

testApplicationId(groupId + tablesName + testNameSuffix)
testInstrumentationRunner(instrumentationRunner)

multiDexEnabled true
}

flavorDimensions "stage", "testing"
Expand Down Expand Up @@ -126,17 +124,16 @@ allprojects {
dependencies {
implementation 'androidx.annotation:annotation:1.2.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.fragment:fragment:1.3.2'
implementation 'androidx.fragment:fragment:1.3.6'
implementation 'androidx.preference:preference:1.1.1'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'com.github.wbrunette:ProgressWheel:3.4'

implementation 'com.google.firebase:firebase-analytics:18.0.2'
implementation 'com.google.firebase:firebase-crashlytics:17.4.1'
implementation 'com.google.firebase:firebase-analytics:19.0.2'
implementation 'com.google.firebase:firebase-crashlytics:18.2.3'

implementation 'androidx.multidex:multidex:2.0.1'

if (libraryProjectPath.exists() && gradle.useLocal) { // Local project is favoured
implementation project(libraryProjectName)
Expand All @@ -160,15 +157,15 @@ dependencies {
classifier: snapshotRelease, version: latestVersion, ext: 'aar')
}

implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.android.gms:play-services-maps:17.0.1'

//for Espresso
androidTestUitestImplementation 'androidx.test:runner:1.3.0'
androidTestUitestImplementation 'androidx.test:rules:1.3.0'
androidTestUitestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
androidTestUitestImplementation 'androidx.test.espresso:espresso-intents:3.3.0'
androidTestUitestImplementation 'androidx.test.espresso:espresso-web:3.3.0'
androidTestUitestImplementation 'androidx.test.espresso:espresso-contrib:3.3.0'
androidTestUitestImplementation 'androidx.test:runner:1.4.0'
androidTestUitestImplementation 'androidx.test:rules:1.4.0'
androidTestUitestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestUitestImplementation 'androidx.test.espresso:espresso-intents:3.4.0'
androidTestUitestImplementation 'androidx.test.espresso:espresso-web:3.4.0'
androidTestUitestImplementation 'androidx.test.espresso:espresso-contrib:3.4.0'
androidTestUitestImplementation 'androidx.annotation:annotation:1.2.0'

//for UI Automator
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
package org.opendatakit.espresso;

import static androidx.test.espresso.Espresso.onData;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.action.ViewActions.typeText;
import static androidx.test.espresso.assertion.ViewAssertions.matches;
import static androidx.test.espresso.intent.Intents.intending;
import static androidx.test.espresso.intent.matcher.IntentMatchers.hasAction;
import static androidx.test.espresso.matcher.RootMatchers.isPlatformPopup;
import static androidx.test.espresso.matcher.ViewMatchers.assertThat;
import static androidx.test.espresso.matcher.ViewMatchers.isCompletelyDisplayed;
import static androidx.test.espresso.matcher.ViewMatchers.withClassName;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.espresso.matcher.ViewMatchers.withText;
import static org.hamcrest.Matchers.endsWith;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.opendatakit.util.TestConstants.APP_NAME;
import static org.opendatakit.util.TestConstants.T_HOUSE_DISPLAY_NAME;
import static org.opendatakit.util.TestConstants.T_HOUSE_TABLE_ID;

import android.Manifest;
import android.app.Activity;
import android.app.Instrumentation;
Expand All @@ -9,7 +29,6 @@
import android.widget.EditText;
import android.widget.Spinner;

import androidx.test.espresso.Espresso;
import androidx.test.espresso.intent.rule.IntentsTestRule;
import androidx.test.filters.LargeTest;
import androidx.test.platform.app.InstrumentationRegistry;
Expand All @@ -23,6 +42,7 @@
import org.junit.rules.RuleChain;
import org.junit.rules.TestRule;
import org.opendatakit.tables.R;
import org.opendatakit.tables.activities.ImportCSVActivity;
import org.opendatakit.tables.activities.MainActivity;
import org.opendatakit.tables.utils.TableFileUtils;
import org.opendatakit.util.EspressoUtils;
Expand All @@ -33,27 +53,6 @@
import java.io.File;
import java.io.FilenameFilter;

import static androidx.test.espresso.Espresso.onData;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.action.ViewActions.typeText;
import static androidx.test.espresso.assertion.ViewAssertions.matches;
import static androidx.test.espresso.intent.Intents.intending;
import static androidx.test.espresso.intent.matcher.IntentMatchers.hasAction;
import static androidx.test.espresso.matcher.RootMatchers.isPlatformPopup;
import static androidx.test.espresso.matcher.ViewMatchers.assertThat;
import static androidx.test.espresso.matcher.ViewMatchers.isCompletelyDisplayed;
import static androidx.test.espresso.matcher.ViewMatchers.withClassName;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.espresso.matcher.ViewMatchers.withText;
import static org.hamcrest.Matchers.endsWith;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.opendatakit.util.TestConstants.APP_NAME;
import static org.opendatakit.util.TestConstants.OI_PICK_FILE;
import static org.opendatakit.util.TestConstants.T_HOUSE_DISPLAY_NAME;
import static org.opendatakit.util.TestConstants.T_HOUSE_TABLE_ID;


@LargeTest
public class CsvTest {
Expand Down Expand Up @@ -215,7 +214,7 @@ public void exportCsv_invalidQualifier() {
@Test
public void importCsv_fileOutOfAppDir() {
//stub intent
intending(hasAction(OI_PICK_FILE)).respondWith(
intending(hasAction(Intent.ACTION_OPEN_DOCUMENT)).respondWith(
new Instrumentation.ActivityResult(Activity.RESULT_OK,
new Intent().setData(Uri.fromFile(new File("/file")))));

Expand All @@ -224,8 +223,6 @@ public void importCsv_fileOutOfAppDir() {
onView(withText(R.string.import_choose_csv_file)).perform(click());

//check toast
EspressoUtils.toastMsgMatcher(mIntentsRule, is(EspressoUtils
.getString(mIntentsRule, R.string.file_not_under_app_dir,
ODKFileUtils.getAppFolder(APP_NAME))));
EspressoUtils.toastMsgMatcher(mIntentsRule, is(ImportCSVActivity.IMPORT_FILE_MUST_RESIDE_IN_OPENDATAKIT_FOLDER));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.opendatakit.util.ODKMatchers;
import org.opendatakit.util.UAUtils;
import org.opendatakit.utilities.ODKFileUtils;
import org.opendatakit.utilities.ODKXFileUriUtils;

import java.io.File;

Expand Down Expand Up @@ -72,7 +73,6 @@
import static org.hamcrest.Matchers.notNullValue;
import static org.opendatakit.tables.utils.Constants.IntentKeys.TABLE_PREFERENCE_FRAGMENT_TYPE;
import static org.opendatakit.util.TestConstants.APP_NAME;
import static org.opendatakit.util.TestConstants.OI_PICK_FILE;
import static org.opendatakit.util.TestConstants.T_HOUSE_E_DISPLAY_NAME;
import static org.opendatakit.util.TestConstants.T_HOUSE_E_TABLE_ID;
import static org.opendatakit.util.TestConstants.T_HOUSE_TABLE_ID;
Expand Down Expand Up @@ -237,24 +237,24 @@ public void setup() {
}

@Test
public void intents_launchOIFileManager() {
public void intents_launchFilePicker() {
//Check intent on "List View File"
EspressoUtils
.onRecyclerViewText(R.string.list_view_file)
.perform(click());
intended(hasAction(OI_PICK_FILE), Intents.times(1));
intended(hasAction(Intent.ACTION_OPEN_DOCUMENT), Intents.times(1));

//Check intent on "Detail View File"
EspressoUtils
.onRecyclerViewText(R.string.detail_view_file)
.perform(click());
intended(hasAction(OI_PICK_FILE), Intents.times(2));
intended(hasAction(Intent.ACTION_OPEN_DOCUMENT), Intents.times(2));

//Check intent on "Map List View File"
EspressoUtils
.onRecyclerViewText(R.string.map_list_view_file)
.perform(click());
intended(hasAction(OI_PICK_FILE), Intents.times(3));
intended(hasAction(Intent.ACTION_OPEN_DOCUMENT), Intents.times(3));
}

@Test
Expand Down Expand Up @@ -375,16 +375,15 @@ public void view_rotateScreen() throws RemoteException, InterruptedException {

@Test
public void intents_listView() {
final String listViewPath =
"/" + APP_NAME + "/config/tables/Tea_houses/html/Tea_houses_list.html";
String listViewPath = "tables/Tea_houses/html/Tea_houses_list.html";
Uri listViewUri = ODKXFileUriUtils.getConfigUri(APP_NAME).buildUpon().appendPath(listViewPath).build();

//backup current config
String currFile = getListViewFile();

//stub response
intending(hasAction(OI_PICK_FILE)).respondWith(
new Instrumentation.ActivityResult(Activity.RESULT_OK, new Intent()
.setData(Uri.fromFile(new File(ODKFileUtils.getOdkFolder() + listViewPath)))));
intending(hasAction(Intent.ACTION_OPEN_DOCUMENT)).respondWith(
new Instrumentation.ActivityResult(Activity.RESULT_OK, new Intent().setData(listViewUri)));

//edit list view path
EspressoUtils
Expand All @@ -410,28 +409,28 @@ public void intents_listView() {

@Test
public void intents_detailView() {
final String detailViewPath =
"/" + APP_NAME + "/config/tables/Tea_houses/html/Tea_houses_detail.html";
final String listViewPath =
"/" + APP_NAME + "/config/tables/Tea_houses/html/Tea_houses_list.html";
String detailViewPath = "tables/Tea_houses/html/Tea_houses_detail.html";
String listViewPath = "tables/Tea_houses/html/Tea_houses_list.html";
Uri detailViewUri = ODKXFileUriUtils.getConfigUri(APP_NAME).buildUpon().appendPath(detailViewPath).build();
Uri listViewUri = ODKXFileUriUtils.getConfigUri(APP_NAME).buildUpon().appendPath(listViewPath).build();

//back up current config
String currDetailFile = getDetailViewFile();
String currListFile = getListViewFile();

//stub response
intending(hasAction(OI_PICK_FILE)).respondWith(
intending(hasAction(Intent.ACTION_OPEN_DOCUMENT)).respondWith(
new Instrumentation.ActivityResult(Activity.RESULT_OK, new Intent()
.setData(Uri.fromFile(new File(ODKFileUtils.getOdkFolder() + detailViewPath)))));
.setData(detailViewUri)));

//edit detail view path
EspressoUtils
.onRecyclerViewText(R.string.detail_view_file)
.perform(click());

intending(hasAction(OI_PICK_FILE)).respondWith(
intending(hasAction(Intent.ACTION_OPEN_DOCUMENT)).respondWith(
new Instrumentation.ActivityResult(Activity.RESULT_OK, new Intent()
.setData(Uri.fromFile(new File(ODKFileUtils.getOdkFolder() + listViewPath)))));
.setData(listViewUri)));

//edit list view path
EspressoUtils
Expand All @@ -455,8 +454,7 @@ public void intents_detailView() {
allOf(withId(R.id.webkit), isDescendantOfA(withId(R.id.top_pane)));

//check url
onView(topWebViewMatcher)
.check(matches(ODKMatchers.withUrl(endsWith(detailViewPath))));
onView(topWebViewMatcher).check(matches(ODKMatchers.withUrl(endsWith(detailViewPath))));

EspressoUtils
.delayedFindElement(topWebViewMatcher, Locator.ID, "TITLE", WEB_WAIT_TIMEOUT)
Expand Down Expand Up @@ -528,7 +526,7 @@ public void display_outOfAppDirViewFile() {

try {
//stub intent
intending(hasAction(OI_PICK_FILE)).respondWith(
intending(hasAction(Intent.ACTION_OPEN_DOCUMENT)).respondWith(
new Instrumentation.ActivityResult(Activity.RESULT_OK,
new Intent().setData(Uri.fromFile(new File("/test.html")))));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public class TestConstants {
public static final String GEO_TAB_ID = "geotaggerTab";
public static final String HOPE_TAB_ID = "hopeTab";
//Misc.
public static final String OI_PICK_FILE = "org.openintents.action.PICK_FILE";
public static final String APP_NAME = "default";
//ODK Services menu
public static final String TABLES_SPECIFIC_SETTINGS = "Tables-specific Settings";
Expand Down
Loading

0 comments on commit 87f0f33

Please sign in to comment.