-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create and serve paper petition fix #5791
Create and serve paper petition fix #5791
Conversation
bug: Only intercpet requests to our own API. Do not intercept other requests.
…s in cypress helper
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question for more context: are we certain that the order of orders (heh) doesn't matter? In other words, is the test wrongly expecting a particular order, which means we have a flaky test; or is the test correctly expecting a particular order, which means our application is not enforcing it properly? It seems like the former. If so, I'm happy to approve.
It's a good question. Our assumption based on sleuthing through the code is that the only expected ordering is based on the draft DocketEntry's Assuming our initial assumption is correct, the next question is whether or not we're missing a secondary sort. It seemed reasonable to think that the answer to the is probably "no", given any case in which we've got enough drafts created on the same day that this applies there's still relatively few of them, and never so many they fall off the page or have the experience otherwise improved (at least not more than marginally so) by a secondary sort. I recognize this is quite a roll of assumptions -- maybe it's worth having a quick chat with Tenille and/or Chris to get their take. |
This is well put--we should walk through this PR in stand-up this morning, time permitting. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for asking about this in stand-up!
Overview
This PR addresses an issue with the
create-and-serve-paper-petition
Cypress helper. As shown in the code below, the helper previously expected that four draft docket entries be rendered in the exact same order every time the helper runs:However, there is no guarantee that these docket entries will appear in the UI in this exact order.
Issue in a Nutshell
When this Cypress helper creates a case and serves it to the IRS, the
serveCaseToIrsInteractor
interactor may include one or more calls toaddDocketEntryForSystemGeneratedOrder
wrapped in aPromise.all
. A new Docket Entry is instantiated for each system generated order that needs to be created. Since these were all created on the same date, thereceivedAt
property will be identical for eachDocketEntry
entity, since the output ofcreateISODateAtStartOfDayEST
when called without an argument is the same for any givenDocketEntry
instantiated on the same day. So, they are sorted on a property that is identical across the board. In edge cases, it appears that these draft docket entries are created in a different sequence than the one expected, likely because the concurrent execution ofPromise.all
can lead to non-deterministic completion orderFix
Instead of expecting these draft docket entries to appear in the same order every time, this PR changes the helper such that it still asserts all four draft docket entries are visible in the UI, but without being tied to a particular order.
Here are screenshots of the UI from the same test suite run with the fix in place:
Breadcrumbs
We see that
formattedDocketEntries.formattedDraftDocuments
is sorted byreceivedAt
.Working backward: how was the case served?