Logo: Relish

  1. Sign in

Project: Lombard

User tries to save a form

In order to make sure I have all the required data
As a user filling out a form
I want to the form to check if I have all required fields

Scenarios
  • @javascript
Required Question Not Filled In
Given
the survey
  survey "Required" do
    section "Section One" do
      label "Required Questions"

      question_1 "What is your favorite color?", :pick => :one, :is_mandatory => true
      answer "red"
      answer "blue"
      answer "green"
   answer "yellow"
      answer :other

      q_2b "Choose the colors you don't like", :pick => :any, :is_mandatory => true
      a_1 "orange"
      a_2 "purple"
      a_3 "brown"
      a :omit
    end
  end
Given
I am signed in
When
I start the "Required" survey
And
I choose "red"
And
I press "Click here to finish"
Then
the survey is not complete
And
I should see a warning message
  • @javascript
All Required Fields Filled In
Given
the survey
  survey "Required" do
    section "Section One" do
      label "Required Questions"

      question_1 "What is your favorite color?", :pick => :one, :is_mandatory => true
      answer "red"
      answer "blue"
      answer "green"
   answer "yellow"
      answer :other

      q_2b "Choose the colors you don't like", :pick => :any, :is_mandatory => true
      a_1 "orange"
      a_2 "purple"
      a_3 "brown"
    end
  end
Given
I am signed in
When
I start the "Required" survey
And
I choose "red"
And
I check "orange"
And
I press "Click here to finish"
Then
the survey should now be complete
  • @javascript
Hidden questions should not be required
Given
the survey
    survey "Hidden_Required" do
      section "Section One" do
        label "Required Questions"

        question_1 "What is your favorite color?", :pick => :one, :is_mandatory => true
        a_1 "red"
        a_2 "blue"
        a_3 "green"
     a_4 "yellow"
        a_5 :other

        q_2b "Choose the colors you don't like", :pick => :any, :is_mandatory => true
        a_1 "orange"
        a_2 "purple"
        a_3 "brown"
        a :omit

  q_3 "Green Eggs or Ham?", :pick => :one, :is_mandatory => true
        a_1 "Eggs!"
        a_2 "Ham!"
        a_3 "Both!"
  dependency :rule => "A"
        condition_A :q_1, "==", :a_3
      end
    end
Given
I am signed in
When
I start the "Hidden_Required" survey
And
I choose "red"
And
I check "orange"
And
I press "Click here to finish"
Then
the survey should now be complete

Last published over 5 years ago by wminsinger.