Skip to content

[DEV ONLY] Weedy - sprint16 #143810729 ui custom reason waiting#1

Open
patmbolger wants to merge 9 commits intoweedySeaDragon:sprint16-#143810729-UI-custom-reason-waitingfrom
patmbolger:weedy-sprint16-#143810729-UI-custom-reason-waiting
Open

[DEV ONLY] Weedy - sprint16 #143810729 ui custom reason waiting#1
patmbolger wants to merge 9 commits intoweedySeaDragon:sprint16-#143810729-UI-custom-reason-waitingfrom
patmbolger:weedy-sprint16-#143810729-UI-custom-reason-waiting

Conversation

@patmbolger
Copy link
Copy Markdown

This "PR" compares changes in my feature branch against the baseline feature branch from Ashley.

Related to the story in the title.

Changes proposed in this pull request:
1.
2.
3.

Screenshots (Optional):

Ready for review:
@weedySeaDragon

.container
#other-text-field
= label_tag :custom_reason_text, t('membership_applications.need_info.other_reason_label')
= text_field_tag :custom_reason_text, @membership_application.custom_reason_text
Copy link
Copy Markdown
Author

@patmbolger patmbolger Jun 24, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the form as it was not needed and also caused bugs. (in your feature branch, enter a custom reason and hit "enter" key - you will see an error alert - this is because after the AJAX stuff happens, the form is also submitted to the controller action (not what we want).

I added the "custom reason" item to the select_tag collection. I hacked it up here but it should probably be returned from a helper method. (also, note the ugly way that I am finding the current selected value for the select collection. This can be removed when we refactor the custom reason into the AdminOnly::MemberAppWaitingReason model).

I also added the currently-selected option to the options collection.

I refactored the "onchange" stuff to the DOM-ready function.

I also simplified the ID for the select list and the text_field. (this make for easier read of the code, IMO)

:javascript

let reasons_list = document.getElementById('membership_application_member_app_waiting_reasons_id'); // the select HTML element (list)
let reasons_list = $('#member_app_waiting_reasons'); // the select HTML element (list)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're using both straight JSAPI as well as Jquery - thought it best to just use Jquery throughput.


function selected_is_customOtherReason() {
return reasons_list.value === other_reason_option.value;
return $('#member_app_waiting_reasons option:selected').text() === other_reason_option.text;
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your statement did not work for me - it could be because I converted to query(?).


let initialize = (function() {
reasons_list.options.add(other_reason_option); // add the other_reason to the list
// reasons_list.options.add(other_reason_option); // add the other_reason to the list
Copy link
Copy Markdown
Author

@patmbolger patmbolger Jun 24, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed since I added the option directly to the options passed to select_tag.

Also, this statement was causing a test failure when I used poltergeist as the web driver. I then tried using Selenium and it worked. I have seen poltergeist have trouble with some JS code before, and Selenium generally does a better job with tricky JS.

// reasons_list.options.add(other_reason_option); // add the other_reason to the list
hideOrShowCustomReasonElements();
$('#member_app_waiting_reasons').on('change', changed_reason);
$('#custom_reason_text').on('change', changed_custom_text)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here are the refactored 'onchange' triggers.

Comment thread db/schema.rb
create_table "users", id: :bigserial, force: :cascade do |t|
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
t.string "reset_password_token"
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how these differences occurred (did not change any migration file). Hopefully they are innocuous ...


# it is important that this statement is first so that tables are empty, so that things will be seeded
Given the system is seeded with initial data
# Given the system is seeded with initial data
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we now add the "custom reason" selection directly (no longer from the DB) this background step is not needed.



@admin
@admin @javascript
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't see how the tag @admin also pulled in poltergeist, so added that explicitly.

Comment thread features/support/hooks.rb Outdated
Before('@selenium') do
# For JS-driven tests that Poltergeist does not handle cleanly.
Capybara.javascript_driver = :selenium
end
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a hold-over from when I was testing with Selenium. We don't need this change.

@patmbolger
Copy link
Copy Markdown
Author

@weedySeaDragon - see comments in code tab.

I still have 4 failures occurring in

cucumber features/membership-application-status/

Those all come from admin-sets-custom-waiting-reason.feature:

screen shot 2017-06-24 at 1 53 40 pm

@patmbolger
Copy link
Copy Markdown
Author

I just fixed one of those failing tests. Now we have:

screen shot 2017-06-24 at 2 04 04 pm

@patmbolger
Copy link
Copy Markdown
Author

I think one or two of the failures could be due to this kind of step:

And I should not see t("admin_only.member_app_waiting_reasons.other_custom_reason")

The step method for this is:

And(/^I should not see "([^"]*)"$/) do |content|
  expect(page).not_to have_content content
end

I think that this step will fail because even though the content may not be visible, it is still on the page. We need a step that checks for visibility.

Copy link
Copy Markdown
Author

@patmbolger patmbolger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All tests now pass.

Comment thread Gemfile Outdated

group :test do
gem 'poltergeist'
gem 'selenium-webdriver'
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had 4 remaining failing cuke tests that will (so far) only run successfully when using Selenium.

Comment thread Gemfile.lock Outdated
rubyzip (>= 1.2.1)
sanitize
sass-rails (~> 5.0)
selenium-webdriver
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need this gem for Selenium driver.

@patmbolger patmbolger force-pushed the weedy-sprint16-#143810729-UI-custom-reason-waiting branch from ecc7b69 to 31a1bdb Compare June 27, 2017 11:52
weedySeaDragon added a commit that referenced this pull request Jun 2, 2022
* Bump rack from 2.2.3 to 2.2.3.1

Bumps [rack](https://github.com/rack/rack) from 2.2.3 to 2.2.3.1.
- [Release notes](https://github.com/rack/rack/releases)
- [Changelog](https://github.com/rack/rack/blob/main/CHANGELOG.md)
- [Commits](rack/rack@2.2.3...2.2.3.1)

---
updated-dependencies:
- dependency-name: rack
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* semaphore: install missing libpng12-0 library (try #1)

* use wget to install libpng-12 manually

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ashley Engelund (weedySeaDragon @ github) <ashley@ashleycaroline.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant