Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
Refs: #2872
  • Loading branch information
shaun-technovation committed Jul 30, 2021
1 parent ba348c9 commit be468b7
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 75 deletions.
4 changes: 1 addition & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ gem "counter_culture", "~> 1.12"

gem "autoprefixer-rails", "~> 6.7"
gem "uglifier", "~> 3.2"
gem "coffee-rails", "~> 4.2"

gem "turbolinks", "~> 5.2"
gem "jquery-rails", "~> 4.3"
Expand Down Expand Up @@ -118,8 +117,7 @@ group :test do
gem "capybara", "~> 3.31"
gem "capybara-email", "~> 3.0.2"
gem "webdrivers"
gem 'rspec-rails', '~> 5.0.0'
gem 'selenium-webdriver'
gem "rspec-rails", "~> 4.0"

gem "pdf-reader", "~> 2.4"

Expand Down
24 changes: 10 additions & 14 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,6 @@ GEM
httparty
rails (>= 5.0, < 6.1.0)
cocoon (1.2.15)
coffee-rails (4.2.2)
coffee-script (>= 2.2.0)
railties (>= 4.0.0)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.12.2)
concurrent-ruby (1.1.9)
connection_pool (2.2.5)
counter_culture (1.12.0)
Expand Down Expand Up @@ -301,6 +294,7 @@ GEM
mime-types-data (3.2021.0704)
mini_magick (4.9.4)
mini_mime (1.1.0)
mini_portile2 (2.5.3)
minitest (5.14.4)
msgpack (1.4.2)
multi_json (1.15.0)
Expand All @@ -311,6 +305,9 @@ GEM
netrc (0.11.0)
newrelic_rpm (7.1.0)
nio4r (2.5.7)
nokogiri (1.11.7)
mini_portile2 (~> 2.5.0)
racc (~> 1.4)
nokogiri (1.11.7-x86_64-linux)
racc (~> 1.4)
normalize-rails (4.1.1)
Expand Down Expand Up @@ -413,10 +410,10 @@ GEM
rspec-mocks (3.10.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-rails (5.0.1)
actionpack (>= 5.2)
activesupport (>= 5.2)
railties (>= 5.2)
rspec-rails (4.1.2)
actionpack (>= 4.2)
activesupport (>= 4.2)
railties (>= 4.2)
rspec-core (~> 3.10)
rspec-expectations (~> 3.10)
rspec-mocks (~> 3.10)
Expand Down Expand Up @@ -540,6 +537,7 @@ GEM
zeitwerk (2.4.2)

PLATFORMS
ruby
x86_64-linux-musl

DEPENDENCIES
Expand All @@ -563,7 +561,6 @@ DEPENDENCIES
clipboard-rails (~> 1.7)
cloudflare-rails (~> 0.6)
cocoon (~> 1.2)
coffee-rails (~> 4.2)
counter_culture (~> 1.12)
countries (~> 1.2)
country_state_select (~> 3.0)
Expand Down Expand Up @@ -611,10 +608,9 @@ DEPENDENCIES
rails-controller-testing (~> 1.0)
rails-i18n (~> 6.0.0)
rails_autoscale_agent
rspec-rails (~> 5.0.0)
rspec-rails (~> 4.0)
sass-rails (~> 5.0)
scout_apm (~> 2.4)
selenium-webdriver
sidekiq (~> 4.2)
simple_form (~> 5.0)
sinatra (~> 2.0)
Expand Down
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ jobs:

- run:
name: Run RSpec tests
command: bundle exec rspec --order rand
command: bundle exec rspec

- store_artifacts:
path: tmp/screenshots
Expand Down
6 changes: 3 additions & 3 deletions spec/controllers/admin/scores_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
admin = FactoryBot.create(:admin)
sign_in(admin)

get :index, params: { "scored_submissions_grid": { "round": "" } }
get :index, params: {scored_submissions_grid: {round: ""}}

expect(assigns[:round]).to eq("quarterfinals")
end
Expand All @@ -26,9 +26,9 @@
admin = FactoryBot.create(:admin)
sign_in(admin)

get :index, params: { "scored_submissions_grid": { "round": "semifinals" } }
get :index, params: {scored_submissions_grid: {round: "semifinals"}}

expect(assigns[:round]).to eq("semifinals")
end
end
end
end
70 changes: 36 additions & 34 deletions spec/features/admin/content_and_settings_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

before do
sign_in(admin)
expect(page).to have_content("Welcome back!")

visit edit_admin_season_schedule_settings_path
end

Expand All @@ -15,15 +17,15 @@
click_button "Review"
click_button "Save these settings"

expect(SeasonToggles.student_signup?).to be false
expect(SeasonToggles.mentor_signup?).to be false
expect(SeasonToggles.student_signup?).to eq(false)
expect(SeasonToggles.mentor_signup?).to eq(false)

expect(SeasonToggles.team_building_enabled?).to be false
expect(SeasonToggles.team_submissions_editable?).to be false
expect(SeasonToggles.team_building_enabled?).to eq(false)
expect(SeasonToggles.team_submissions_editable?).to eq(false)

expect(SeasonToggles.select_regional_pitch_event?).to be false
expect(SeasonToggles.select_regional_pitch_event?).to eq(false)

expect(SeasonToggles.display_scores?).to be false
expect(SeasonToggles.display_scores?).to eq(false)
end

scenario "Checking all boxes" do
Expand All @@ -32,15 +34,15 @@
click_button "Review"
click_button "Save these settings"

expect(SeasonToggles.student_signup?).to be true
expect(SeasonToggles.mentor_signup?).to be true
expect(SeasonToggles.student_signup?).to eq(true)
expect(SeasonToggles.mentor_signup?).to eq(true)

expect(SeasonToggles.team_building_enabled?).to be true
expect(SeasonToggles.team_submissions_editable?).to be true
expect(SeasonToggles.team_building_enabled?).to eq(true)
expect(SeasonToggles.team_submissions_editable?).to eq(true)

expect(SeasonToggles.select_regional_pitch_event?).to be true
expect(SeasonToggles.select_regional_pitch_event?).to eq(true)

expect(SeasonToggles.display_scores?).to be true
expect(SeasonToggles.display_scores?).to eq(true)
end
end

Expand All @@ -55,10 +57,10 @@
click_button "Review"
click_button "Save these settings"

expect(SeasonToggles.dashboard_text(:student)).to be_empty
expect(SeasonToggles.dashboard_text(:mentor)).to be_empty
expect(SeasonToggles.dashboard_text(:judge)).to be_empty
expect(SeasonToggles.dashboard_text(:chapter_ambassador)).to be_empty
expect(SeasonToggles.dashboard_text(:student)).to eq("null")
expect(SeasonToggles.dashboard_text(:mentor)).to eq("null")
expect(SeasonToggles.dashboard_text(:judge)).to eq("null")
expect(SeasonToggles.dashboard_text(:chapter_ambassador)).to eq("null")
end

scenario "Setting notices" do
Expand Down Expand Up @@ -92,13 +94,13 @@
click_button "Review"
click_button "Save these settings"

expect(SeasonToggles.survey_link(:student, :text)).to be_empty
expect(SeasonToggles.survey_link(:student, :url)).to be_empty
expect(SeasonToggles.survey_link(:student, :long_desc)).to be_empty
expect(SeasonToggles.survey_link(:student, :text)).to eq("null")
expect(SeasonToggles.survey_link(:student, :url)).to eq("null")
expect(SeasonToggles.survey_link(:student, :long_desc)).to eq("null")

expect(SeasonToggles.survey_link(:mentor, :text)).to be_empty
expect(SeasonToggles.survey_link(:mentor, :url)).to be_empty
expect(SeasonToggles.survey_link(:mentor, :long_desc)).to be_empty
expect(SeasonToggles.survey_link(:mentor, :text)).to eq("null")
expect(SeasonToggles.survey_link(:mentor, :url)).to eq("null")
expect(SeasonToggles.survey_link(:mentor, :long_desc)).to eq("null")
end

scenario "Setting survey fields" do
Expand Down Expand Up @@ -187,12 +189,12 @@
click_button "Review"
click_button "Save these settings"

expect(SeasonToggles.student_signup?).to be false
expect(SeasonToggles.mentor_signup?).to be false
expect(SeasonToggles.team_building_enabled?).to be false
expect(SeasonToggles.team_submissions_editable?).to be false
expect(SeasonToggles.select_regional_pitch_event?).to be false
expect(SeasonToggles.display_scores?).to be false
expect(SeasonToggles.student_signup?).to eq(false)
expect(SeasonToggles.mentor_signup?).to eq(false)
expect(SeasonToggles.team_building_enabled?).to eq(false)
expect(SeasonToggles.team_submissions_editable?).to eq(false)
expect(SeasonToggles.select_regional_pitch_event?).to eq(false)
expect(SeasonToggles.display_scores?).to eq(false)
end

scenario "Setting #{round.downcase} shows constraint alerts" do
Expand Down Expand Up @@ -248,12 +250,12 @@
click_button "Review"
click_button "Save these settings"

expect(SeasonToggles.student_signup?).to be true
expect(SeasonToggles.mentor_signup?).to be true
expect(SeasonToggles.team_building_enabled?).to be true
expect(SeasonToggles.team_submissions_editable?).to be true
expect(SeasonToggles.select_regional_pitch_event?).to be true
expect(SeasonToggles.display_scores?).to be true
expect(SeasonToggles.student_signup?).to eq(true)
expect(SeasonToggles.mentor_signup?).to eq(true)
expect(SeasonToggles.team_building_enabled?).to eq(true)
expect(SeasonToggles.team_submissions_editable?).to eq(true)
expect(SeasonToggles.select_regional_pitch_event?).to eq(true)
expect(SeasonToggles.display_scores?).to eq(true)
end

scenario "Setting #{round.downcase} hides constraint alerts" do
Expand Down
6 changes: 3 additions & 3 deletions spec/features/judge/scoring_submissions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

scenario "when a junior team receives a perfect score" do
given_there_is_a_submission_from_a_junior_team_that_needs_scoring
and_a_user_is_logged_in_as_a_judge
and_a_judge_is_logged_in

when_the_judge_starts_a_new_scoring_session
and_scores_the_ideation_section_perfectly
Expand All @@ -25,7 +25,7 @@

scenario "when a senior team receives a perfect score" do
given_there_is_a_submission_from_a_senior_team_that_needs_scoring
and_a_user_is_logged_in_as_a_judge
and_a_judge_is_logged_in

when_the_judge_starts_a_new_scoring_session
and_scores_the_ideation_section_perfectly
Expand All @@ -47,7 +47,7 @@ def given_there_is_a_submission_from_a_senior_team_that_needs_scoring
FactoryBot.create(:team_submission, :senior, :complete)
end

def and_a_user_is_logged_in_as_a_judge
def and_a_judge_is_logged_in
judge = FactoryBot.create(:judge, :onboarded)
sign_in(judge)
end
Expand Down
17 changes: 6 additions & 11 deletions spec/features/mentor/searchability_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,13 @@

expect(mentor.reload).to be_searchable
end
# US_mentor_signs_consent_passes_bg_check
scenario "US mentor signs consent, passes bg check", :vcr do

xscenario "US mentor signs consent, passes bg check", :vcr do
mentor = FactoryBot.create(
:mentor,
country: "US",
not_onboarded: true
)
mentor.account.email = "test001.asnet@gmail.com"
mentor.save!

expect(mentor).not_to be_searchable

Expand All @@ -55,26 +53,23 @@
click_link "Check Submission Status"
expect(page).to have_content("status is: clear")
expect(mentor.reload).to be_searchable

end
# US_mentor_passes_bg_check_signs_consent
scenario "US mentor passes bg check, signs consent", :vcr do

xscenario "US mentor passes bg check, signs consent", :vcr do
mentor = FactoryBot.create(:mentor, country: "US", not_onboarded: true)
mentor.account.email = "test002.asnet@gmail.com"
mentor.save!
expect(mentor).not_to be_searchable

sign_in(mentor)
visit mentor_dashboard_path
visit mentor_training_completion_path

click_link "Submit Background Check"

fill_in "Zipcode", with: 60622
fill_in "Ssn", with: "111-11-2001"
fill_in "Driver license state", with: "CA"
click_button "Submit"

click_link "Check Submission Status"

expect(page).to have_content("status is: clear")
expect(mentor.reload).not_to be_searchable

Expand Down
4 changes: 2 additions & 2 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

Capybara.automatic_label_click = true
Capybara.default_max_wait_time = 10
Capybara.javascript_driver = ENV.fetch("JAVASCRIPT_DRIVER", "selenium_chrome_headless").to_sym
Capybara.javascript_driver = ENV.fetch("JAVASCRIPT_DRIVER", "selenium_headless").to_sym
Capybara.server_port = ENV.fetch("CAPYBARA_SERVER_PORT", 31337)

require 'rake'
Expand Down Expand Up @@ -77,7 +77,7 @@
end

config.before(:each, type: :system, js: true) do
driven_by ENV.fetch("JAVASCRIPT_DRIVER", "selenium_chrome_headless").to_sym
driven_by ENV.fetch("JAVASCRIPT_DRIVER", "selenium_headless").to_sym
end

config.before(:each, js: true) do
Expand Down
7 changes: 3 additions & 4 deletions spec/vcr_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@
config.cassette_library_dir = "spec/cassettes"
config.hook_into :webmock # or :fakeweb
config.configure_rspec_metadata!
config.ignore_localhost = true
config.allow_http_connections_when_no_cassette = true
config.ignore_request do |request|
uri = URI(request.uri)
LOCALHOSTS.include?(uri.host) and uri.port != 9200
end
config.ignore_hosts(
'chromedriver.storage.googleapis.com',
'github.com'
"chromedriver.storage.googleapis.com",
"github.com",
"githubusercontent.com"
)

end

0 comments on commit be468b7

Please sign in to comment.