Logo: Relish

  1. Sign up
  2. Sign in

Project: Lombard

Survey creation

As a survey participant
I want to take a survey
So that I can get paid

Scenarios
Basic questions
Given
the survey
  survey "Favorites" do
    section "Colors" do
      label "You with the sad eyes don't be discouraged"

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

      q_2b "Choose the colors you don't like", :pick => :any
      a_1 "orange"
      a_2 "purple"
      a_3 "brown"
      a :omit
    end
  end
When
I start the "Favorites" survey
Then
I should see "You with the sad eyes don't be discouraged"
And
I choose "red"
And
I choose "blue"
And
I check "orange"
And
I check "brown"
And
I press "Click here to finish"
Then
there should be 1 response set with 3 responses with:
answer
blue
orange
brown
Default answers
Given
the survey
  survey "Favorites" do
    section "Foods" do
      question_1 "What is your favorite food?"
      answer "food", :string, :default_value => "beef"
    end
    section "Section 2" do
    end
    section "Section 3" do
    end
  end
When
I start the "Favorites" survey
And
I press "Section 3"
And
I press "Click here to finish"
Then
there should be 1 response set with 1 responses with:
string_value
beef
Then
the survey should now be complete
When
I start the "Favorites" survey
And
I fill in "food" with "chicken"
And
I press "Foods"
And
I press "Section 3"
And
I press "Click here to finish"
Then
there should be 2 response set with 2 responses with:
string_value
chicken
Quiz time
Given
the survey
survey "Favorites" do
  section "Foods" do
    question_1 "What is the best meat?", :pick => :one, :correct => "oink"
    a_oink "bacon"
    a_tweet "chicken"
    a_moo "beef"
  end
end
Then
question "1" should have correct answer "oink"
Custom css class
Given
the survey
survey "Movies" do
  section "First" do
    q "What is your favorite movie?"
    a :string, :custom_class => "my_custom_class"
    q "What is your favorite state?"
    a :string
  end
end
When
I start the "Movies" survey
Then
the element "input[type='text']:first" should have the class "my_custom_class"
A pick one question with an option for other
Given
the survey
survey "Favorites" do
  section "Foods" do
    q "What is the best meat?", :pick => :one
    a "bacon"
    a "chicken"
    a "beef"
    a "other", :string
  end
end
When
I start the "Favorites" survey
Then
I choose "bacon"
And
I press "Click here to finish"
Then
there should be 1 response set with 1 response with:
bacon
Repeater with a dropdown
Given
the survey
survey "Movies" do
  section "Preferences" do
    repeater "What are you favorite genres?" do
      q "Make", :pick => :one, :display_type => :dropdown
      a "Action"
      a "Comedy"
      a "Mystery"
    end
  end
end
When
I start the "Movies" survey
Then
a dropdown should exist with the options "Action, Comedy, Mystery"
A pick one question with an option for other
Given
the survey
survey "Favorites" do
  section "Foods" do
    q "What is the best meat?", :pick => :one
    a "bacon"
    a "chicken"
    a "beef"
    a "other", :string
  end
end
When
I start the "Favorites" survey
Then
I choose "other"
And
I fill in "r_1_string_value" with "shrimp"
And
I press "Click here to finish"
Then
there should be 1 response set with 1 response with:
shrimp
Checkboxes with text area
Given
the survey
survey "Websites" do
  section "Search engines" do
    q "Have you ever used the following services?", :pick => :any
    a "Yellowpages.com|Describe your experience", :text
    a "Google.com|Describe your experience", :text
    a "Bing.com|Describe your experience", :text
  end
end
When
I start the "Websites" survey
Then
there should be 3 checkboxes
And
there should be 3 text areas
"Double letter rule keys"
Given
the survey
survey "Doubles" do
  section "Two", :display_order => 1 do
    q_twin "Are you a twin?", :pick => :one, :display_order => 1
    a_yes "Oh yes"
    a_no "Oh no"

    q_two_first_names "Do you have two first names?", :pick => :one, :display_order => 2
    a_yes "Why yes"
    a_no "Why no"

    q "Do you want to be part of an SNL skit?", :pick => :one, :display_order => 3
    a_yes "Um yes"
    a_no "Um no"
    dependency :rule => "A or AA"
    condition_A :q_twin, "==", :a_yes
    condition_AA :q_two_first_names, "==", :a_yes
  end
  section "Deux", :display_order => 2 do
    label "Here for the ride"
  end
  section "Three", :display_order => 3 do
    label "Here for the ride"
  end
end
When
I start the "Doubles" survey
Then
I choose "Oh yes"
And
I press "Deux"
And
I press "Two"
Then
the question "Do you want to be part of an SNL skit?" should now be triggered
"Conditional Double letter rule keys"
Given
the survey
survey "Conditionals" do
  section "Screener", :display_order => 1 do
    q_gender "What is your gender?", :pick => :one, :display_order => 1
    a_male "Male"
    a_female "Female"

    q_age_range "What is your age range?", :pick => :one, :display_order => 2
    a_under "Under 21"
    a_twenties "21-30"
    a_thirties "31-40"
    a_forties "41-50"
    a_fifties "51-65"
    a_over "Over 65"

    q_exercise "Do you exercise?", :pick => :one, :display_order => 3
    a_yes "Yes"
    a_no "No"

    q "What is your overall health?", :pick => :one, :display_order => 4
    a_poor "Poor"
    a_okay "Okay"
    a_good "Good"
    a_excellent "Excellent"
    dependency :rule => "A and (BA or BB) and C"
    condition_A :q_gender, "==", :a_male
    condition_BA :q_age_range, "==", :a_thirties
    condition_BB :q_age_range, "==", :a_forties
    condition_C :q_exercise, "==", :a_yes
  end
end
When
I start the "Conditionals" survey
Then
I choose "Male"
And
I choose "41-50"
And
I choose "Yes"
Then
the question "What is your overall health?" should now be triggered
"Changing dropdowns"
Given
the survey
survey "Drop" do
  section "Like it is hot" do
    q "Name", :pick => :one, :display_type => :dropdown
    a "Snoop"
    a "Dogg"
    a "D-O double G"
    a "S-N double O-P, D-O double G"
  end
  section "Two" do
    label "Here for the ride"
  end
  section "Three" do
    label "Here for the ride"
  end
end
When
I start the "Drop" survey
Then
I select "Snoop" from "r_1_answer_id"
And
I press "Two"
And
I press "Like it is hot"
And
I select "Dogg" from "r_1_answer_id"
And
I press "Two"
Then
there should be 1 response with answer "Dogg"
  • @wip
"Saving grids"
Given
the survey
  survey "Grid" do
    section "One", :display_order => 1 do
      grid "Tell us how often do you cover these each day" do
        a "1"
        a "2"
        a "3"
        q "Head", :pick => :one
        q "Knees", :pick => :one
        q "Toes", :pick => :one
      end
    end
    section "Two", :display_order => 2 do
      label "Here for the ride"
    end
    section "Three", :display_order => 3 do
      label "Here for the ride"
    end
  end
When
I start the "Grid" survey
Then
I choose "1"
And
I press "Two"
And
I press "Three"
And
I press "Click here to finish"
Then
there should be 1 response with answer "1"
  • @javascript
Re-Hidden Questions should clear answers
Given
the survey
 survey "Clear_Answers" do
     section "Main" do
	label "Cleared Answers" 
       q_1 "Do you want to see more questions?", :pick => :one
       a_1 "yes"
       a_2 "no"

	q_2 "pick one", :pick => :one
	a_1 "stuff"
	a_2 "things"
	dependency :rule => "A"
       condition_A :q_1, "==", :a_1

	q_3 "pick several", :pick => :any
	a_1 "one"
	a_2 "two"
	dependency :rule => "A"
       condition_A :q_1, "==", :a_1
     end
   end
When
I start the "Clear_Answers" survey
And
I choose "yes"
And
I choose "stuff"
And
I check "one"
And
I check "two"
And
I choose "no"
Then
there should be 1 response with answer "no"\
  • @javascript
I should be able to navigate between sections in multi-section survey

This scenario does not have any steps.

Multi-section survey
Given
the survey
  survey "Sections" do
  section "Section One" do
    q_1 "answer this", :pick => :one
    a_1 "one"
    a_2 "two"
  end
  section "Section Two" do
    q_2 "answer any", :pick => :any
    a_1 "one"
    a_2 "two"
  end
  end
Given
I am signed in
And
I start the "Sections" survey
And
I choose "one"
When
I press "Next section"
Then
I should see "Section Two"
Then
the question "answer any" should now be triggered

Last published over 1 year ago by wminsinger.