From 13bfb3bc4d431edb5cadb2bedce37d83ef283808 Mon Sep 17 00:00:00 2001 From: Ryan Wold <64987852+ryanwoldatwork@users.noreply.github.com> Date: Thu, 8 Jun 2023 13:30:15 -0700 Subject: [PATCH] Support 10 whitelist urls * update conditional options on Service form --- app/controllers/admin/forms_controller.rb | 9 + app/controllers/submissions_controller.rb | 13 +- app/serializers/form_serializer.rb | 9 + app/serializers/full_form_serializer.rb | 9 + app/views/admin/services/_form.html.erb | 14 +- .../components/_whitelist_options.html.erb | 45 ++ .../20230608193911_add_form_whitelist_urls.rb | 13 + db/schema.rb | 11 +- public/api/v0/openapi.yml | 18 + public/api/v1/openapi.yml | 483 +++++++++--------- spec/features/admin/forms_spec.rb | 13 + spec/fixtures/form.json | 9 + spec/fixtures/forms.json | 9 + 13 files changed, 412 insertions(+), 243 deletions(-) create mode 100644 db/migrate/20230608193911_add_form_whitelist_urls.rb diff --git a/app/controllers/admin/forms_controller.rb b/app/controllers/admin/forms_controller.rb index 0b9c6b4bc..79afc7dd5 100644 --- a/app/controllers/admin/forms_controller.rb +++ b/app/controllers/admin/forms_controller.rb @@ -437,6 +437,15 @@ def form_params :display_header_logo, :display_header_square_logo, :whitelist_url, + :whitelist_url_1, + :whitelist_url_2, + :whitelist_url_3, + :whitelist_url_4, + :whitelist_url_5, + :whitelist_url_6, + :whitelist_url_7, + :whitelist_url_8, + :whitelist_url_9, :whitelist_test_url, :disclaimer_text, :success_text, diff --git a/app/controllers/submissions_controller.rb b/app/controllers/submissions_controller.rb index dcbef51b7..eb44f3ef4 100644 --- a/app/controllers/submissions_controller.rb +++ b/app/controllers/submissions_controller.rb @@ -30,11 +30,20 @@ def create head :ok and return end - # Prevent the Submission if this is a published Form and if: + # Prevent the Submission if this is a published Form and if the form: if @form && request.referer && - # is not from the Form's whitelist URL + # is not from the Form's whitelist URLs (@form.whitelist_url.present? ? !request.referer.start_with?(@form.whitelist_url) : true) && + (@form.whitelist_url_1.present? ? !request.referer.start_with?(@form.whitelist_url_1) : true) && + (@form.whitelist_url_2.present? ? !request.referer.start_with?(@form.whitelist_url_2) : true) && + (@form.whitelist_url_3.present? ? !request.referer.start_with?(@form.whitelist_url_3) : true) && + (@form.whitelist_url_4.present? ? !request.referer.start_with?(@form.whitelist_url_4) : true) && + (@form.whitelist_url_5.present? ? !request.referer.start_with?(@form.whitelist_url_5) : true) && + (@form.whitelist_url_6.present? ? !request.referer.start_with?(@form.whitelist_url_6) : true) && + (@form.whitelist_url_7.present? ? !request.referer.start_with?(@form.whitelist_url_7) : true) && + (@form.whitelist_url_8.present? ? !request.referer.start_with?(@form.whitelist_url_8) : true) && + (@form.whitelist_url_9.present? ? !request.referer.start_with?(@form.whitelist_url_9) : true) && # is not from the Form's test whitelist URL (@form.whitelist_test_url.present? ? !request.referer.start_with?(@form.whitelist_test_url) : true) && # is not from the Touchpoints app diff --git a/app/serializers/form_serializer.rb b/app/serializers/form_serializer.rb index eb6f3b880..54f8bc095 100644 --- a/app/serializers/form_serializer.rb +++ b/app/serializers/form_serializer.rb @@ -12,6 +12,15 @@ class FormSerializer < ActiveModel::Serializer :created_at, :updated_at, :whitelist_url, + :whitelist_url_1, + :whitelist_url_2, + :whitelist_url_3, + :whitelist_url_4, + :whitelist_url_5, + :whitelist_url_6, + :whitelist_url_7, + :whitelist_url_8, + :whitelist_url_9, :whitelist_test_url, :display_header_logo, :success_text_heading, diff --git a/app/serializers/full_form_serializer.rb b/app/serializers/full_form_serializer.rb index d7ac83cc5..d41a5c89a 100644 --- a/app/serializers/full_form_serializer.rb +++ b/app/serializers/full_form_serializer.rb @@ -34,6 +34,15 @@ def links :created_at, :updated_at, :whitelist_url, + :whitelist_url_1, + :whitelist_url_2, + :whitelist_url_3, + :whitelist_url_4, + :whitelist_url_5, + :whitelist_url_6, + :whitelist_url_7, + :whitelist_url_8, + :whitelist_url_9, :whitelist_test_url, :display_header_logo, :success_text_heading, diff --git a/app/views/admin/services/_form.html.erb b/app/views/admin/services/_form.html.erb index 54170a126..c555ab059 100644 --- a/app/views/admin/services/_form.html.erb +++ b/app/views/admin/services/_form.html.erb @@ -19,7 +19,7 @@
<%= form.label :bureau_id, "Subcomponent/Bureau", class: "usa-label" %> - <%= form.select :bureau_id, options_for_select(organization_dropdown_options, service.bureau_id), { prompt: "Which Bureau?" }, { class: "usa-select" } %> + <%= form.select :bureau_id, options_for_select(organization_dropdown_options, service.bureau_id), { prompt: "Which Bureau?", include_blank: true }, { class: "usa-select" } %>
@@ -379,13 +379,17 @@ $("#service_digital_service_yes").on('click', function() { $("#service_designated_for_improvement_a11_280").attr('required', true); - $("#resources_needed_to_provide_digital_service_option").show(); + $("#service_resources_needed_to_provide_digital_service").show(); }) $("#service_digital_service_no").on('click', function() { $("#service_designated_for_improvement_a11_280").attr('required', false); - $("#resources_needed_to_provide_digital_service_option").hide(); + $("#service_resources_needed_to_provide_digital_service").hide(); }) + $("#service_multi_agency_service_yes").on('click', function() { + $("#service_multi_agency_explanation").attr('required', true); + $("#multi_agency_explanation_option").show(); + }) $("#service_multi_agency_service_yes").on('click', function() { $("#service_multi_agency_explanation").attr('required', true); $("#multi_agency_explanation_option").show(); @@ -445,6 +449,10 @@ $("#service_multi_agency_explanation").attr('required', true); $("#multi_agency_explanation_option").show(); } + if ($("#service_multi_agency_service_no:checked")) { + $("#service_multi_agency_explanation").attr('required', false); + $("#multi_agency_explanation_option").hide(); + } if ($("#service_fully_digital_service_yes:checked")) { $("#barriers_to_fully_digital_service_option").show(); diff --git a/app/views/components/_whitelist_options.html.erb b/app/views/components/_whitelist_options.html.erb index c36a2fa19..6890c235a 100644 --- a/app/views/components/_whitelist_options.html.erb +++ b/app/views/components/_whitelist_options.html.erb @@ -18,6 +18,51 @@ <%= f.url_field :whitelist_url, class: "usa-input", placeholder: "https://example.gov" %>
+
+
+ <%= f.url_field :whitelist_url_1, class: "usa-input", placeholder: "URL 1" %> +
+
+
+
+ <%= f.url_field :whitelist_url_2, class: "usa-input", placeholder: "URL 2" %> +
+
+
+
+ <%= f.url_field :whitelist_url_3, class: "usa-input", placeholder: "URL 3" %> +
+
+
+
+ <%= f.url_field :whitelist_url_4, class: "usa-input", placeholder: "URL 4" %> +
+
+
+
+ <%= f.url_field :whitelist_url_5, class: "usa-input", placeholder: "URL 5" %> +
+
+
+
+ <%= f.url_field :whitelist_url_6, class: "usa-input", placeholder: "URL 6" %> +
+
+
+
+ <%= f.url_field :whitelist_url_7, class: "usa-input", placeholder: "URL 7" %> +
+
+
+
+ <%= f.url_field :whitelist_url_8, class: "usa-input", placeholder: "URL 8" %> +
+
+
+
+ <%= f.url_field :whitelist_url_9, class: "usa-input", placeholder: "URL 9" %> +
+
<%= f.label :whitelist_test_url, "URL for staging or testing site where survey will display", class: "usa-label" %> diff --git a/db/migrate/20230608193911_add_form_whitelist_urls.rb b/db/migrate/20230608193911_add_form_whitelist_urls.rb new file mode 100644 index 000000000..96c8d121d --- /dev/null +++ b/db/migrate/20230608193911_add_form_whitelist_urls.rb @@ -0,0 +1,13 @@ +class AddFormWhitelistUrls < ActiveRecord::Migration[7.0] + def change + add_column :forms, :whitelist_url_1, :string + add_column :forms, :whitelist_url_2, :string + add_column :forms, :whitelist_url_3, :string + add_column :forms, :whitelist_url_4, :string + add_column :forms, :whitelist_url_5, :string + add_column :forms, :whitelist_url_6, :string + add_column :forms, :whitelist_url_7, :string + add_column :forms, :whitelist_url_8, :string + add_column :forms, :whitelist_url_9, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 250293b3f..26b6f63a4 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2023_05_31_225454) do +ActiveRecord::Schema[7.0].define(version: 2023_06_08_193911) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -258,6 +258,15 @@ t.integer "questions_count", default: 0 t.boolean "verify_csrf", default: true t.string "submissions_tags", array: true + t.string "whitelist_url_1" + t.string "whitelist_url_2" + t.string "whitelist_url_3" + t.string "whitelist_url_4" + t.string "whitelist_url_5" + t.string "whitelist_url_6" + t.string "whitelist_url_7" + t.string "whitelist_url_8" + t.string "whitelist_url_9" t.index ["legacy_touchpoint_id"], name: "index_forms_on_legacy_touchpoint_id" t.index ["legacy_touchpoint_uuid"], name: "index_forms_on_legacy_touchpoint_uuid" t.index ["organization_id"], name: "index_forms_on_organization_id" diff --git a/public/api/v0/openapi.yml b/public/api/v0/openapi.yml index 6669614bb..384254345 100644 --- a/public/api/v0/openapi.yml +++ b/public/api/v0/openapi.yml @@ -113,6 +113,24 @@ components: type: string whitelist_url: type: string + whitelist_url_1: + type: string + whitelist_url_2: + type: string + whitelist_url_3: + type: string + whitelist_url_4: + type: string + whitelist_url_5: + type: string + whitelist_url_6: + type: string + whitelist_url_7: + type: string + whitelist_url_8: + type: string + whitelist_url_9: + type: string whitelist_test_url: type: string display_header_logo: diff --git a/public/api/v1/openapi.yml b/public/api/v1/openapi.yml index 27765af3d..5fcdbcf5b 100644 --- a/public/api/v1/openapi.yml +++ b/public/api/v1/openapi.yml @@ -58,7 +58,7 @@ application/json: schema: type: array - items: + items: $ref: '#/components/schemas/Form' /websites.json: get: @@ -77,7 +77,7 @@ data: type: array items: - $ref: '#/components/schemas/Website' + $ref: '#/components/schemas/Website' '/websites/{id}.json': summary: returns one website record description: returns one website record @@ -102,7 +102,7 @@ properties: data: type: object - $ref: '#/components/schemas/Website' + $ref: '#/components/schemas/Website' /digital_products.json: get: summary: List published digital products (Mobile Apps) @@ -120,7 +120,7 @@ data: type: array items: - $ref: '#/components/schemas/DigitalProduct' + $ref: '#/components/schemas/DigitalProduct' '/digital_products/{id}.json': summary: returns one digital product record description: returns one digital product record @@ -145,7 +145,7 @@ properties: data: type: object - $ref: '#/components/schemas/DigitalProduct' + $ref: '#/components/schemas/DigitalProduct' /digital_service_accounts.json: get: summary: List published digital service accounts (Social Media Accounts) @@ -163,7 +163,7 @@ data: type: array items: - $ref: '#/components/schemas/DigitalServiceAccount' + $ref: '#/components/schemas/DigitalServiceAccount' '/digital_service_accounts/{id}.json': summary: returns one digital service account record description: returns one digital service account record @@ -197,22 +197,22 @@ name: X-API-KEY schemas: Channel: - required: + required: - "id" - "name" - "created_at" - "updated_at" - properties: - id: + properties: + id: type: "number" example: 39 - name: + name: type: "string" example: "website" - created_at: + created_at: type: "string" example: "2022-01-20T20:44:35.603Z" - updated_at: + updated_at: type: "string" example: "2022-01-20T20:44:35.603Z" Form: @@ -220,13 +220,13 @@ required: - id - name - properties: - id: + properties: + id: type: "string" - type: + type: type: "string" - attributes: - required: + attributes: + required: - "page" - "size" - "start_date" @@ -241,6 +241,15 @@ - "created_at" - "updated_at" - "whitelist_url" + - "whitelist_url_1" + - "whitelist_url_2" + - "whitelist_url_3" + - "whitelist_url_4" + - "whitelist_url_5" + - "whitelist_url_6" + - "whitelist_url_7" + - "whitelist_url_8" + - "whitelist_url_9" - "whitelist_test_url" - "display_header_logo" - "success_text_heading" @@ -275,156 +284,156 @@ - "time_zone" - "response_count" - "last_response_created_at" - properties: - page: + properties: + page: type: "number" - size: + size: type: "number" - start_date: + start_date: type: "string" - end_date: + end_date: type: "string" - name: + name: type: "string" - title: + title: type: "string" - instructions: + instructions: type: "string" - disclaimer_text: + disclaimer_text: type: "string" - kind: + kind: type: "string" - notes: + notes: type: "string" - created_at: + created_at: type: "string" - updated_at: + updated_at: type: "string" - whitelist_url: + whitelist_url: type: "string" - whitelist_test_url: + whitelist_test_url: type: "string" - display_header_logo: + display_header_logo: type: "boolean" - success_text_heading: + success_text_heading: type: "string" - success_text: + success_text: type: "string" - modal_button_text: + modal_button_text: type: "string" - display_header_square_logo: + display_header_square_logo: type: "boolean" - early_submission: + early_submission: type: "boolean" - user_id: + user_id: type: "number" - template: + template: type: "boolean" - uuid: + uuid: type: "string" - short_uuid: + short_uuid: type: "string" - organization_id: + organization_id: type: "number" - omb_approval_number: + omb_approval_number: type: "string" - medium: + medium: type: "string" - federal_register_url: + federal_register_url: type: "string" - service_name: + service_name: type: "string" - survey_instrument_reference: + survey_instrument_reference: type: "string" - agency_poc_email: + agency_poc_email: type: "string" - agency_poc_name: + agency_poc_name: type: "string" - department: + department: type: "string" - bureau: + bureau: type: "string" - notification_emails: + notification_emails: type: "string" - aasm_state: + aasm_state: type: "string" - delivery_method: + delivery_method: type: "string" - element_selector: + element_selector: type: "string" - survey_form_activations: + survey_form_activations: type: "number" - load_css: + load_css: type: "boolean" - logo: - required: + logo: + required: - "url" - "thumb" - "card" - "tag" - "logo_square" - properties: - url: + properties: + url: type: "string" - thumb: - required: + thumb: + required: - "url" - properties: - url: + properties: + url: type: "string" type: "object" - card: - required: + card: + required: - "url" - properties: - url: + properties: + url: type: "string" type: "object" - tag: - required: + tag: + required: - "url" - properties: - url: + properties: + url: type: "string" type: "object" - logo_square: - required: + logo_square: + required: - "url" - properties: - url: + properties: + url: type: "string" type: "object" type: "object" - time_zone: + time_zone: type: "string" - response_count: + response_count: type: "number" - last_response_created_at: + last_response_created_at: type: "string" type: "object" - relationships: + relationships: type: "object" - required: + required: - "questions" - "submissions" - properties: - questions: + properties: + questions: type: "object" - required: + required: - "data" - properties: - data: + properties: + data: type: "array" - items: + items: $ref: '#/components/schemas/Question' - submissions: + submissions: type: "object" - required: + required: - "data" - properties: - data: + properties: + data: type: "array" - items: + items: $ref: '#/components/schemas/Submission' Forms: type: array @@ -501,33 +510,33 @@ type: string Question: type: object - required: + required: - "data" - properties: - data: + properties: + data: type: "array" - items: + items: type: "object" - properties: - id: + properties: + id: type: "number" - form_id: + form_id: type: "number" - text: + text: type: "string" - question_type: + question_type: type: "string" - answer_field: + answer_field: type: "string" - position: + position: type: "number" - is_required: + is_required: type: "boolean" - created_at: + created_at: type: "string" - updated_at: + updated_at: type: "string" - form_section_id: + form_section_id: type: "number" Submissions: type: array @@ -540,80 +549,80 @@ - name - abbreviation - domain - properties: - id: + properties: + id: type: "number" - name: + name: type: "string" - url: + url: type: "string" - abbreviation: + abbreviation: type: "string" - domain: + domain: type: "string" - logo: - required: + logo: + required: - "url" - "thumb" - "card" - "tag" - "logo_square" - properties: - thumb: - required: + properties: + thumb: + required: - "url" properties: {} type: "object" - card: - required: + card: + required: - "url" properties: {} type: "object" - tag: - required: + tag: + required: - "url" properties: {} type: "object" - logo_square: - required: + logo_square: + required: - "url" properties: {} type: "object" type: object - digital_analytics_path: + digital_analytics_path: type: "string" - mission_statement: + mission_statement: type: "string" - mission_statement_url: + mission_statement_url: type: "string" - performance_url: + performance_url: type: "string" - strategic_plan_url: + strategic_plan_url: type: "string" - learning_agenda_url: + learning_agenda_url: type: "string" - cfo_act_agency: + cfo_act_agency: type: "boolean" PublicUser: type: object - properties: - email: + properties: + email: type: "string" Service: - required: + required: - "data" - properties: - data: + properties: + data: type: "array" - items: + items: type: "object" - properties: - id: + properties: + id: type: "string" - type: + type: type: "string" - attributes: - required: + attributes: + required: - "name" - "description" - "organization_id" @@ -639,98 +648,98 @@ - "available_in_person" - "available_digitally" - "available_via_phone" - properties: - name: + properties: + name: type: "string" - description: + description: type: "string" - organization_id: + organization_id: type: "number" - organization_abbreviation: + organization_abbreviation: type: "string" - organization_name: + organization_name: type: "string" - service_provider_id: + service_provider_id: type: "number" - service_provider_name: + service_provider_name: type: "string" - justification_text: + justification_text: type: "string" - kind: + kind: type: "array" - items: + items: type: "string" - transactional: + transactional: type: "boolean" - notes: + notes: type: "string" - hisp: + hisp: type: "boolean" - department: + department: type: "string" - bureau: + bureau: type: "string" - service_abbreviation: + service_abbreviation: type: "string" - service_slug: + service_slug: type: "string" - service_owner_email: + service_owner_email: type: "string" - service_managers: + service_managers: type: "array" - items: + items: type: "object" - properties: - email: + properties: + email: type: "string" - url: + url: type: "string" - homepage_url: + homepage_url: type: "string" - channels: + channels: type: "array" - items: + items: type: "object" - properties: - id: + properties: + id: type: "number" - name: + name: type: "string" - created_at: + created_at: type: "string" - updated_at: + updated_at: type: "string" - taggings_count: + taggings_count: type: "number" - tags: + tags: type: "array" - items: + items: $ref: '#/components/schemas/Tag' - available_in_person: + available_in_person: type: "boolean" - available_digitally: + available_digitally: type: "boolean" - available_via_phone: + available_via_phone: type: "boolean" Tag: - required: + required: - "id" - "name" - "created_at" - "updated_at" - properties: - id: + properties: + id: type: "number" example: 1776 - name: + name: type: "string" example: "customer-experience" - created_at: + created_at: type: "string" example: "2022-01-12T17:43:09.569Z" - updated_at: + updated_at: type: "string" - example: "2022-01-12T17:43:09.569Z" + example: "2022-01-12T17:43:09.569Z" Website: type: object Websites: @@ -738,25 +747,25 @@ items: $ref: '#/components/schemas/Website' DigitalProduct: - required: + required: - "data" - "links" - "meta" - properties: - data: + properties: + data: type: "array" - items: + items: type: "object" - properties: - id: + properties: + id: type: "string" example: "8" - type: + type: type: "string" example: "digital_products" - attributes: + attributes: type: object - required: + required: - "agencies" - "contacts" - "service" @@ -767,59 +776,59 @@ - "short_description" - "long_description" - "tags" - properties: - agencies: + properties: + agencies: type: "array" - items: + items: $ref: '#/components/schemas/Organization' example: [] - contacts: + contacts: type: "array" - items: + items: $ref: '#/components/schemas/PublicUser' example: [] - language: + language: type: "string" example: "English" - status: + status: type: "string" example: "published" - short_description: + short_description: type: "string" example: "Explore many of the most cherished cultural and historical sites on the National Mall." - long_description: + long_description: type: "string" example: "

This is the official National Park Service app for the National Mall and Memorial Parks. On your next visit to Washington, D.C., use it to explore many of the most cherished cultural and historical sites in the United States—from the Lincoln Memorial to the White House. The app includes a total of 70 sites.

Features:

Map – Official National Park Service map of the central tourist area in Washington, D.C. Easy to use while outdoors, the map features large font sizes, walkways that are easily distinguishable from roads, and three zoom levels. By tapping the “Locate me” icon you will always know where you are.

Park Lens – Find out what is around you with augmented reality. Just hold up your device and look through the camera. Labels will appear identifying all sites on the National Mall.

Walking directions – Get from one place to another by following a line on the map or a list of directions. Estimated walking times are given.

Sites – Learn more about points of interest with lively text, professional photographs, and engaging podcasts under the “Album” button. The “Info” button includes the site’s location, hours of operation, nearest Metro station, and other essential information.

Tours – Follow a recommended tour depending on how much time you have or your special interest—from memorials to presidents to military monuments to destinations off the beaten path. You can even create personal tours with the “My Tour” feature—just tap the “+” at the bottom right of a site page. The app maps the route for you.

Events and News – Get up-to-date information from the National Park Service about what is happening at the National Mall and Memorial Parks.

Postcard – Send a digital postcard to friends and family from the National Mall with the tap of a button.

Accessibility – Audio described images combined with the built-in iOS accessibility features will let all people enjoy the National Mall and Memorial Parks.

Park Partner – The Trust for the National Mall strives to make the National Mall the best park in the world. Learn more about the essential assistance this organization provides.

Small size – Weighing in at 13.7MB, the app will download relatively quickly via a 3G cellular connection or the free Wi-Fi available on the east end the National Mall.

" - tags: + tags: type: "array" - items: + items: $ref: '#/components/schemas/Tag' example: [] - links: - required: + links: + required: - "first" - "last" - properties: - first: + properties: + first: type: "string" example: "https://touchpoints.app.cloud.gov/api/v1/digital_products.json?API_KEY=1234&page=1" - last: + last: type: "string" example: "https://touchpoints.app.cloud.gov/api/v1/digital_products.json?API_KEY=1234&page=9" type: "object" - meta: - required: + meta: + required: - "size" - "page" - "totalPages" - properties: - size: + properties: + size: type: "number" example: 100 - page: + page: type: "number" example: 0 - totalPages: + totalPages: type: "number" example: 1 type: "object" @@ -830,30 +839,30 @@ $ref: '#/components/schemas/DigitalProduct' DigitalServiceAccount: type: object - properties: - name: + properties: + name: type: "string" - account: + account: type: "string" - status: + status: type: "string" agencies: type: array items: $ref: '#/components/schemas/Organization' - contacts: + contacts: type: "array" items: $ref: '#/components/schemas/PublicUser' - service_url: + service_url: type: "string" - short_description: + short_description: type: "string" - long_description: + long_description: type: "string" - tags: + tags: type: "array" - items: + items: type: "string" DigitalServiceAccounts: type: object @@ -863,16 +872,16 @@ items: $ref: '#/components/schemas/DigitalServiceAccount' Error: - required: + required: - "error" - properties: - error: - required: + properties: + error: + required: - "code" - "message" - properties: - code: + properties: + code: type: "string" - message: + message: type: "string" type: "object" diff --git a/spec/features/admin/forms_spec.rb b/spec/features/admin/forms_spec.rb index 4e82e8c72..0503a9971 100644 --- a/spec/features/admin/forms_spec.rb +++ b/spec/features/admin/forms_spec.rb @@ -493,6 +493,19 @@ end end + describe 'editing the whitelist url 3' do + before do + fill_in 'form_whitelist_url_3', with: 'https://example.com' + click_on 'Update Form' + end + + it 'can edit existing Form' do + expect(page).to have_content('Form was successfully updated.') + expect(page.current_path).to eq(delivery_admin_form_path(form)) + expect(find('#form_whitelist_url_3').value).to eq('https://example.com') + end + end + describe 'editing the delivery method' do before do find('label', text: 'Custom button & modal').click diff --git a/spec/fixtures/form.json b/spec/fixtures/form.json index 68c6a0f44..723dfee9d 100644 --- a/spec/fixtures/form.json +++ b/spec/fixtures/form.json @@ -13,6 +13,15 @@ "created_at": "2021-01-28T21:33:59.490Z", "updated_at": "2021-01-28T21:34:01.194Z", "whitelist_url": "", + "whitelist_url_1": "", + "whitelist_url_2": "", + "whitelist_url_3": "", + "whitelist_url_4": "", + "whitelist_url_5": "", + "whitelist_url_6": "", + "whitelist_url_7": "", + "whitelist_url_8": "", + "whitelist_url_9": "", "whitelist_test_url": "", "display_header_logo": false, "success_text": null, diff --git a/spec/fixtures/forms.json b/spec/fixtures/forms.json index e7a23a5f3..2c16d3a5c 100644 --- a/spec/fixtures/forms.json +++ b/spec/fixtures/forms.json @@ -13,6 +13,15 @@ "created_at": "2021-01-28T21:33:59.490Z", "updated_at": "2021-01-28T21:34:01.194Z", "whitelist_url": "", + "whitelist_url_1": "", + "whitelist_url_2": "", + "whitelist_url_3": "", + "whitelist_url_4": "", + "whitelist_url_5": "", + "whitelist_url_6": "", + "whitelist_url_7": "", + "whitelist_url_8": "", + "whitelist_url_9": "", "whitelist_test_url": "", "display_header_logo": false, "success_text": null,