# this is the first file required by both RSpec's spec_helper and Cucumber's env
require "bundler"

# require all bundled gems
Bundler.require :default

# patch string with color methods
require "rainbow/ext/string"

# include monkeypatches from activesupport. add more libraries explicitly if
# need be. don't just require the entire activesupport library. its huge.
require "active_support/core_ext/hash/deep_merge"
require "active_support/core_ext/hash/keys"

# load .env
require_relative "env_files"
Support::EnvFiles.load_env_file
Support::EnvFiles.load_s3_env_file

# load profile (similar to .env)
require_relative "paths"
require_rel "profiles"
PROFILE = Support::Profiles::Cucumber.new(ENV["CUCUMBER_PROFILE"])
DOMAINS = Support::Profiles::Domain.new(ENV["DOMAIN_PROFILE"]).domains

require_rel "."
Support::DbClient::CREDENTIALS = PROFILE.database

# TODO: move to base support folder
require_rel "../features/support/monkey_patches"
MonkeyPatches.include_patches

Support::EntryPoint.new.setup_single_workspace unless ENV["PRESERVE_WORKSPACE"]

# require files used by world (using require_rel from require_all gem)
require_all File.join(Support::Paths.cucumber_root, "page_objects")
require_rel "../features/support/data_helpers"

# requires for Step Definitions
require "csv" # parse comma-separated txt files for HFA scenarios
require "addressable/uri" # used by analytics
