Logo: Relish

  1. Sign in

Project: Lombard

Multi-dependency support

  • @javascript

User chooses answer in form
which depending upon the answer choice
will trigger a custom set of answers to a common follow up question

Background
Given
the survey
  survey "Cars" do
    section "Section One" do
      label "Make and Model"

  q_1 "What is the make of car?", :is_mandatory => true, :pick => :one, :display_type => :dropdown
      a_1 "Ford"
      a_2 "Honda"
      a_3 "Nissan"
      a_4 "Toyota"

      q_2a "What is the model of car?", :pick => :one
  a_1 "Focus"
  a_2 "F150"
  a_3 "Taurus"
      dependency :rule => "A"
      condition_A :q_1, "==", :a_1

  q_2b "What is the model of car?", :pick => :one
  a_1 "Accord"
  a_2 "CRV"
  a_3 "Pilot"
      dependency :rule => "B"
      condition_B :q_1, "==", :a_2

      q_2c "What is the model of car?", :pick => :one
  a_1 "Pathfinder"
  a_2 "Frontier"
      dependency :rule => "C"
      condition_C :q_1, "==", :a_3

      q_2d "What is the model of car?", :pick => :one
  a_1 "Tacoma"
  a_2 "Titan"
  a_3 "Land cruiser"
      dependency :rule => "D"
      condition_D :q_1, "==", :a_4

      q_3 "What size truck bed?", :pick => :one
      a_1 "Long"
      a_2 "Short"
      dependency :rule => "E or F or G or H"
      condition_E :q_2a, "==", :a_2
      condition_F :q_2c, "==", :a_2
      condition_G :q_2d, "==", :a_1
      condition_H :q_2d, "==", :a_2
    end
  end
And
I am signed in
Scenarios
Answer options change in subsequent question following choice from trigger question
Given
I start the "Cars" survey
When
I select "Honda" from "q_1"
Then
I should see a question with "Accord"
And
I should see a question with "CRV"
And
I should see a question with "Pilot"
When
I select "Nissan" from "q_1"
Then
I should see a question with "Pathfinder"
And
I should see a question with "Frontier"
And
I should NOT see a question with "Accord"
And
I should NOT see a question with "CRV"
And
I should NOT see a question with "Pilot"
Answer options change in subsequent questions, nested two levels
Given
I start the "Cars" survey
When
I select "Ford" from "q_1"
Then
I should see a question with "Focus"
And
I should see a question with "F150"
When
I choose "F150"
Then
I should see a question with "What size truck bed"
And
I should see a question with "Short"
And
I should see a question with "Long"
When
I select "Nissan" from "q_1"
Then
I should see a question with "Pathfinder"
And
I should NOT see a question with "Focus"
And
I should NOT see a question with "F150"
And
I should NOT see a question with "What size truck bed"
And
I should NOT see a question with "Short"
And
I should NOT see a question with "Long"
Changing a primary question should clear and replace the secondary response
Given
I start the "Cars" survey
When
I select "Honda" from "q_1"
And
I wait until all Ajax requests are complete
Then
the current response set should only contain:
question response
q_1 Honda
When
I choose "CRV"
Then
the current response set should only contain:
question response
q_1 Honda
q_2b CRV
When
I select "Nissan" from "q_1"
And
I wait until all Ajax requests are complete
Then
the current response set should only contain:
question response
q_1 Nissan
When
I choose "Pathfinder"
Then
the current response set should only contain:
question response
q_1 Nissan
q_2c Pathfinder
Changing a primary question should clear and replace the secondary and tertiary responses
Given
I start the "Cars" survey
When
I select "Ford" from "q_1"
When
I choose "F150"
Then
the current response set should only contain:
question response
q_1 Ford
q_2a F150
When
I choose "Short"
Then
the current response set should only contain:
question response
q_1 Ford
q_2a F150
q_3 Short
When
I select "Nissan" from "q_1"
Then
the current response set should only contain:
question response
q_1 Nissan
When
I choose "Pathfinder"
Then
the current response set should only contain:
question response
q_1 Nissan
q_2c Pathfinder

Last published over 5 years ago by wminsinger.