Skip to content

Commit

Permalink
fixed remaining cuke tests
Browse files Browse the repository at this point in the history
  • Loading branch information
patmbolger committed Jun 25, 2017
1 parent 2bf19ed commit 560b1ca
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 8 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,5 @@ end

group :test do
gem 'poltergeist'
gem 'selenium-webdriver'
end
6 changes: 6 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ GEM
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
childprocess (0.7.0)
ffi (~> 1.0, >= 1.0.11)
chronic (0.10.2)
city-state (0.0.13)
rubyzip (~> 1.1)
Expand Down Expand Up @@ -364,6 +366,9 @@ GEM
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
selenium-webdriver (3.4.3)
childprocess (~> 0.5)
rubyzip (~> 1.0)
sexp_processor (4.8.0)
shoulda-matchers (3.1.1)
activesupport (>= 4.0.0)
Expand Down Expand Up @@ -485,6 +490,7 @@ DEPENDENCIES
rubyzip (>= 1.2.1)
sanitize
sass-rails (~> 5.0)
selenium-webdriver
shoulda-matchers
smarter_csv
spring
Expand Down
3 changes: 2 additions & 1 deletion app/views/membership_applications/_reason_waiting.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
= label_tag :member_app_waiting_reasons, t('membership_applications.need_info.reason_title')
- collection = AdminOnly::MemberAppWaitingReason.all.to_a
- collection << AdminOnly::MemberAppWaitingReason.new(id: -1, "name_#{I18n.locale.to_s}": "#{@other_waiting_reason_text}")
- selected = ! @membership_application.custom_reason_text.blank? ? -1 : @membership_application.member_app_waiting_reasons_id
= select_tag(:member_app_waiting_reasons,
options_from_collection_for_select(collection, :id, reason_name_method,
@membership_application.member_app_waiting_reasons_id),
selected),
{ include_blank: t('membership_applications.need_info.select_a_reason'),
class: 'reason-waiting-list' })

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,30 +42,29 @@ Feature: Admin sets or enters the reason they are waiting for info from a user
And I am logged in as "[email protected]"


@javascript
@selenium
Scenario: Admin selects 'need more documentation' as the reason SHF is waiting_for_applicant
Given I am on "AnnaWaiting" application page
When I set "member_app_waiting_reasons" to "need doc"
And I am on the list applications page
And I am on "AnnaWaiting" application page
Then "member_app_waiting_reasons" should have "need doc" selected
And I should not see t("admin_only.member_app_waiting_reasons.other_custom_reason")

@javascript
@selenium
Scenario: Admin selects 'waiting for payment' as the reason SHF is waiting_for_applicant
Given I am on "AnnaWaiting" application page
When I set "member_app_waiting_reasons" to "waiting for payment"
And I am on the list applications page
And I am on "AnnaWaiting" application page
And "member_app_waiting_reasons" should have "waiting for payment" selected
And I should not see t("admin_only.member_app_waiting_reasons.other_custom_reason")


@javascript
@selenium
Scenario: Admin selects 'other' and enters text as the reason SHF is waiting_for_applicant
Given I am on "AnnaWaiting" application page
When I set "member_app_waiting_reasons" to t("admin_only.member_app_waiting_reasons.other_custom_reason")
And I fill in "custom_reason_text" with "This is my reason"
And I press enter in "custom_reason_text"
And I am on the list applications page
And I am on "AnnaWaiting" application page
#And item t("admin_only.member_app_waiting_reasons.other_custom_reason") should be visible
Expand All @@ -74,23 +73,24 @@ Feature: Admin sets or enters the reason they are waiting for info from a user
And "member_app_waiting_reasons" should have t("admin_only.member_app_waiting_reasons.other_custom_reason") selected


@javascript
@selenium
Scenario: Admin selects 'other' and fills in custom text but then changes reason to something else
Given I am on "AnnaWaiting" application page
When I set "member_app_waiting_reasons" to t("admin_only.member_app_waiting_reasons.other_custom_reason")
And I fill in "custom_reason_text" with "This is my reason"
And I press enter in "custom_reason_text"
And I set "member_app_waiting_reasons" to "waiting for payment"
And I am on the list applications page
And I am on "AnnaWaiting" application page
And "member_app_waiting_reasons" should have "waiting for payment" selected
And I should not see t("admin_only.member_app_waiting_reasons.other_custom_reason")


@javascript
Scenario: When selected reason is not 'custom other,' the custom text is saved as blank (empty string)
Given I am on "AnnaWaiting" application page
When I set "member_app_waiting_reasons" to t("admin_only.member_app_waiting_reasons.other_custom_reason")
And I fill in "custom_reason_text" with "This is my reason"
And I press enter in "custom_reason_text"
And I set "member_app_waiting_reasons" to "need doc"
# change back so the custom reason field shows. it should be blank
And I set "member_app_waiting_reasons" to t("admin_only.member_app_waiting_reasons.other_custom_reason")
Expand Down
4 changes: 4 additions & 0 deletions features/step_definitions/basic_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
fill_in field, with: value
end

And(/^I press enter in "([^"]*)"$/) do |field|
find_field(field).send_keys :enter
end

And(/^I fill in t\("([^"]*)"\) with "([^"]*)"$/) do |field, value|
fill_in i18n_content(field), with: value
end
Expand Down

0 comments on commit 560b1ca

Please sign in to comment.