diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ac475941e2..afb3b62773 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -65,7 +65,9 @@ jobs: - name: Setup test database run: | cp config/database.yml.ci config/database.yml + bin/rails db:drop bin/rails db:setup + bin/rails db:test:prepare - name: Install Chromedriver uses: nanasess/setup-chromedriver@master - name: Configure Chromedriver diff --git a/.rubocop.yml b/.rubocop.yml index 010d1e2dcb..f1ec2bbe93 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -86,6 +86,10 @@ Metrics/PerceivedComplexity: Exclude: - db/migrate/* +Metrics/ModuleLength: + Exclude: + - spec/**/* + Metrics/ParameterLists: CountKeywordArgs: false diff --git a/Gemfile b/Gemfile index 29c84b435b..53bd65a6e2 100644 --- a/Gemfile +++ b/Gemfile @@ -26,7 +26,7 @@ gem "spreadsheet" # For XLSForm export gem "term-ansicolor", "~> 1.3" gem "terrapin", "~> 0.6.0" gem "thor", "~> 1.0" -gem "twilio-ruby", "~> 6.9.0" # Does not use semver after v5, watch out! +gem "twilio-ruby", "~> 7.2.0" # Does not use semver after v5, watch out! # JS/CSS gem "bootstrap", "~> 4.3" @@ -88,7 +88,7 @@ gem "acts_as_list" # Caching gem "actionpack-page_caching", "~> 1.1" -gem "bootsnap", "~> 1.4", require: false, group: [:production] +gem "bootsnap", "~> 1.4", require: false gem "dalli", "~> 3.2" # DB @@ -116,8 +116,7 @@ gem "scout_apm", "~> 5.0" gem "sentry-ruby", "~> 5.0" gem "sentry-rails", "~> 5.0" # rubocop:disable Bundler/OrderedGems -# Force Sprockets to stay on v3 for now. -gem "sprockets", "~> 3" +gem "sprockets" # The below are used for building load test plans. # Needed in prod because test plans are built on prod instances. @@ -155,9 +154,8 @@ group :development, :test do gem "factory_bot_rails", "~> 4.11" gem "mocha", "~> 1.1" - # Feature specs + # system specs gem "capybara", "~> 3.30" - gem "capybara-screenshot", "~> 1.0" gem "launchy", "~> 2.5" # For auto-opening capybara html file gem "puma", "~> 5.6" gem "selenium-webdriver", "~> 4.15.0" # TODO: Can't upgrade to 4.17 until Rails 7 + Ruby 3.3 @@ -177,9 +175,8 @@ group :development, :test do gem "annotate", "~> 3.1" gem "assert_difference", "~> 1.0" # Deprecated: Barely used, convert usage to something else. gem "awesome_print", "~> 1.6" - gem "database_cleaner", "~> 2.0" gem "db-query-matchers", "~> 0.10" - gem "rubocop", "1.22.3" # Hound supported versions: http://help.houndci.com/en/articles/2461415-supported-linters + gem "rubocop" gem "rubocop-rails", "~> 2.8" gem "rubocop-rake", "~> 0.6.0" gem "rubocop-rspec", "~> 2.0" diff --git a/Gemfile.lock b/Gemfile.lock index 606bc6c1d1..522ad2017a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -191,9 +191,6 @@ GEM rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) - capybara-screenshot (1.0.26) - capybara (>= 1.0, < 4) - launchy choice (0.2.0) chronic (0.10.2) chunky_png (1.4.0) @@ -216,12 +213,6 @@ GEM csv (3.3.0) daemons (1.4.1) dalli (3.2.8) - database_cleaner (2.0.2) - database_cleaner-active_record (>= 2, < 3) - database_cleaner-active_record (2.1.0) - activerecord (>= 5.a) - database_cleaner-core (~> 2.0.0) - database_cleaner-core (2.0.1) date (3.3.4) db-query-matchers (0.12.0) activesupport (>= 4.0, < 7.2) @@ -339,6 +330,7 @@ GEM json (2.7.2) jwt (2.8.2) base64 + language_server-protocol (3.17.0.3) launchy (2.5.2) addressable (~> 2.8) letter_opener (1.10.0) @@ -532,15 +524,17 @@ GEM rspec-mocks (~> 3.13) rspec-support (~> 3.13) rspec-support (3.13.1) - rubocop (1.22.3) + rubocop (1.64.1) + json (~> 2.3) + language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 3.0.0.0) + parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) - rexml - rubocop-ast (>= 1.12.0, < 2.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.31.1, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 3.0) + unicode-display_width (>= 2.4.0, < 3.0) rubocop-ast (1.31.3) parser (>= 3.3.1.0) rubocop-rails (2.15.2) @@ -599,13 +593,12 @@ GEM spreadsheet (1.3.1) bigdecimal ruby-ole - sprockets (3.7.3) - base64 + sprockets (4.2.1) concurrent-ruby (~> 1.0) - rack (> 1, < 3) - sprockets-rails (3.5.1) - actionpack (>= 6.1) - activesupport (>= 6.1) + rack (>= 2.2.4, < 4) + sprockets-rails (3.4.2) + actionpack (>= 5.2) + activesupport (>= 5.2) sprockets (>= 3.0.0) stringio (3.1.1) strscan (3.1.0) @@ -624,7 +617,7 @@ GEM tins (1.33.0) bigdecimal sync - twilio-ruby (6.9.1) + twilio-ruby (7.2.2) faraday (>= 0.9, < 3.0) jwt (>= 1.5, < 3.0) nokogiri (>= 1.6, < 2.0) @@ -695,13 +688,11 @@ DEPENDENCIES bullet (~> 7.1) cancancan (~> 3.1) capybara (~> 3.30) - capybara-screenshot (~> 1.0) clipboard-rails (~> 1.7) closure_tree! csv daemons (~> 1.2) dalli (~> 3.2) - database_cleaner (~> 2.0) db-query-matchers (~> 0.10) delayed_job_active_record (~> 4.1) descriptive_statistics (~> 2.5) @@ -758,7 +749,7 @@ DEPENDENCIES rspec-collection_matchers (~> 1.1) rspec-github (~> 2.4) rspec-rails (~> 6.0) - rubocop (= 1.22.3) + rubocop rubocop-rails (~> 2.8) rubocop-rake (~> 0.6.0) rubocop-rspec (~> 2.0) @@ -772,13 +763,13 @@ DEPENDENCIES sentry-ruby (~> 5.0) spinjs-rails (~> 1.3.0) spreadsheet - sprockets (~> 3) + sprockets sys-filesystem (~> 1.4) term-ansicolor (~> 1.3) terrapin (~> 0.6.0) thor (~> 1.0) timecop (= 0.9.6) - twilio-ruby (~> 6.9.0) + twilio-ruby (~> 7.2.0) uglifier (~> 4.2) vcr (~> 6.0) versionist (~> 2.0) diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js new file mode 100644 index 0000000000..22c80c75e3 --- /dev/null +++ b/app/assets/config/manifest.js @@ -0,0 +1,3 @@ +//= link_tree ../images +//= link_tree ../../../vendor/assets +//= link application.js \ No newline at end of file diff --git a/app/controllers/ping_controller.rb b/app/controllers/ping_controller.rb index cc62025c26..545a3f4f89 100644 --- a/app/controllers/ping_controller.rb +++ b/app/controllers/ping_controller.rb @@ -6,10 +6,11 @@ class PingController < ApplicationController # Used by uptime checker def show + @site_name = current_mission_config.site_name @tests = {} @tests[:dj_running] = Utils::DelayedJobChecker.instance.ok? @ok = @tests.values.all? - @version = Cnfg.system_version + @version = Cnfg.system_version(detailed: true) render(layout: nil, formats: :text, status: @ok ? :ok : :service_unavailable) end end diff --git a/app/views/ping/show.text.erb b/app/views/ping/show.text.erb index d5c7345b05..0300b677fc 100644 --- a/app/views/ping/show.text.erb +++ b/app/views/ping/show.text.erb @@ -1,5 +1,5 @@ <% @title = "Ping" -%> -ELMO - <%= @ok ? "OK" : "NOT OK" %> +<%= @site_name %> - <%= @ok ? "OK" : "NOT OK" %> App is running. Version is <%= @version %>. Delayed Job is <%= @tests[:dj_running] ? "" : "NOT " %>ok. diff --git a/lib/config_manager.rb b/lib/config_manager.rb index f56ae530a7..d4257bb891 100644 --- a/lib/config_manager.rb +++ b/lib/config_manager.rb @@ -13,8 +13,33 @@ def offline_mode? end # read system version from file - def system_version - @system_version ||= File.read(Rails.root.join("VERSION")).strip + def system_version(detailed: false) + return @system_version if @system_version.present? && !detailed + return @detailed_system_version if @detailed_system_version.present? + + case Rails.env + when "development" + git_describe_tags = `git describe --tags` + git_branch = `git rev-parse --abbrev-ref HEAD` + @system_version = "#{git_describe_tags.strip} (#{git_branch.strip})" + @detailed_system_version = @system_version + else + version_file = File.read(Rails.root.join("VERSION")).strip if File.exist?(Rails.root.join("VERSION")) + version = version_file + + @system_version = version + return @system_version unless detailed + + revision_file = File.read(Rails.root.join("REVISION")) if File.exist?(Rails.root.join("REVISION")) + branch_file = File.read(Rails.root.join("BRANCH")) if File.exist?(Rails.root.join("BRANCH")) + + revision = revision_file&.strip&.slice(0..8)&.then { |rev| "(#{rev})" }.presence + branch = branch_file&.strip&.then { |br| "[#{br}]" }.presence + + @detailed_system_version = [version, revision, branch].compact.join(" ") + end + + detailed ? @detailed_system_version : @system_version end # Locales we support that are displayed right-to-left. @@ -59,7 +84,7 @@ def url_port # Returns a hash of url options (port, protocol, host). Omits port if it's default for protocol. def url_options options = {protocol: url_protocol, host: url_host} - return options if url_protocol == "http" && url_port == 80 || url_protocol == "https" && url_port == 443 + return options if (url_protocol == "http" && url_port == 80) || (url_protocol == "https" && url_port == 443) options[:port] = url_port options end @@ -73,7 +98,7 @@ def smtp_port end def smtp_domain - ENV["NEMO_SMTP_DOMAIN"] + ENV.fetch("NEMO_SMTP_DOMAIN", nil) end def smtp_authentication @@ -81,11 +106,11 @@ def smtp_authentication end def smtp_user_name - ENV["NEMO_SMTP_USER_NAME"] + ENV.fetch("NEMO_SMTP_USER_NAME", nil) end def smtp_password - ENV["NEMO_SMTP_PASSWORD"] + ENV.fetch("NEMO_SMTP_PASSWORD", nil) end # Returns a hash of SMTP options, omitting anything that's blank @@ -102,15 +127,15 @@ def smtp_options end def google_maps_key - ENV["NEMO_GOOGLE_MAPS_API_KEY"] + ENV.fetch("NEMO_GOOGLE_MAPS_API_KEY", nil) end def scout_key - ENV["NEMO_SCOUT_KEY"] + ENV.fetch("NEMO_SCOUT_KEY", nil) end def sentry_dsn - ENV["NEMO_SENTRY_DSN"] + ENV.fetch("NEMO_SENTRY_DSN", nil) end def allow_missionless_sms? @@ -118,15 +143,15 @@ def allow_missionless_sms? end def universal_sms_token - allow_missionless_sms? ? ENV["NEMO_UNIVERSAL_SMS_TOKEN"] : nil + allow_missionless_sms? ? ENV.fetch("NEMO_UNIVERSAL_SMS_TOKEN", nil) : nil end def recaptcha_public_key - ENV["NEMO_RECAPTCHA_PUBLIC_KEY"] + ENV.fetch("NEMO_RECAPTCHA_PUBLIC_KEY", nil) end def recaptcha_private_key - ENV["NEMO_RECAPTCHA_PRIVATE_KEY"] + ENV.fetch("NEMO_RECAPTCHA_PRIVATE_KEY", nil) end def storage_service diff --git a/spec/decorators/odk/condition_group_decorator_spec.rb b/spec/decorators/odk/condition_group_decorator_spec.rb index 35b21b82ad..f3db56409d 100644 --- a/spec/decorators/odk/condition_group_decorator_spec.rb +++ b/spec/decorators/odk/condition_group_decorator_spec.rb @@ -3,7 +3,7 @@ require "rails_helper" module ODK - describe ConditionGroupDecorator, :odk, :reset_factory_sequences, database_cleaner: :truncate do + describe ConditionGroupDecorator, :odk, :reset_factory_sequences do include_context "odk rendering" let(:result) { decorate(condition_group).to_odk } diff --git a/spec/decorators/odk/form_item_decorator_spec.rb b/spec/decorators/odk/form_item_decorator_spec.rb index f0b81d34c5..3502a3c887 100644 --- a/spec/decorators/odk/form_item_decorator_spec.rb +++ b/spec/decorators/odk/form_item_decorator_spec.rb @@ -3,7 +3,7 @@ require "rails_helper" module ODK - describe FormItemDecorator, :odk, :reset_factory_sequences, database_cleaner: :truncate do + describe FormItemDecorator, :odk, :reset_factory_sequences do include_context "odk rendering" describe "xpath methods" do diff --git a/spec/jobs/dedupe_job_spec.rb b/spec/jobs/dedupe_job_spec.rb index 16bf11c132..5d741a9d25 100644 --- a/spec/jobs/dedupe_job_spec.rb +++ b/spec/jobs/dedupe_job_spec.rb @@ -197,7 +197,7 @@ ) end - it "should dedupe correctly", database_cleaner: :truncate do + it "should dedupe correctly" do # Start with two existing dupes, but are clean described_class.perform_now expect(Response.all.count).to eq(2) diff --git a/spec/models/sms/decoder_spec.rb b/spec/models/sms/decoder_spec.rb index 088ca96a09..9415ddc7c2 100644 --- a/spec/models/sms/decoder_spec.rb +++ b/spec/models/sms/decoder_spec.rb @@ -619,7 +619,7 @@ end end - describe "complex hierarchy construction", database_cleaner: :truncate do + describe "complex hierarchy construction" do it "builds response tree for nested groups with repeat" do # QingGroup (root) # QingGroup diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 8778db3778..76f23162f0 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -8,7 +8,6 @@ require "capybara/rspec" require "capybara/rails" require "selenium-webdriver" -require "capybara-screenshot/rspec" require "cancan/matchers" require "fileutils" require "vcr" @@ -27,13 +26,6 @@ end end -Capybara.javascript_driver = :selenium_chrome_headless - -# Add support for Headless Chrome screenshots. -Capybara::Screenshot.register_driver(:selenium_chrome_headless) do |driver, path| - driver.browser.save_screenshot(path) -end - # Requires supporting ruby files with custom matchers and macros, etc, # in spec/support/ and its subdirectories. Dir[Rails.root.join("spec/support/**/*.rb")].sort.each { |f| require f } @@ -53,7 +45,7 @@ # If you're not using ActiveRecord, or you'd prefer not to run each of your # examples within a transaction, remove the following line or assign false # instead of true. - config.use_transactional_fixtures = false + config.use_transactional_fixtures = true # If true, the base class of anonymous controllers will be inferred # automatically. This will be the default behavior in future versions of @@ -72,7 +64,7 @@ config.infer_spec_type_from_file_location! config.include(AssertDifference) - config.include(FeatureSpecHelpers, type: :feature) + config.include(SystemSpecHelpers, type: :system) config.include(GeneralSpecHelpers) config.include(ModelSpecHelpers, type: :model) config.include(RequestSpecHelpers, type: :request) @@ -88,6 +80,15 @@ FileUtils.mkdir_p(Rails.root.join("tmp")) end + # Set up system tests + config.before(:each, type: :system) do + driven_by(:rack_test) + end + + config.before(:each, type: :system, js: true) do + driven_by :selenium_chrome_headless + end + # We have to use around so that this block runs before arounds and befores in actual specs. config.around(:each) do |example| # Previous specs might leave locale set to something else, which can cause issues. @@ -97,23 +98,16 @@ ENV.delete("TEST_LOGGED_IN_USER_ID") Rails::Debug.log("<----- #{example.description} (#{example.location}) ----->") + @_setting = create(:setting, mission: nil) example.run + @_setting.destroy! Rails::Debug.log("<----- #{example.description} ----->") Rails::Debug.log("") end - config.before(:each) do - # This is the root setting, which is seed data so it should always be available. - # It's in a before block because it needs to come after DatabaseCleaners things, which - # are in before blocks. If it goes in the above around block, it runs too early and doesn't get cleaned. - # If this causes issues, a solution might be to change the DatabaseCleaner initializer to use - # around blocks. - create(:setting, mission: nil) - end - # Print browser logs to console if they are non-empty. # You MUST use console.warn or console.error for this to work. - config.after(:each, type: :feature, js: true) do + config.after(:each, type: :system, js: true) do # logs = page.driver.browser.manage.logs.get(:browser).join("\n") logs = "" unless logs.strip.empty? diff --git a/spec/requests/media/odk_response_spec.rb b/spec/requests/media/odk_response_spec.rb index 5f18bb9942..f54645ce33 100644 --- a/spec/requests/media/odk_response_spec.rb +++ b/spec/requests/media/odk_response_spec.rb @@ -28,7 +28,7 @@ FileUtils.rm_rf(ResponsesController::TMP_UPLOADS_PATH) end - it "should successfully process the submission and clean up", database_cleaner: :truncate do + it "should successfully process the submission and clean up" do image = Rack::Test::UploadedFile.new(image_fixture("the_swing.jpg"), "image/jpeg") submission_file = prepare_and_upload_submission_file("single_part_media.xml") @@ -46,7 +46,7 @@ expect(FileUtils.rm(tmp_files)).to be_empty end - it "should safely ignore simple duplicates", database_cleaner: :truncate do + it "should safely ignore simple duplicates" do # Original submission_file = prepare_and_upload_submission_file("single_question.xml") post submission_path, params: {xml_submission_file: submission_file}, headers: auth_header @@ -99,7 +99,7 @@ context "with multiple parts" do let(:form) { create(:form, :live, question_types: %w[text image sketch]) } - it "should successfully process the submission", database_cleaner: :truncate do + it "should successfully process the submission" do image = Rack::Test::UploadedFile.new(image_fixture("the_swing.jpg"), "image/jpeg") image2 = Rack::Test::UploadedFile.new(image_fixture("sassafras.jpg"), "image/jpeg") submission_file = prepare_and_upload_submission_file("multiple_part_media.xml") @@ -117,7 +117,7 @@ context "with multiple parts, duplicate submissions for first part" do let(:form) { create(:form, :live, question_types: %w[text image sketch]) } - it "should ignore the second submission", database_cleaner: :truncate do + it "should ignore the second submission" do image = Rack::Test::UploadedFile.new(image_fixture("the_swing.jpg"), "image/jpeg") image2 = Rack::Test::UploadedFile.new(image_fixture("sassafras.jpg"), "image/jpeg") submission_file = prepare_and_upload_submission_file("multiple_part_media.xml") @@ -140,7 +140,7 @@ context "with multiple parts, duplicate submissions for second part" do let(:form) { create(:form, :live, question_types: %w[text image sketch]) } - it "should ignore the third submission as it is a duplicate", database_cleaner: :truncate do + it "should ignore the third submission as it is a duplicate" do image = Rack::Test::UploadedFile.new(image_fixture("the_swing.jpg"), "image/jpeg") image2 = Rack::Test::UploadedFile.new(image_fixture("sassafras.jpg"), "image/jpeg") submission_file = prepare_and_upload_submission_file("multiple_part_media.xml") @@ -163,7 +163,7 @@ context "with multiple parts, duplicate first submission at the end" do let(:form) { create(:form, :live, question_types: %w[text image sketch]) } - it "should successfully process the submission", database_cleaner: :truncate do + it "should successfully process the submission" do image = Rack::Test::UploadedFile.new(image_fixture("the_swing.jpg"), "image/jpeg") image2 = Rack::Test::UploadedFile.new(image_fixture("sassafras.jpg"), "image/jpeg") submission_file = prepare_and_upload_submission_file("multiple_part_media.xml") @@ -186,7 +186,7 @@ context "with multiple parts, duplicate xml/image and no response" do let(:form) { create(:form, :live, question_types: %w[text image sketch]) } - it "should successfully process the submission", database_cleaner: :truncate do + it "should successfully process the submission" do image = Rack::Test::UploadedFile.new(image_fixture("the_swing.jpg"), "image/jpeg") submission_file = prepare_and_upload_submission_file("multiple_part_media.xml") submission_file2 = prepare_and_upload_submission_file("multiple_part_media.xml") @@ -207,7 +207,7 @@ context "multiple media attachments in multiple responses" do let(:form) { create(:form, :live, question_types: %w[text image sketch image]) } - it "should successfully process the submission", database_cleaner: :truncate do + it "should successfully process the submission" do image = Rack::Test::UploadedFile.new(image_fixture("the_swing.jpg"), "image/jpeg") image2 = Rack::Test::UploadedFile.new(image_fixture("sassafras.jpg"), "image/jpeg") image3 = Rack::Test::UploadedFile.new(image_fixture("sassafras2.jpg"), "image/jpeg") diff --git a/spec/requests/odk/submission_spec.rb b/spec/requests/odk/submission_spec.rb index 7c485c135b..f2a9434cb2 100644 --- a/spec/requests/odk/submission_spec.rb +++ b/spec/requests/odk/submission_spec.rb @@ -43,14 +43,14 @@ end context "normal submission" do - it "should work and have mission set to current mission", database_cleaner: :truncate do + it "should work and have mission set to current mission" do post(submission_path, params: request_params, headers: auth_header) expect(response).to have_http_status(:created) expect(nemo_response.mission).to eq(mission) expect(nemo_response.device_id).to eq(nil) end - it "should save device ID if present", database_cleaner: :truncate do + it "should save device ID if present" do post("#{submission_path}?deviceID=test", params: request_params, headers: auth_header) expect(response).to have_http_status(:created) expect(nemo_response.device_id).to eq("test") @@ -139,7 +139,7 @@ form.c[1].update!(required: true) end - it "should still accept response", database_cleaner: :truncate do + it "should still accept response" do post(submission_path, params: request_params, headers: auth_header) expect(response).to have_http_status(:created) expect(nemo_response.children.size).to eq(1) @@ -163,7 +163,7 @@ end let!(:question_types) { %w[text text text text] } - it "should return created", database_cleaner: :truncate do + it "should return created" do prepare_odk_response_fixture("simple_response", form1, values: xml_values, formver: "202211") r1 r1_original_path = Rails.root.join("tmp/odk/responses/simple_response/simple_response.xml") diff --git a/spec/support/configs/database_cleaner.rb b/spec/support/configs/database_cleaner.rb deleted file mode 100644 index 4a1231b142..0000000000 --- a/spec/support/configs/database_cleaner.rb +++ /dev/null @@ -1,33 +0,0 @@ -# frozen_string_literal: true - -RSpec.configure do |config| - config.before(:suite) do - DatabaseCleaner.clean_with(:truncation) - end - - config.before(:each) do - DatabaseCleaner.strategy = :transaction - end - - config.before(:each, js: true) do - DatabaseCleaner.strategy = :truncation - DatabaseCleaner.clean - end - - config.before(:each, database_cleaner: :truncate) do - DatabaseCleaner.strategy = :truncation - DatabaseCleaner.clean - end - - config.after(:all) do - DatabaseCleaner.clean_with(:truncation) - end - - config.before(:each) do |example| - DatabaseCleaner.start if example.metadata[:database_cleaner] != :all - end - - config.append_after(:each) do |example| - DatabaseCleaner.clean if example.metadata[:database_cleaner] != :all - end -end diff --git a/spec/support/helpers/feature_spec_helpers.rb b/spec/support/helpers/system_spec_helpers.rb similarity index 97% rename from spec/support/helpers/feature_spec_helpers.rb rename to spec/support/helpers/system_spec_helpers.rb index 7aa0d2297e..ee3340c7fd 100644 --- a/spec/support/helpers/feature_spec_helpers.rb +++ b/spec/support/helpers/system_spec_helpers.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true -module FeatureSpecHelpers +# Collection of helper methods for integration testing. +module SystemSpecHelpers ALERT_CLASSES = { notice: "alert-info", success: "alert-success", @@ -53,7 +54,8 @@ def fill_in_token_input(id, options) unless options[:dont_pick] if options[:pick] textual_numbers = %i[first second third fourth fifth] - if index = textual_numbers.index(options[:pick]) + index = textual_numbers.index(options[:pick]) + if index selector = ":nth-child(#{index + 1})" elsif options[:pick].class == String selector = ":contains(\"#{options[:pick]}\")" diff --git a/spec/features/broadcasts_spec.rb b/spec/system/broadcasts_spec.rb similarity index 99% rename from spec/features/broadcasts_spec.rb rename to spec/system/broadcasts_spec.rb index f1d3ae9cad..83c43a54a8 100644 --- a/spec/features/broadcasts_spec.rb +++ b/spec/system/broadcasts_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "broadcasts", :sms, js: true do +describe "broadcasts", :sms, js: true do include_context "search" let(:max_user_dropdown_results) { BroadcastsController::USERS_OR_GROUPS_PER_PAGE * 2 } let!(:user) { create(:user, role_name: "staffer") } diff --git a/spec/features/dashboard_spec.rb b/spec/system/dashboard_spec.rb similarity index 98% rename from spec/features/dashboard_spec.rb rename to spec/system/dashboard_spec.rb index 5ce9a59d4b..68eb0d0cbc 100644 --- a/spec/features/dashboard_spec.rb +++ b/spec/system/dashboard_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "dashboard", js: true do +describe "dashboard", js: true do let(:dashboard_path) { mission_root_path(mission_name: get_mission.compact_name, locale: "en") } before do diff --git a/spec/features/form_hint_spec.rb b/spec/system/form_hint_spec.rb similarity index 98% rename from spec/features/form_hint_spec.rb rename to spec/system/form_hint_spec.rb index 149f85bd7d..4e22c4320b 100644 --- a/spec/features/form_hint_spec.rb +++ b/spec/system/form_hint_spec.rb @@ -3,7 +3,7 @@ # Tests the hint popovers in regular forms and modal forms. require "rails_helper" -feature "form hints", js: true do +describe "form hints", js: true do let(:form) { create(:form, question_types: %w[integer image image]) } let(:mission_name) { get_mission.compact_name } let(:user) { create(:user, role_name: "coordinator") } diff --git a/spec/features/forms/form/form_export_spec.rb b/spec/system/forms/form/form_export_spec.rb similarity index 98% rename from spec/features/forms/form/form_export_spec.rb rename to spec/system/forms/form/form_export_spec.rb index 6995adc28f..aac13aa566 100644 --- a/spec/features/forms/form/form_export_spec.rb +++ b/spec/system/forms/form/form_export_spec.rb @@ -4,7 +4,7 @@ require "fileutils" require "zip" -feature "form export" do +describe "form export" do context "single form" do let(:user) { create(:user, role_name: "coordinator") } let(:form) { create(:form, :live, question_types: %w[text]) } diff --git a/spec/features/forms/form/form_status_and_version_spec.rb b/spec/system/forms/form/form_status_and_version_spec.rb similarity index 98% rename from spec/features/forms/form/form_status_and_version_spec.rb rename to spec/system/forms/form/form_status_and_version_spec.rb index 3d98bb850e..c41a3e273a 100644 --- a/spec/features/forms/form/form_status_and_version_spec.rb +++ b/spec/system/forms/form/form_status_and_version_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "form status and version display and changes", js: true do +describe "form status and version display and changes", js: true do let!(:form) { create(:form, :draft, name: "Myform") } let(:user) { create(:user, role_name: "coordinator") } diff --git a/spec/features/forms/form/item_edit_spec.rb b/spec/system/forms/form/item_edit_spec.rb similarity index 99% rename from spec/features/forms/form/item_edit_spec.rb rename to spec/system/forms/form/item_edit_spec.rb index 401a9876ab..6435d9ab07 100644 --- a/spec/features/forms/form/item_edit_spec.rb +++ b/spec/system/forms/form/item_edit_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "forms", js: true do +describe "forms", js: true do INDENT = 40 let!(:user) { create(:user) } diff --git a/spec/features/forms/form/printable_spec.rb b/spec/system/forms/form/printable_spec.rb similarity index 98% rename from spec/features/forms/form/printable_spec.rb rename to spec/system/forms/form/printable_spec.rb index 88fbd64620..b527d170b0 100644 --- a/spec/features/forms/form/printable_spec.rb +++ b/spec/system/forms/form/printable_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "forms", js: true do +describe "forms", js: true do let(:user) { create(:user) } let(:form) do create(:form, name: "Foo", question_types: %w[integer multilevel_select_one select_one integer]) diff --git a/spec/features/forms/form_item/constraints_form_spec.rb b/spec/system/forms/form_item/constraints_form_spec.rb similarity index 99% rename from spec/features/forms/form_item/constraints_form_spec.rb rename to spec/system/forms/form_item/constraints_form_spec.rb index c4e8b9761c..894c9142b5 100644 --- a/spec/features/forms/form_item/constraints_form_spec.rb +++ b/spec/system/forms/form_item/constraints_form_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "constraints form fields", js: true do +describe "constraints form fields", js: true do let!(:user) { create(:admin) } let(:standard) { false } let(:traits) { standard ? [:standard] : [] } diff --git a/spec/features/forms/form_item/display_logic_form_spec.rb b/spec/system/forms/form_item/display_logic_form_spec.rb similarity index 99% rename from spec/features/forms/form_item/display_logic_form_spec.rb rename to spec/system/forms/form_item/display_logic_form_spec.rb index 1bcfd51eb8..499e0ffc80 100644 --- a/spec/features/forms/form_item/display_logic_form_spec.rb +++ b/spec/system/forms/form_item/display_logic_form_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "display logic form fields", js: true do +describe "display logic form fields", js: true do let!(:user) { create(:admin) } let(:standard) { false } let(:traits) { standard ? [:standard] : [] } diff --git a/spec/features/forms/form_item/qing_group_form_spec.rb b/spec/system/forms/form_item/qing_group_form_spec.rb similarity index 98% rename from spec/features/forms/form_item/qing_group_form_spec.rb rename to spec/system/forms/form_item/qing_group_form_spec.rb index ea164108a9..ab48ca5656 100644 --- a/spec/features/forms/form_item/qing_group_form_spec.rb +++ b/spec/system/forms/form_item/qing_group_form_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "adding and editing qing group on form", js: true do +describe "adding and editing qing group on form", js: true do let!(:user) { create(:user) } let!(:form) do create(:form, name: "Foo", diff --git a/spec/features/forms/form_item/questionings_form_spec.rb b/spec/system/forms/form_item/questionings_form_spec.rb similarity index 100% rename from spec/features/forms/form_item/questionings_form_spec.rb rename to spec/system/forms/form_item/questionings_form_spec.rb diff --git a/spec/features/forms/form_item/skip_logic_form_spec.rb b/spec/system/forms/form_item/skip_logic_form_spec.rb similarity index 99% rename from spec/features/forms/form_item/skip_logic_form_spec.rb rename to spec/system/forms/form_item/skip_logic_form_spec.rb index 5a0a170604..f27af92150 100644 --- a/spec/features/forms/form_item/skip_logic_form_spec.rb +++ b/spec/system/forms/form_item/skip_logic_form_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "skip logic form fields", js: true do +describe "skip logic form fields", js: true do let!(:user) { create(:admin) } let(:standard) { false } let(:traits) { standard ? [:standard] : [] } diff --git a/spec/features/forms/option_set/option_sets_spec.rb b/spec/system/forms/option_set/option_sets_spec.rb similarity index 99% rename from spec/features/forms/option_set/option_sets_spec.rb rename to spec/system/forms/option_set/option_sets_spec.rb index b23373c5f1..fc94ed8395 100644 --- a/spec/features/forms/option_set/option_sets_spec.rb +++ b/spec/system/forms/option_set/option_sets_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "option set" do +describe "option set" do let(:user) { create(:user, role_name: "coordinator") } before do diff --git a/spec/features/forms/question/question_form_spec.rb b/spec/system/forms/question/question_form_spec.rb similarity index 100% rename from spec/features/forms/question/question_form_spec.rb rename to spec/system/forms/question/question_form_spec.rb diff --git a/spec/features/forms/question/question_index_spec.rb b/spec/system/forms/question/question_index_spec.rb similarity index 94% rename from spec/features/forms/question/question_index_spec.rb rename to spec/system/forms/question/question_index_spec.rb index f2fec13b6f..e1768ffcf6 100644 --- a/spec/features/forms/question/question_index_spec.rb +++ b/spec/system/forms/question/question_index_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "question index", js: true do +describe "question index", js: true do let(:admin) { create(:admin) } let(:mission) { get_mission } let!(:questions) { create_list(:question, 3, canonical_name: "duplicated", mission: mission) } diff --git a/spec/features/forms/question/question_tag_spec.rb b/spec/system/forms/question/question_tag_spec.rb similarity index 99% rename from spec/features/forms/question/question_tag_spec.rb rename to spec/system/forms/question/question_tag_spec.rb index 81704af544..7ac33b2d26 100644 --- a/spec/features/forms/question/question_tag_spec.rb +++ b/spec/system/forms/question/question_tag_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "question tags" do +describe "question tags" do include_context "search" let!(:mission) { get_mission } diff --git a/spec/features/locale_change_spec.rb b/spec/system/locale_change_spec.rb similarity index 96% rename from spec/features/locale_change_spec.rb rename to spec/system/locale_change_spec.rb index da263485c5..b5673349f3 100644 --- a/spec/features/locale_change_spec.rb +++ b/spec/system/locale_change_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "locale change", js: true do +describe "locale change", js: true do let!(:user) { create(:user) } let!(:form) { create(:form, :live) } diff --git a/spec/features/login_instructions_spec.rb b/spec/system/login_instructions_spec.rb similarity index 96% rename from spec/features/login_instructions_spec.rb rename to spec/system/login_instructions_spec.rb index 9466012259..b12dfe2d71 100644 --- a/spec/features/login_instructions_spec.rb +++ b/spec/system/login_instructions_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "login instructions" do +describe "login instructions" do let(:enumerator) { create(:user, role_name: :enumerator, mission: mission) } let(:mission) { get_mission } let(:actor) { create(:admin, mission: mission) } diff --git a/spec/features/mission_and_mode_switching_spec.rb b/spec/system/mission_and_mode_switching_spec.rb similarity index 95% rename from spec/features/mission_and_mode_switching_spec.rb rename to spec/system/mission_and_mode_switching_spec.rb index 0fbc5d1cc3..cbbdb3fd83 100644 --- a/spec/features/mission_and_mode_switching_spec.rb +++ b/spec/system/mission_and_mode_switching_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "switching between missions and modes", js: true do +describe "switching between missions and modes", js: true do let!(:mission1) { create(:mission) } let!(:mission2) { create(:mission) } let!(:user) { create(:user, mission: mission1) } diff --git a/spec/features/offline_mode_spec.rb b/spec/system/offline_mode_spec.rb similarity index 97% rename from spec/features/offline_mode_spec.rb rename to spec/system/offline_mode_spec.rb index 647a5bcb05..2c04b02fd7 100644 --- a/spec/features/offline_mode_spec.rb +++ b/spec/system/offline_mode_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "offline mode" do +describe "offline mode" do let(:user) { create(:admin) } around do |example| diff --git a/spec/features/operations/operations_panel_spec.rb b/spec/system/operations/operations_panel_spec.rb similarity index 98% rename from spec/features/operations/operations_panel_spec.rb rename to spec/system/operations/operations_panel_spec.rb index e068f4da18..de4daf3dc4 100644 --- a/spec/features/operations/operations_panel_spec.rb +++ b/spec/system/operations/operations_panel_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "operations panel" do +describe "operations panel" do let!(:admin) { create(:admin) } let(:mission) { get_mission } let!(:mission_operation) { create(:operation, mission_id: mission.id) } diff --git a/spec/features/option_sets/option_set_import_spec.rb b/spec/system/option_sets/option_set_import_spec.rb similarity index 96% rename from spec/features/option_sets/option_set_import_spec.rb rename to spec/system/option_sets/option_set_import_spec.rb index 603bb4764d..24a5102c90 100644 --- a/spec/features/option_sets/option_set_import_spec.rb +++ b/spec/system/option_sets/option_set_import_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "option set import", js: true do +describe "option set import", js: true do include_context "file import" let(:admin) { create(:admin) } diff --git a/spec/features/questions/question_import_spec.rb b/spec/system/questions/question_import_spec.rb similarity index 96% rename from spec/features/questions/question_import_spec.rb rename to spec/system/questions/question_import_spec.rb index 43cf71e149..5f9e1e7161 100644 --- a/spec/features/questions/question_import_spec.rb +++ b/spec/system/questions/question_import_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "question import", js: true do +describe "question import", js: true do include_context "file import" let(:admin) { create(:admin) } diff --git a/spec/features/remember_context_spec.rb b/spec/system/remember_context_spec.rb similarity index 97% rename from spec/features/remember_context_spec.rb rename to spec/system/remember_context_spec.rb index 948f6efc87..a1a965cf20 100644 --- a/spec/features/remember_context_spec.rb +++ b/spec/system/remember_context_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "remember context", js: true do +describe "remember context", js: true do let!(:user) { create(:user) } let!(:other_user) { create(:user) } let!(:form) { create(:form, :live) } diff --git a/spec/features/reports/report_generation_spec.rb b/spec/system/reports/report_generation_spec.rb similarity index 98% rename from spec/features/reports/report_generation_spec.rb rename to spec/system/reports/report_generation_spec.rb index 4647a72d6d..7d7e85c782 100644 --- a/spec/features/reports/report_generation_spec.rb +++ b/spec/system/reports/report_generation_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "report generation", js: true do +describe "report generation", js: true do let!(:user) { create(:user) } let!(:form) { create(:form, question_types: %w[integer select_one text]) } let!(:response1) { create(:response, form: form, answer_values: %w[1 Cat Foo]) } diff --git a/spec/features/responses/csv_export_spec.rb b/spec/system/responses/csv_export_spec.rb similarity index 99% rename from spec/features/responses/csv_export_spec.rb rename to spec/system/responses/csv_export_spec.rb index d7685abc4f..99ec19e101 100644 --- a/spec/features/responses/csv_export_spec.rb +++ b/spec/system/responses/csv_export_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "responses csv export" do +describe "responses csv export" do include ActiveJob::TestHelper let(:form) { create(:form, :live, question_types: %w[integer multilevel_select_one]) } diff --git a/spec/features/responses/display_logic_spec.rb b/spec/system/responses/display_logic_spec.rb similarity index 99% rename from spec/features/responses/display_logic_spec.rb rename to spec/system/responses/display_logic_spec.rb index 55f82adce7..83a0676af4 100644 --- a/spec/features/responses/display_logic_spec.rb +++ b/spec/system/responses/display_logic_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "response form display logic", js: true do +describe "response form display logic", js: true do include_context "response tree" before { login(create(:user)) } diff --git a/spec/features/responses/enketo_spec.rb b/spec/system/responses/enketo_spec.rb similarity index 99% rename from spec/features/responses/enketo_spec.rb rename to spec/system/responses/enketo_spec.rb index c2c9120e8a..ca62e8c10d 100644 --- a/spec/features/responses/enketo_spec.rb +++ b/spec/system/responses/enketo_spec.rb @@ -11,7 +11,7 @@ # so the nemo codebase cannot be responsible for ensuring that enketo continues functioning as advertised. # These specs should be limited to ensuring that the interaction BETWEEN nemo and enketo continues working. # -feature "enketo form rendering and submission", js: true do +describe "enketo form rendering and submission", js: true do include_context "form design conditional logic for Enketo" include_context "odk submissions" diff --git a/spec/features/responses/file_upload_spec.rb b/spec/system/responses/file_upload_spec.rb similarity index 98% rename from spec/features/responses/file_upload_spec.rb rename to spec/system/responses/file_upload_spec.rb index a2924c12c1..1c633173c3 100644 --- a/spec/features/responses/file_upload_spec.rb +++ b/spec/system/responses/file_upload_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "response form file upload", js: true do +describe "response form file upload", js: true do include_context "response tree" include_context "file import" diff --git a/spec/features/responses/form_rendering_and_submission_spec.rb b/spec/system/responses/form_rendering_and_submission_spec.rb similarity index 98% rename from spec/features/responses/form_rendering_and_submission_spec.rb rename to spec/system/responses/form_rendering_and_submission_spec.rb index 48f1496b00..bf89c8683b 100644 --- a/spec/features/responses/form_rendering_and_submission_spec.rb +++ b/spec/system/responses/form_rendering_and_submission_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "response form rendering and submission", js: true do +describe "response form rendering and submission", js: true do let(:submission_time) { Time.zone.parse("2020-04-20 12:30 UTC") } around do |example| @@ -262,7 +262,7 @@ end end - # Normally we wouldn't feature test something as simple as validation but this form + # Normally we wouldn't describe test something as simple as validation but this form # has a lot going on with e.g. skip logic. context "with required question", flapping: true do before do diff --git a/spec/features/responses/index_spec.rb b/spec/system/responses/index_spec.rb similarity index 99% rename from spec/features/responses/index_spec.rb rename to spec/system/responses/index_spec.rb index 7c851d2170..8830c6e5bb 100644 --- a/spec/features/responses/index_spec.rb +++ b/spec/system/responses/index_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "responses index", js: true do +describe "responses index", js: true do let(:actor) { create(:user) } let(:form) { create(:form, :live, name: "TheForm", question_types: %w[text]) } let(:mission) { get_mission } diff --git a/spec/features/responses/location_picker_spec.rb b/spec/system/responses/location_picker_spec.rb similarity index 96% rename from spec/features/responses/location_picker_spec.rb rename to spec/system/responses/location_picker_spec.rb index 8c147f71e1..f3450e8cb1 100644 --- a/spec/features/responses/location_picker_spec.rb +++ b/spec/system/responses/location_picker_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "response form location picker", js: true do +describe "response form location picker", js: true do include_context "response tree" let(:user) { create(:user) } diff --git a/spec/features/responses/odata_export_spec.rb b/spec/system/responses/odata_export_spec.rb similarity index 92% rename from spec/features/responses/odata_export_spec.rb rename to spec/system/responses/odata_export_spec.rb index bf8b902d20..f1ab29a1f7 100644 --- a/spec/features/responses/odata_export_spec.rb +++ b/spec/system/responses/odata_export_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "responses odata export", js: true do +describe "responses odata export", js: true do let(:user) { create(:user) } let(:params) do { diff --git a/spec/features/responses/read_only_spec.rb b/spec/system/responses/read_only_spec.rb similarity index 98% rename from spec/features/responses/read_only_spec.rb rename to spec/system/responses/read_only_spec.rb index 83fa562d91..bbb27238c6 100644 --- a/spec/features/responses/read_only_spec.rb +++ b/spec/system/responses/read_only_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "response form read only mode", js: true do +describe "response form read only mode", js: true do include_context "response tree" let(:user) { create(:user) } diff --git a/spec/features/responses/reviewer_notes_spec.rb b/spec/system/responses/reviewer_notes_spec.rb similarity index 97% rename from spec/features/responses/reviewer_notes_spec.rb rename to spec/system/responses/reviewer_notes_spec.rb index 9681697969..6416f0b1d6 100644 --- a/spec/features/responses/reviewer_notes_spec.rb +++ b/spec/system/responses/reviewer_notes_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "response form reviewer notes", js: true do +describe "response form reviewer notes", js: true do let(:reviewer) { create(:user) } let(:enumerator) { create(:user, role_name: :enumerator) } let(:form) { create(:form, :live, question_types: %w[integer]) } diff --git a/spec/features/responses/skip_logic_spec.rb b/spec/system/responses/skip_logic_spec.rb similarity index 99% rename from spec/features/responses/skip_logic_spec.rb rename to spec/system/responses/skip_logic_spec.rb index 4b52580e9c..9445b019c2 100644 --- a/spec/features/responses/skip_logic_spec.rb +++ b/spec/system/responses/skip_logic_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "response form skip logic", js: true do +describe "response form skip logic", js: true do include_context "response tree" let(:user) { create(:user) } diff --git a/spec/features/search/question_search_spec.rb b/spec/system/search/question_search_spec.rb similarity index 97% rename from spec/features/search/question_search_spec.rb rename to spec/system/search/question_search_spec.rb index f7ed0e3f56..b024c4353e 100644 --- a/spec/features/search/question_search_spec.rb +++ b/spec/system/search/question_search_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "question search", js: true do +describe "question search", js: true do include_context "search" let!(:mission) { get_mission } diff --git a/spec/features/search/response_search_spec.rb b/spec/system/search/response_search_spec.rb similarity index 99% rename from spec/features/search/response_search_spec.rb rename to spec/system/search/response_search_spec.rb index dcf648f889..5ddda045e7 100644 --- a/spec/features/search/response_search_spec.rb +++ b/spec/system/search/response_search_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "response search", js: true do +describe "response search", js: true do include_context "search" let!(:mission) { get_mission } diff --git a/spec/features/search/sms/message_search_spec.rb b/spec/system/search/sms/message_search_spec.rb similarity index 96% rename from spec/features/search/sms/message_search_spec.rb rename to spec/system/search/sms/message_search_spec.rb index c3e5726f8d..a17a628d36 100644 --- a/spec/features/search/sms/message_search_spec.rb +++ b/spec/system/search/sms/message_search_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "sms message search", js: true do +describe "sms message search", js: true do include_context "search" let!(:mission) { get_mission } diff --git a/spec/features/search/user_search_spec.rb b/spec/system/search/user_search_spec.rb similarity index 97% rename from spec/features/search/user_search_spec.rb rename to spec/system/search/user_search_spec.rb index 3918b35605..ddf2137fe4 100644 --- a/spec/features/search/user_search_spec.rb +++ b/spec/system/search/user_search_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "user search", js: true do +describe "user search", js: true do include_context "search" let!(:mission) { get_mission } diff --git a/spec/features/settings/settings_regenerable_field_spec.rb b/spec/system/settings/settings_regenerable_field_spec.rb similarity index 94% rename from spec/features/settings/settings_regenerable_field_spec.rb rename to spec/system/settings/settings_regenerable_field_spec.rb index ccdc597a18..312525c8d8 100644 --- a/spec/features/settings/settings_regenerable_field_spec.rb +++ b/spec/system/settings/settings_regenerable_field_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "settings regenerable fields", js: true do +describe "settings regenerable fields", js: true do include_context "regenerable fields" let!(:mission) { get_mission } diff --git a/spec/features/settings/sms_settings_form_spec.rb b/spec/system/settings/sms_settings_form_spec.rb similarity index 98% rename from spec/features/settings/sms_settings_form_spec.rb rename to spec/system/settings/sms_settings_form_spec.rb index 392d1cc469..415485f43f 100644 --- a/spec/features/settings/sms_settings_form_spec.rb +++ b/spec/system/settings/sms_settings_form_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "sms settings form", :sms do +describe "sms settings form", :sms do let(:mission) { create(:mission) } let(:user) { create(:user, admin: true) } diff --git a/spec/features/sms/sms_console_spec.rb b/spec/system/sms/sms_console_spec.rb similarity index 94% rename from spec/features/sms/sms_console_spec.rb rename to spec/system/sms/sms_console_spec.rb index 5c1ed6365e..fd8c70c9a3 100644 --- a/spec/features/sms/sms_console_spec.rb +++ b/spec/system/sms/sms_console_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "SMS Console", js: true do +describe "SMS Console", js: true do let!(:user) { create(:user) } let!(:mission_name) { get_mission.compact_name } let(:form) { create(:form, :live, question_types: %w[integer], smsable: true) } diff --git a/spec/features/sms/sms_guide_spec.rb b/spec/system/sms/sms_guide_spec.rb similarity index 99% rename from spec/features/sms/sms_guide_spec.rb rename to spec/system/sms/sms_guide_spec.rb index 34997e8850..6fd89fa438 100644 --- a/spec/features/sms/sms_guide_spec.rb +++ b/spec/system/sms/sms_guide_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "SMS Guide", js: true do +describe "SMS Guide", js: true do let!(:user) { create(:user) } before do diff --git a/spec/features/sms/sms_index_spec.rb b/spec/system/sms/sms_index_spec.rb similarity index 97% rename from spec/features/sms/sms_index_spec.rb rename to spec/system/sms/sms_index_spec.rb index 73ad10bb50..12e3d3d4d5 100644 --- a/spec/features/sms/sms_index_spec.rb +++ b/spec/system/sms/sms_index_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "sms index", js: true do +describe "sms index", js: true do include_context "search" let(:user) { create(:user) } diff --git a/spec/features/translatable_spec.rb b/spec/system/translatable_spec.rb similarity index 97% rename from spec/features/translatable_spec.rb rename to spec/system/translatable_spec.rb index 8f186d5ec6..284c788885 100644 --- a/spec/features/translatable_spec.rb +++ b/spec/system/translatable_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "translatable strings" do +describe "translatable strings" do let(:user) { create(:user, admin: true) } let(:question) { create(:question, name_translations: {en: "FooBar"}) } diff --git a/spec/features/users/login_spec.rb b/spec/system/users/login_spec.rb similarity index 96% rename from spec/features/users/login_spec.rb rename to spec/system/users/login_spec.rb index 915cec9ec1..803d288ee9 100644 --- a/spec/features/users/login_spec.rb +++ b/spec/system/users/login_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "login", js: true do +describe "login", js: true do let(:user) { create(:user) } before do diff --git a/spec/features/users/password_reset_spec.rb b/spec/system/users/password_reset_spec.rb similarity index 99% rename from spec/features/users/password_reset_spec.rb rename to spec/system/users/password_reset_spec.rb index b2a445debb..69764095cf 100644 --- a/spec/features/users/password_reset_spec.rb +++ b/spec/system/users/password_reset_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "password reset" do +describe "password reset" do let(:user) { create(:user) } context "if not logged in" do diff --git a/spec/features/users/user_bulk_destroy_spec.rb b/spec/system/users/user_bulk_destroy_spec.rb similarity index 98% rename from spec/features/users/user_bulk_destroy_spec.rb rename to spec/system/users/user_bulk_destroy_spec.rb index fe320d7ef8..bb37a9e846 100644 --- a/spec/features/users/user_bulk_destroy_spec.rb +++ b/spec/system/users/user_bulk_destroy_spec.rb @@ -3,7 +3,7 @@ require "rails_helper" # This spec covers bulk destroy and select/deselect all logic for all index pages. -feature "user bulk destroy", js: true do +describe "user bulk destroy", js: true do include_context "search" include_context "bulk destroy" let(:admin) { create(:admin, name: "Alpha") } # So that this user comes first in the list. diff --git a/spec/features/users/user_form_password_spec.rb b/spec/system/users/user_form_password_spec.rb similarity index 99% rename from spec/features/users/user_form_password_spec.rb rename to spec/system/users/user_form_password_spec.rb index caacbef39d..b03793069f 100644 --- a/spec/features/users/user_form_password_spec.rb +++ b/spec/system/users/user_form_password_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "user form password field" do +describe "user form password field" do let(:mission) { get_mission } before { login(actor) } diff --git a/spec/features/users/user_form_spec.rb b/spec/system/users/user_form_spec.rb similarity index 98% rename from spec/features/users/user_form_spec.rb rename to spec/system/users/user_form_spec.rb index 064e6dcaeb..3eb9d7a2ee 100644 --- a/spec/features/users/user_form_spec.rb +++ b/spec/system/users/user_form_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "user form", js: true do +describe "user form", js: true do let(:admin) { create(:admin) } let!(:mission) { create(:mission) } diff --git a/spec/features/users/user_import_spec.rb b/spec/system/users/user_import_spec.rb similarity index 94% rename from spec/features/users/user_import_spec.rb rename to spec/system/users/user_import_spec.rb index 94722bfa2b..21d177ad1a 100644 --- a/spec/features/users/user_import_spec.rb +++ b/spec/system/users/user_import_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "user import", js: true do +describe "user import", js: true, flapping: true do include_context "file import" let(:admin) { create(:admin) } diff --git a/spec/features/users/user_index_spec.rb b/spec/system/users/user_index_spec.rb similarity index 98% rename from spec/features/users/user_index_spec.rb rename to spec/system/users/user_index_spec.rb index a8f49ab670..24c0cb4ac9 100644 --- a/spec/features/users/user_index_spec.rb +++ b/spec/system/users/user_index_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "user index", js: true do +describe "user index", js: true do let(:mission) { get_mission } let(:actor) { create(:user, role_name: :coordinator) } let!(:user1) { create(:user, name: "Apple", login: "apple") } diff --git a/spec/features/users/user_regenerable_field_spec.rb b/spec/system/users/user_regenerable_field_spec.rb similarity index 89% rename from spec/features/users/user_regenerable_field_spec.rb rename to spec/system/users/user_regenerable_field_spec.rb index 871669857b..3488975fe0 100644 --- a/spec/features/users/user_regenerable_field_spec.rb +++ b/spec/system/users/user_regenerable_field_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -feature "user regenerable fields", js: true do +describe "user regenerable fields", js: true do include_context "regenerable fields" let!(:user) { create(:user) }