Skip to content
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

Proposal for #4059 First nested repeat not created… #4797

Closed
wants to merge 6 commits into from
Closed
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
65 changes: 65 additions & 0 deletions collect_app/src/androidTest/assets/forms/NestedRepeats.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0"?>
<h:html xmlns:h="http://www.w3.org/1999/xhtml" xmlns:jr="http://openrosa.org/javarosa"
xmlns:odk="http://www.opendatakit.org/xforms" xmlns="http://www.w3.org/2002/xforms">
<h:head>
<h:title>NestedRepeats</h:title>
<model odk:xforms-version="1.0.0">
<instance>
<data id="NestedRepeats" version="2021-08-15 B">
<person jr:template="">
<age />
<child jr:template="">
<name />
<pet jr:template="">
<colour />
</pet>
</child>
</person>
<person>
<age />
<child>
<name />
<pet>
<colour />
</pet>
</child>
</person>
<meta>
<instanceID />
</meta>
</data>
</instance>
<bind nodeset="/data/person/age" type="string" />
<bind nodeset="/data/person/child/name" type="string" />
<bind nodeset="/data/person/child/pet/colour" type="string" />
<bind nodeset="/data/meta/instanceID" readonly="true()" type="string"
jr:preload="uid" />
</model>
</h:head>
<h:body>
<group ref="/data/person">
<label>Person</label>
<repeat nodeset="/data/person">
<input ref="/data/person/age">
<label>age?</label>
</input>
<group ref="/data/person/child">
<label>Child</label>
<repeat nodeset="/data/person/child">
<input ref="/data/person/child/name">
<label>name?</label>
</input>
<group ref="/data/person/child/pet">
<label>Pet</label>
<repeat nodeset="/data/person/child/pet">
<input ref="/data/person/child/pet/colour">
<label>colour?</label>
</input>
</repeat>
</group>
</repeat>
</group>
</repeat>
</group>
</h:body>
</h:html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package org.odk.collect.android.feature.formentry;

import android.Manifest;

import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.rule.GrantPermissionRule;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.RuleChain;
import org.junit.runner.RunWith;
import org.odk.collect.android.support.CollectTestRule;
import org.odk.collect.android.support.CopyFormRule;
import org.odk.collect.android.support.ResetStateRule;
import org.odk.collect.android.support.pages.FormEntryPage;
import org.odk.collect.android.support.pages.MainMenuPage;

@RunWith(AndroidJUnit4.class)
public class NestedRepeatTest {

private final CollectTestRule rule = new CollectTestRule();

@Rule
public RuleChain copyFormChain = RuleChain
.outerRule(GrantPermissionRule.grant(Manifest.permission.READ_PHONE_STATE))
.around(new ResetStateRule())
.around(new CopyFormRule("NestedRepeats.xml"))
.around(rule);

@Test
public void nestedRepeatsCreatedWithOuterRepeat() {
new MainMenuPage()
.startBlankForm("NestedRepeats")
.assertText("Person > 1")
.clickPlus("Person")
.clickOnAdd(new FormEntryPage(""))
.assertText("Person > 2")
.swipeToNextQuestion("name?")//Already there?
.assertText("Person > 2 > Child > 1")
.swipeToNextQuestion("colour?")//Already there?
.assertText("Person > 2 > Child > 1 > Pet > 1");

}

}
Loading