This repository was archived by the owner on May 11, 2021. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue
Data in Trix rich-text fields on debriefs was not getting submitted, causing validation errors that prevented debriefs from being submitted (#204). The root cause of this is an open issue on
trix-rails
.Fix
Addressing this by manually specifying the
input
attribute of the<trix-editor>
tag should have fixed this, but the version oftrix-rails
we were using was out of date. However, upgrading to the latest version (2.2.0, Jul 2018) didn't work either because the fix (Oct 2018) is in the master branch, but not in a release. So I changed our Gemfile to use the master branch. This got manually specifying the input working and fixed the issue.Tests
The issue hadn't been flagged by any of our tests, because our tests do not use a debrief with ratings, and therefore the offending rich-text field is never shown.
I updated our tests to use a
:committed_iteration
factory in debrief test setup rather than a plain iteration. This broke all the other debrief tests which don't fill out the new field, so thesubmit_debrief
method had to be updated for the new default behaviour and split intofill_debrief
andsubmit_debrief
to allow us to make changes to the form contents in specific tests.Because the new field uses a
<trix-editor>
tag, Capybara can't interact with it in the usual way. Since there are two<trix-editor>
tags on the page (one for the rating comments, one for the debrief notes), and they don't have IDs, I usedfirst('trix-editor')
to get the right one.Additionally, there's also a new radio field which means Capybara can't distinguish between the outcome rating radio selection and the milestone completion radio selection. This necessitated switching from
choose 'Yes'
tochoose 'debrief_milestone_completed_true'
, specifying by field ID.This kind of issue should now be picked up by multiple tests as debrief system tests now more closely follow real user behaviour (ie. debriefing iterations that have outcomes).
Conclusion
Make sure your tests reflect real user behaviour and most likely scenarios first and foremost. Having the debrief system test use an iteration without outcomes made writing those initial tests quicker, but allowed us to ship a broken product and cost us time in the long run.
Time to fix error: ~15 mins
Time to get tests working: ~1 hour