class Object

Public Instance Methods

answer_first_questionnaire() click to toggle source
# File lib/decidim/forms/test/shared_examples/has_questionnaire.rb, line 96
def answer_first_questionnaire
  expect(page).to have_no_selector("#questionnaire_tos_agreement")

  fill_in question.body["en"], with: "My first answer"
  within ".answer-questionnaire__submit" do
    click_link "Continue"
  end
  expect(page).to have_content("STEP 2 OF 2")
end
change_focus() click to toggle source
# File lib/decidim/forms/test/shared_examples/has_questionnaire.rb, line 1415
def change_focus
  check "questionnaire_tos_agreement"
end
expand_all_questions() click to toggle source
# File lib/decidim/forms/test/shared_examples/manage_questionnaires.rb, line 103
def expand_all_questions
  find(".button.expand-all").click
end
expect_question_to_be_visible(visible) click to toggle source
# File lib/decidim/forms/test/shared_examples/has_questionnaire.rb, line 1411
def expect_question_to_be_visible(visible)
  expect(page).to have_css(conditioned_question_id, visible: visible)
end
find_nested_form_field(attribute, visible: :visible) click to toggle source
# File lib/decidim/forms/test/shared_examples/manage_questionnaires.rb, line 77
def find_nested_form_field(attribute, visible: :visible)
  current_scope.find(nested_form_field_selector(attribute), visible: visible)
end
find_nested_form_field_locator(attribute, visible: :visible) click to toggle source
# File lib/decidim/forms/test/shared_examples/manage_questionnaires.rb, line 73
def find_nested_form_field_locator(attribute, visible: :visible)
  find_nested_form_field(attribute, visible: visible)["id"]
end
have_nested_field(attribute, with:) click to toggle source
# File lib/decidim/forms/test/shared_examples/manage_questionnaires.rb, line 81
def have_nested_field(attribute, with:)
  have_field find_nested_form_field_locator(attribute), with: with
end
have_no_nested_field(attribute, with:) click to toggle source
# File lib/decidim/forms/test/shared_examples/manage_questionnaires.rb, line 85
def have_no_nested_field(attribute, with:)
  have_no_field(find_nested_form_field_locator(attribute), with: with)
end
look_like_first_question() click to toggle source
# File lib/decidim/forms/test/shared_examples/manage_questionnaires/update_questions.rb, line 454
def look_like_first_question
  have_no_button("Up").and have_button("Down")
end
look_like_intermediate_question() click to toggle source
# File lib/decidim/forms/test/shared_examples/manage_questionnaires/update_questions.rb, line 458
def look_like_intermediate_question
  have_button("Up").and have_button("Down")
end
look_like_last_question() click to toggle source
# File lib/decidim/forms/test/shared_examples/manage_questionnaires/update_questions.rb, line 462
def look_like_last_question
  have_button("Up").and have_no_button("Down")
end
nested_form_field_selector(attribute) click to toggle source
# File lib/decidim/forms/test/shared_examples/manage_questionnaires.rb, line 89
def nested_form_field_selector(attribute)
  "[id$=#{attribute}]"
end
visit_questionnaire_edit_path_and_expand_all() click to toggle source
# File lib/decidim/forms/test/shared_examples/manage_questionnaires.rb, line 107
def visit_questionnaire_edit_path_and_expand_all
  visit questionnaire_edit_path
  expand_all_questions
end
within_add_display_condition() { || ... } click to toggle source
# File lib/decidim/forms/test/shared_examples/manage_questionnaires.rb, line 93
def within_add_display_condition
  within ".questionnaire-question:last-of-type" do
    click_button "Add display condition"

    within ".questionnaire-question-display-condition:last-of-type" do
      yield
    end
  end
end