Scenario class final
Fills a form from tests: answer by XPath, navigate, add and remove repeat instances, and read answers, choices and prompts.
Port of org.javarosa.test.Scenario, JavaRosa's test driver. Loading
is asynchronous (secondary instances); everything else is synchronous.
Java's answer overloads become one answer taking the value
(a String, List<String>, int, double, bool, DateTime
(a date), SelectChoice or AnswerValue); answering the current
question is answerCurrent.
Properties
- atQuestion → bool
-
Whether the current index is a question.
no setter
- atTheEndOfForm → bool
-
Whether the current index is the end of the form.
no setter
- currentIndex → FormIndex
-
The current index.
no setter
- evaluationContext → EvaluationContext
-
The form's evaluation context when the scenario started.
no setter
- formDef → FormDef
-
The form.
final
- formEntryCaptionAtIndex → FormEntryCaption
-
The caption at the current index.
no setter
- formEntryController → FormEntryController
-
The controller.
no setter
- formEntryPromptAtIndex → FormEntryPrompt
-
The prompt at the current index.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- language ↔ String?
-
The form's language.
getter/setter pair
- questionAtIndex → QuestionDef
-
The question at the current index.
no setter
- refAtIndex → TreeReference?
-
The reference at the current index.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- validationOutcome → ValidateOutcome?
-
The first validation failure, or
null.no setter
Methods
-
answer(
String xPath, Object? value) → AnswerResult -
Answers the question at
xPath(creating missing repeat instances on the way) withvalue. -
answerCurrent(
Object? value) → AnswerResult -
Answers the current question with
value. -
answerOf(
String xPath) → AnswerValue? -
The answer at
xPath, ornullif there is no such node. -
choicesOf(
String xPath) → List< SelectChoice> -
The choices of the select question at
xPath. -
countRepeatInstancesOf(
String xPath) → int -
The number of instances of the repeat
xPath(unqualified). -
createNewRepeat(
String xPath) → void -
Adds an instance to the repeat
xPath(an unqualified reference). -
createNewRepeatHere(
) → void - Adds a repeat instance at the current index.
-
expandSingle(
TreeReference reference) → TreeReference -
The single node
referenceexpands to; throws otherwise. -
finalizeInstance(
) → void - Finalizes the form.
-
getAnswerNode(
String xPath) → TreeElement -
The instance node at
xPath. -
indexOf(
String xPath) → FormIndex? -
The index of the element at
xPath. -
jumpTo(
FormIndex index) → FormEntryEvent -
Moves to
index. -
jumpToBeginningOfForm(
) → void - Moves before the first element.
-
newInstance(
) → void - Starts again with a blank instance.
-
next(
[int amount = 1]) → FormEntryEvent - Moves to the next relevant element.
-
nextRef(
) → TreeReference? - The reference of the next element (without moving).
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onDagEvent(
void callback(EvaluationEvent event)) → void -
Receives the form's evaluation events. Port of
onDagEvent. -
prev(
) → FormEntryEvent - Moves to the previous relevant element.
-
removeRepeat(
String xPath) → void -
Removes the repeat instance at
xPath. -
serializeAndDeserializeForm(
{ResourceResolver? resolver}) → Future< Scenario> -
The form, with its current instance, encoded and restored (as after
an app restart), continuing that instance. Port of
serializeAndDeserializeForm(JavaRosa'sExternalizablebecomes FormDefCodec). -
serializeAndDeserializeInstance(
XFormsElement form, {ResourceResolver? resolver}) → Future< Scenario> -
The instance serialized and loaded into a fresh parse of
form(the same form), as a new scenario continuing that instance. Port ofserializeAndDeserializeInstance. -
toString(
) → String -
A string representation of this object.
inherited
-
trace(
String msg) → void -
Logs
msgprominently.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- beginningOfForm → FormIndex
-
The beginning-of-form index.
final
Static Methods
-
fromFormDef(
FormDef form, {bool newInstance = true, FormEntryController controllerFactory(FormDef form)?, XFormParser parserFactory(ResourceResolver? resolver)?}) → Scenario -
Starts filling
form(a new instance unless notnewInstance). -
fromXml(
String xml, {ResourceResolver? resolver, FormEntryController controllerFactory(FormDef form)?, XFormParser parserFactory(ResourceResolver? resolver)?}) → Future< Scenario> -
Parses
xml(resolvingjr://resources throughresolver) and starts a new instance. -
init(
XFormsElement form, {ResourceResolver? resolver, FormEntryController controllerFactory(FormDef form)?, XFormParser parserFactory(ResourceResolver? resolver)?}) → Future< Scenario> -
Builds the form
form(seetest/xforms_element) and starts a new instance. Port ofScenario.init(XFormsElement).