Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
app.display.name=Untitled Application
case_autoload.case.case_missing=Unable to find case referenced by auto-select case ID.
case_autoload.case.property_missing=The case index specified for case auto-selecting could not be found: ${0}
case_autoload.fixture.case_missing=Unable to find case referenced by auto-select case ID.
case_autoload.fixture.exactly_one_fixture=The lookup table settings for your user are incorrect. This user must have access to exactly one lookup table row for the table: ${0}
case_autoload.fixture.property_missing=The lookup table field specified for case auto-selecting could not be found: ${0}
case_autoload.location.case_missing=This form requires the user's location to be marked as 'Tracks Stock'.
case_autoload.location.property_missing=This form requires access to the user's location, but none was found.
case_autoload.raw.case_missing=Unable to find case referenced by auto-select case ID.
case_autoload.raw.property_missing=The custom xpath expression specified for case auto-selecting could not be found: ${0}
case_autoload.user.case_missing=Unable to find case referenced by auto-select case ID.
case_autoload.user.property_missing=The user data key specified for case auto-selecting could not be found: ${0}
case_autoload.usercase.case_missing=Unable to find case referenced by auto-select case ID.
case_autoload.usercase.property_missing=The user case specified for case auto-selecting could not be found: ${0}
case_sharing.exactly_one_group=The case sharing settings for your user are incorrect. This user must be in exactly one case sharing group. Please contact your supervisor.
cchq.case=Case
cchq.referral=Referral
en=English
forms.m0f0=Hidden Group
homescreen.title=Untitled Application
login.welcome.single=bem-vindo
m0.case_long.case_name_1.header=Name
m0.case_long.title=Cases
m0.case_short.case_name_1.header=Name
m0.case_short.title=Cases
modules.m0=Form Nav Tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
app.display.name=Untitled Application
cchq.case=Case
cchq.referral=Referral
en=English
forms.m0f0=Hidden Group
homescreen.title=Untitled Application
login.welcome.single=bem-vindo
m0.case_long.case_name_1.header=Name
m0.case_long.title=Cases
m0.case_short.case_name_1.header=Name
m0.case_short.title=Cases
modules.m0=Form Nav Tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<h:html xmlns:h="http://www.w3.org/1999/xhtml" xmlns:orx="http://openrosa.org/jr/xforms" xmlns="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:jr="http://openrosa.org/javarosa" xmlns:vellum="http://commcarehq.org/xforms/vellum">
<h:head>
<h:title>Test Print</h:title>
<model>
<instance>
<data xmlns:jrm="http://dev.commcarehq.org/jr/xforms" xmlns="http://openrosa.org/formdesigner/616F4108-566E-4E32-85C5-6153E3351D46" uiVersion="1" version="10" name="Test Label">
<label_question_required/>
<label_question_invalid/>
<text_question/>
</data>
</instance>
<bind nodeset="/data/label_question_required" required="true()"/>
<bind nodeset="/data/label_question_invalid" required="true()" constraint="false()" jr:constraintMsg="'TESTPASS'"/>
</model>
</h:head>

<h:body>
<trigger appearance="minimal" ref="/data/label_question_required">
<label>QUESTION1: The value of this question should be 'OK' after being seen, and the question should never be valid</label>
</trigger>
<trigger appearance="minimal" ref="/data/label_question_invalid">
<label>QUESTION2: The value of this question should be 'OK' after being seen, and the question should never be valid</label>
</trigger>
<input ref="/data/text_question">
<label>QUESTION3: Text Question Label, it shouldn't be possible to get here</label>
</input>
</h:body>
</h:html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?xml version='1.0' encoding='UTF-8'?>
<profile version="95"
update="https://www.commcarehq.org/a/flipper/apps/download/d3f0e1342441b7e336de1ebaadf3a953/media_profile.ccpr?latest=true"
requiredMajor="2"
requiredMinor="21"
uniqueid="36c0bdd028d14a52cbff95bb1bfd0962"
name="Untitled Application"
descriptor="Profile File">
<property key="BackupMode" value="file_mode"/>
<property key="backup-url" value="file:///E:/CommCare.Backup"/>
<property key="restore-url" value="file:///E:/CommCare.Backup"/>
<property key="ota-restore-url" value="https://www.commcarehq.org/a/flipper/phone/restore/"/>
<property key="ota-restore-url-testing" value="https://www.commcarehq.org/a/flipper/phone/restore/"/>
<property key="PostURL" value="https://www.commcarehq.org/a/flipper/receiver/secure/d3f0e1342441b7e336de1ebaadf3a953/" force="true"/>
<property key="PostTestURL" value="https://www.commcarehq.org/a/flipper/receiver/secure/d3f0e1342441b7e336de1ebaadf3a953/" force="true"/>
<property key="key_server" value="https://www.commcarehq.org/a/flipper/phone/keys/"/>
<property key="heartbeat-url" value="https://www.commcarehq.org/a/flipper/phone/heartbeat/"/>
<property key="cur_locale" value="en"/>
<property key="cc_user_domain" value="flipper.commcarehq.org"/>
<property key="jr_openrosa_api" value="1.0"/>

<!-- Properties configured on CommCare HQ 1.0 -->

<property key="cc-days-form-retain" value="-1" force="true"/>

<property key="cc-show-saved" value="yes" force="true"/>

<property key="restore-tolerance" value="loose"/>

<property key="cc-user-mode" value="cc-u-normal"/>

<property key="cc-fuzzy-search-enabled" value="yes"/>

<property key="cc-autoup-freq" value="freq-never"/>

<property key="purge-freq" value="0"/>

<property key="server-tether" value="push-only"/>

<property key="user_reg_server" value="required"/>

<property key="extra_key_action" value="audio"/>

<property key="log_prop_daily" value="log_never"/>

<property key="ViewStyle" value="v_chatterbox"/>

<property key="cc-login-duration-seconds" value="86400"/>

<property key="cc-resize-images" value="none" force="true"/>

<property key="cc-entry-mode" value="cc-entry-quick"/>

<property key="cc-send-procedure" value="cc-send-http"/>

<property key="cc-login-images" value="No"/>

<property key="log_prop_weekly" value="log_short"/>

<property key="cc-show-incomplete" value="yes" force="true"/>

<property key="cc-send-unsent" value="cc-su-auto" force="true"/>

<property key="loose_media" value="no"/>

<property key="password_format" value="n"/>

<property key="unsent-number-limit" value="5"/>

<property key="cc-content-valid" value="no"/>

<property key="logenabled" value="Enabled"/>


<!-- end -->

<suite><resource id="suite" version="95">
<location authority="local">./suite.xml</location>
<location authority="remote">https://www.commcarehq.org/a/flipper/apps/download/d3f0e1342441b7e336de1ebaadf3a953/suite.xml</location>
</resource></suite>
</profile>
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?xml version='1.0' encoding='UTF-8'?>
<suite version="95" descriptor="Suite File">
<xform>
<resource id="80cd5f797be88b622852a97bbe4e5f2290ddb854" version="95"
descriptor="Form: (Module Form Nav Tests) - Hidden Group">
<location authority="local">./modules-0/forms-0.xml</location>
<location authority="remote">./modules-0/forms-0.xml</location>
</resource>
</xform>
<locale language="default">
<resource id="app_default_strings" version="95" descriptor="Translations: Default Language">
<location authority="local">./default/app_strings.txt</location>
<location authority="remote">./default/app_strings.txt</location>
</resource>
</locale>
<locale language="en">
<resource id="app_en_strings" version="95" descriptor="Translations: English">
<location authority="local">./en/app_strings.txt</location>
<location authority="remote">./en/app_strings.txt</location>
</resource>
</locale>
<detail id="m0_case_short">
<title>
<text>
<locale id="m0.case_short.title"/>
</text>
</title>
<field>
<header>
<text>
<locale id="m0.case_short.case_name_1.header"/>
</text>
</header>
<template>
<text>
<xpath function="case_name"/>
</text>
</template>
<sort type="string" order="1" direction="ascending">
<text>
<xpath function="case_name"/>
</text>
</sort>
</field>
</detail>
<detail id="m0_case_long">
<title>
<text>
<locale id="m0.case_long.title"/>
</text>
</title>
<field>
<header>
<text>
<locale id="m0.case_long.case_name_1.header"/>
</text>
</header>
<template>
<text>
<xpath function="case_name"/>
</text>
</template>
</field>
</detail>
<entry>
<form>http://openrosa.org/formdesigner/616F4108-566E-4E32-85C5-6153E3351D46</form>
<command id="m0-f0">
<text>
<locale id="forms.m0f0"/>
</text>
</command>
</entry>
<menu id="m0">
<text>
<locale id="modules.m0"/>
</text>
<command id="m0-f0"/>
</menu>
</suite>
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
package org.commcare.android.tests.formentry;

import android.content.Intent;
import android.view.View;
import android.widget.ImageButton;

import org.commcare.CommCareTestApplication;
import org.commcare.activities.FormEntryActivity;
import org.commcare.android.CommCareTestRunner;
import org.commcare.android.util.ActivityLaunchUtils;
import org.commcare.android.util.TestAppInstaller;
import org.commcare.dalvik.R;
import org.commcare.utils.CompoundIntentList;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.annotation.Config;
import org.robolectric.shadows.ShadowActivity;

import java.util.ArrayList;

import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNull;
import static junit.framework.Assert.assertTrue;

/**
* @author Clayton Sims
*/
@Config(application = CommCareTestApplication.class)
@RunWith(CommCareTestRunner.class)
public class FormWidgetTests {

@Before
public void setup() {
TestAppInstaller.installAppAndLogin(
"jr://resource/commcare-apps/form_entry_widgets/profile.ccpr",
"test", "123");
}

/**
* Test different behaviors for possibly grouped intent callout views
*
* The "JavaRosa" XForms standard has some peculiar behaviors. Onscreen non-interactive
* labels are currently implemented through <trigger> widgets for unfortunate historical
* reasons. Due to incremental changes to the code, this means that the widget has for many
* years returned a value, and that value is used regularly to control behavior.
*
* These tests reflect the common ways that "label" (trigger) question values are used
* to ensure that future updates don't change these behaviors. If these tests fail,
* please seek guidance before changing system behavior.
*/
@Test
public void testLabelQuestionWidgetBehavior() {
ShadowActivity shadowActivity =
ActivityLaunchUtils.buildHomeActivityForFormEntryLaunch("m0-f0");

Intent formEntryIntent = shadowActivity.getNextStartedActivity();

// make sure the form entry activity should be launched
String intentActivityName = formEntryIntent.getComponent().getClassName();
assertTrue(intentActivityName.equals(FormEntryActivity.class.getName()));

navigateFormStructure(formEntryIntent);
}

private void navigateFormStructure(Intent formEntryIntent) {
// launch form entry
FormEntryActivity formEntryActivity =
Robolectric.buildActivity(FormEntryActivity.class, formEntryIntent)
.create().start().resume().get();

//Screen 1
ImageButton nextButton = formEntryActivity.findViewById(R.id.nav_btn_next);

assertTrue(screenContainsText(formEntryActivity, "QUESTION1"));

nextButton.performClick();

assertTrue("Form failed to proceed with required <trigger> question>",
screenContainsText(formEntryActivity, "QUESTION2"));

nextButton.performClick();

assertTrue("Form failed to halt at violated <trigger> constraint",
screenContainsText(formEntryActivity, "QUESTION2"));

assertTrue("Form failed to display <trigger> constraint",
screenContainsText(formEntryActivity, "TESTPASS"));
}

private boolean screenContainsText(FormEntryActivity formEntryActivity, String textToCheck) {
ArrayList list = new ArrayList<View>();
formEntryActivity.getODKView().findViewsWithText(list, textToCheck, View.FIND_VIEWS_WITH_TEXT);

return list.size() > 0;
}
}