Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class ChangeColumnDefaultForPagesIsOptional < ActiveRecord::Migration[8.1]
def change
change_column_default :pages, :is_optional, from: nil, to: false
end
end
2 changes: 1 addition & 1 deletion db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

80 changes: 44 additions & 36 deletions db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@

# create some test groups
end_to_end_group = Group.create! name: "End to end tests", organisation: gds, status: :active
smoke_test_group = Group.create! name: "Smoke tests", organisation: gds, status: :active
test_group = Group.create! name: "Test Group", organisation: gds, creator: default_user, status: :active, send_filler_answers_enabled: true
multiple_branches_test_group = Group.create! name: "Test Group with multiple branches", organisation: gds, creator: default_user, status: :active, multiple_branches_enabled: true
Group.create! name: "Ministry of Tests forms", organisation: mot_org
Expand All @@ -145,6 +146,46 @@

submission_email = ENV["EMAIL"].presence || `git config --get user.email`.strip.presence || "example@example.com"

smoke_test_form = Form.create!(
name: "Scheduled smoke test",
creator_id: nil,
pages: [
Page.create(
question_text: "A text question",
hint_text: "No specific answer is required for the tests to pass",
answer_type: "text",
answer_settings: {
input_type: "single_line",
},
),
Page.create(
question_text: "A number question",
hint_text: "No specific answer is required for the tests to pass",
answer_type: "number",
),
Page.create(
question_text: "A full name question",
hint_text: "No specific answer is required for the tests to pass",
answer_type: "name",
answer_settings: {
input_type: "full_name",
title_needed: false,
},
),
],
question_section_completed: true,
declaration_markdown: "",
declaration_section_completed: true,
privacy_policy_url: "https://www.gov.uk/help/privacy-notice",
submission_email: "govuk-forms-automation-tests@digital.cabinet-office.gov.uk",
support_url: "https://www.forms.service.gov.uk",
support_url_text: "This form is for internal scheduled testing. Find out more about GOV.UK Forms.",
what_happens_next_markdown: "This form is for the scheduled smoke tests only",
share_preview_completed: true,
)
smoke_test_form.set_task_status_service(TaskStatusService.new(form: smoke_test_form, current_user: nil))
smoke_test_form.make_live!

all_question_types_form = Form.create!(
name: "All question types form",
creator_id: craig.id,
Expand All @@ -155,12 +196,10 @@
answer_settings: {
input_type: "single_line",
},
is_optional: false,
),
Page.create(
question_text: "Number",
answer_type: "number",
is_optional: false,
),
Page.create(
question_text: "Address",
Expand All @@ -171,30 +210,25 @@
uk_address: true,
},
},
is_optional: false,
),
Page.create(
question_text: "Email address",
answer_type: "email",
is_optional: false,
),
Page.create(
question_text: "Todays Date",
answer_type: "date",
answer_settings: {
input_type: "other_date",
},
is_optional: false,
),
Page.create(
question_text: "National Insurance number",
answer_type: "national_insurance_number",
is_optional: false,
),
Page.create(
question_text: "Phone number",
answer_type: "phone_number",
is_optional: false,
),
Page.create(
question_text: "Selection from a list of options",
Expand Down Expand Up @@ -240,7 +274,6 @@
answer_settings: {
input_type: "single_line",
},
is_optional: false,
),
],
question_section_completed: true,
Expand Down Expand Up @@ -274,7 +307,6 @@
{ "name": "No", value: "No" },
],
},
is_optional: false,
),
Page.create(
question_text: "How many times have you filled out this form?",
Expand All @@ -286,7 +318,6 @@
{ "name": "More than once", value: "More than once" },
],
},
is_optional: false,
),
Page.create(
question_text: "What’s your name?",
Expand All @@ -295,32 +326,24 @@
input_type: "full_name",
title_needed: false,
},
is_optional: false,
is_repeatable: false,
),
Page.create(
question_text: "What’s your email address?",
answer_type: "email",
is_optional: false,
is_repeatable: false,
),
Page.create(
question_text: "What was the reference of your previous submission?",
answer_type: "text",
answer_settings: {
input_type: "single_line",
},
is_optional: false,
is_repeatable: false,
),
Page.create(
question_text: "What’s your answer?",
answer_type: "text",
answer_settings: {
input_type: "single_line",
},
is_optional: false,
is_repeatable: false,
),
],
question_section_completed: true,
Expand Down Expand Up @@ -423,15 +446,11 @@
input_type: "full_name",
title_needed: false,
},
is_optional: false,
is_repeatable: false,
),
Page.create(
question_text: "What’s your email address?",
question_text_cy: "Beth yw eich cyfeiriad e-bost?",
answer_type: "email",
is_optional: false,
is_repeatable: false,
page_heading: "Email",
page_heading_cy: "E-bost",
guidance_markdown: "We'll use your email to:\n\n- contact you if there are any issues with your submission\n\n- send you your digital licence",
Expand All @@ -444,8 +463,6 @@
answer_settings: {
input_type: "single_line",
},
is_optional: false,
is_repeatable: false,
),
Page.create(
question_text: "What’s your answer?",
Expand All @@ -454,8 +471,6 @@
answer_settings: {
input_type: "single_line",
},
is_optional: false,
is_repeatable: false,
),
],
question_section_completed: true,
Expand Down Expand Up @@ -492,7 +507,6 @@
{ "name": "No", value: "No" },
],
},
is_optional: false,
),
Page.create(
question_text: "Where do you currently live?",
Expand All @@ -506,32 +520,26 @@
{ "name": "Northern Ireland", value: "Northern Ireland" },
],
},
is_optional: false,
),
Page.create(
question_text: "How many years have you lived in England?",
answer_type: "number",
is_optional: false,
),
Page.create(
question_text: "How many years have you lived in Scotland?",
answer_type: "number",
is_optional: false,
),
Page.create(
question_text: "How many years have you lived in Wales?",
answer_type: "number",
is_optional: false,
),
Page.create(
question_text: "How many years have you lived in Northern Ireland?",
answer_type: "number",
is_optional: false,
),
Page.create(
question_text: "How many years have you lived in the United Kingdom?",
answer_type: "number",
is_optional: false,
),
],
question_section_completed: true,
Expand Down Expand Up @@ -599,7 +607,6 @@
input_type: "full_name",
title_needed: false,
},
is_optional: false,
),
],
question_section_completed: true,
Expand All @@ -617,8 +624,9 @@
copy_of_answers_form.make_live!

# add forms to groups
GroupForm.create! group: end_to_end_group, form_id: all_question_types_form.id # All question types form
GroupForm.create! group: end_to_end_group, form_id: e2e_s3_forms.id # s3 submission test form
GroupForm.create! group: smoke_test_group, form_id: smoke_test_form.id # s3 submission test form
GroupForm.create! group: smoke_test_group, form_id: e2e_s3_forms.id # s3 submission test form
GroupForm.create! group: test_group, form_id: all_question_types_form.id # All question types form
GroupForm.create! group: test_group, form_id: branch_route_form.id # Branch routing form
GroupForm.create! group: test_group, form_id: none_of_the_above_form.id # None of the above form
GroupForm.create! group: test_group, form_id: welsh_form.id # Welsh form
Expand Down