Logo: Relish

  1. Sign in

Project: Lombard

LOM8.5 Soft Server Side Validations

User tries to save form
In order to make sure my data is correct
As a user filling out the form
I want the form to check for correct ranges

Background
Given
the survey
survey "Ranges" do
  section "Section One" do
    label "Integer Ranges"

    q_1 "how tall are you?", :is_mandatory => true
      answer "height", :integer
      validation :rule => "A", :warning => true
      condition_A ">=", :integer_value => 24

    q_2 "how many fingers do you have?", :is_mandatory => true
      answer "fingers", :integer
      validation :rule => "A", :message => 'Has more than ten fingers', :warning => true
      condition_A "<=", :integer_value => 10

    q_3 "what is your weight?", :is_mandatory => true
      answer "weight", :integer
      validation :rule => "A and B", :message => "This is an unusual weight", :warning => true
      condition_A "<=", :integer_value => 500
      condition_B ">=", :integer_value => 1
  end
end
Given
I am signed in as a clinician
And
I start the "Ranges" survey
Scenarios
  • @javascript
All integer values within ranges
When
I fill in and change "height" with "72"
And
I fill in and change "fingers" with "10"
And
I fill in and change "weight" with "225"
Then
I should not see an inline warning
When
I press "Click here to finish"
Then
the survey should now be complete
And
I should be on the surveys page
And
I should see "Completed survey" within the notice flash
And
I should not see "Responses include warnings"
  • @javascript
All integer values out of ranges, putting one field at a time
When
I fill in and change "height" with "1"
Then
I should see an inline warning
When
I fill in and change "fingers" with "15"
Then
I should see the inline warning "Has more than ten fingers"
When
I fill in and change "weight" with "1000"
Then
I should see the inline warning "This is an unusual weight"
When
I press "Click here to finish"
Then
the survey should now be complete
And
I should be on the surveys page
And
I should see "Completed survey" within the notice flash
And
I should see "Responses include warnings" within the alert flash
All integer values out of ranges, when submitting the form
When
I fill in "height" with "1"
When
I fill in "fingers" with "15"
When
I fill in "weight" with "1000"
When
I press "Click here to finish"
Then
the survey should now be complete
And
I should be on the surveys page
And
I should see "Completed survey" within the notice flash
And
I should see "Responses include warnings" within the alert flash
  • @javascript
Should remove warnings when good data is entered
When
I fill in and change "height" with "1"
Then
I should see an inline warning
When
I fill in and change "height" with "100"
Then
I should not see an inline warning
  • @wip
Warnings displayed when editing an existing response set
When
I fill in "height" with "1"
And
I fill in "fingers" with "15"
And
I fill in "weight" with "1000"
And
I press "Click here to finish"
Then
I should see "Completed survey"
When
I follow "Ranges"
Then
I should see the inline warning "Unusual response"
Then
I should see the inline warning "Has more than ten fingers"
Then
I should see the inline warning "This is an unusual weight"

Last published over 5 years ago by wminsinger.