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 many fingers do you have?", :is_mandatory => true
      answer "fingers", :integer
      validation :rule => "A or B", :message => 'Has more than ten fingers', :warning => true
      condition_A "<=", :integer_value => 10
      condition_B ">", :integer_value => 12
      validation :rule => "A", :message => 'Cannot have more than twelve fingers'
      condition_A "<=", :integer_value => 12
  end
end
Given
I am signed in
And
I start the "Ranges" survey
Scenarios
  • @javascript
Both hard and soft validations
When
I fill in and change "fingers" with "15"
Then
I should see the inline error "Cannot have more than twelve fingers"
When
I fill in and change "fingers" with "12"
Then
I should not see an inline error
And
I should see the inline warning "Has more than ten fingers"
When
I fill in and change "fingers" with "10"
Then
I should not see an inline warning

Last published over 5 years ago by wminsinger.