-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update JR to 3.3.0 snapshot and update test for re-calculation in field list #4845
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 23 additions & 72 deletions
95
collect_app/src/androidTest/assets/forms/form_design_error.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,88 +1,39 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<h:html xmlns:h="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:jr="http://openrosa.org/javarosa" xmlns:odk="http://www.opendatakit.org/xforms" xmlns:orx="http://openrosa.org/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> | ||
<?xml version="1.0"?> | ||
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:jr="http://openrosa.org/javarosa" xmlns:odk="http://www.opendatakit.org/xforms"> | ||
<h:head> | ||
<h:title>form_design_error</h:title> | ||
<h:title>Relevance and calculate loop</h:title> | ||
<model odk:xforms-version="1.0.0"> | ||
<instance> | ||
<data id="form_design_error"> | ||
<data id="form-list-relevance-issue"> | ||
<group> | ||
<select /> | ||
<select2 /> | ||
<name>A</name> | ||
<fullName/> | ||
<middleName>third</middleName> | ||
</group> | ||
<meta> | ||
<instanceID /> | ||
<instanceID/> | ||
</meta> | ||
</data> | ||
</instance> | ||
<instance id="list"> | ||
<root> | ||
<item> | ||
<label>A</label> | ||
<name>a</name> | ||
</item> | ||
<item> | ||
<label>B</label> | ||
<name>b</name> | ||
</item> | ||
<item> | ||
<label>C</label> | ||
<name>c</name> | ||
</item> | ||
</root> | ||
</instance> | ||
<instance id="list2"> | ||
<root> | ||
<item> | ||
<label>AA</label> | ||
<list>a</list> | ||
<name>aa</name> | ||
</item> | ||
<item> | ||
<label>AB</label> | ||
<list>a</list> | ||
<name>ab</name> | ||
</item> | ||
<item> | ||
<label>BA</label> | ||
<list>b</list> | ||
<name>ba</name> | ||
</item> | ||
<item> | ||
<label>BB</label> | ||
<list>b</list> | ||
<name>bb</name> | ||
</item> | ||
</root> | ||
</instance> | ||
<bind nodeset="/data/group/select" type="string" /> | ||
<bind calculate="concat( /data/group/select , 'a')" nodeset="/data/group/select2" type="string" /> | ||
<bind jr:preload="uid" nodeset="/data/meta/instanceID" readonly="true()" type="string" /> | ||
<bind nodeset="/data/group/name" type="string"/> | ||
<!-- The form design issue is that calculates can't be used as dynamic defaults because they're reevaluated continuously --> | ||
<bind calculate=" /data/group/name " nodeset="/data/group/fullName" type="string"/> | ||
<bind nodeset="/data/group/middleName" relevant=" /data/group/name != /data/group/fullName " type="string"/> | ||
<bind jr:preload="uid" nodeset="/data/meta/instanceID" readonly="true()" type="string"/> | ||
</model> | ||
</h:head> | ||
<h:body> | ||
<group appearance="field-list" ref="/data/group"> | ||
<select1 appearance="minimal" ref="/data/group/select"> | ||
<label>Select</label> | ||
<item> | ||
<label>A</label> | ||
<value>a</value> | ||
</item> | ||
<item> | ||
<label>B</label> | ||
<value>b</value> | ||
</item> | ||
<item> | ||
<label>C</label> | ||
<value>c</value> | ||
</item> | ||
</select1> | ||
<select1 appearance="minimal" ref="/data/group/select2"> | ||
<label>Select2</label> | ||
<itemset nodeset="instance('list2')/root/item[list= /data/group/select ]"> | ||
<value ref="name" /> | ||
<label ref="label" /> | ||
</itemset> | ||
</select1> | ||
<input ref="/data/group/name"> | ||
<label>What is your first name</label> | ||
</input> | ||
<input ref="/data/group/fullName"> | ||
<label>Please add your second name to have your full name</label> | ||
</input> | ||
<input ref="/data/group/middleName"> | ||
<label>Please add your middle name if you have one</label> | ||
<hint>Display if full name is different than first name</hint> | ||
</input> | ||
</group> | ||
</h:body> | ||
</h:html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,5 @@ | ||
package org.odk.collect.android.support.pages; | ||
|
||
import androidx.appcompat.widget.AppCompatImageButton; | ||
import androidx.test.espresso.Espresso; | ||
|
||
import org.hamcrest.Matchers; | ||
import org.odk.collect.android.R; | ||
import org.odk.collect.android.support.ActivityHelpers; | ||
import org.odk.collect.android.utilities.FlingRegister; | ||
|
||
import java.util.concurrent.Callable; | ||
|
||
import static androidx.test.espresso.Espresso.onView; | ||
import static androidx.test.espresso.action.ViewActions.click; | ||
import static androidx.test.espresso.action.ViewActions.longClick; | ||
|
@@ -28,6 +18,16 @@ | |
import static org.hamcrest.core.StringEndsWith.endsWith; | ||
import static org.odk.collect.android.support.CustomMatchers.withIndex; | ||
|
||
import androidx.appcompat.widget.AppCompatImageButton; | ||
import androidx.test.espresso.Espresso; | ||
|
||
import org.hamcrest.Matchers; | ||
import org.odk.collect.android.R; | ||
import org.odk.collect.android.support.ActivityHelpers; | ||
import org.odk.collect.android.utilities.FlingRegister; | ||
|
||
import java.util.concurrent.Callable; | ||
|
||
public class FormEntryPage extends Page<FormEntryPage> { | ||
|
||
private final String formName; | ||
|
@@ -171,11 +171,6 @@ public FormEntryPage clickRankingButton() { | |
return this; | ||
} | ||
|
||
public FormEntryPage putTextOnIndex(int index, String text) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I moved and renamed this because it took me a long time to find it. |
||
onView(withIndex(withClassName(endsWith("Text")), index)).perform(replaceText(text)); | ||
return this; | ||
} | ||
|
||
public FormEntryPage deleteGroup(String questionText) { | ||
onView(withText(questionText)).perform(longClick()); | ||
onView(withText(R.string.delete_repeat)).perform(click()); | ||
|
@@ -284,6 +279,11 @@ public FormEntryPage answerQuestion(String question, String answer) { | |
return this; | ||
} | ||
|
||
public FormEntryPage answerQuestion(int index, String answer) { | ||
onView(withIndex(withClassName(endsWith("Text")), index)).perform(replaceText(answer)); | ||
return this; | ||
} | ||
|
||
public FormEntryPage assertQuestion(String text) { | ||
waitForText(text); | ||
return this; | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels awkward but I couldn't find a better way to make sure that the third question was displayed on a short screen. Scrolling to the question text is insufficient because the edittext needs to be on-screen.