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
RSpec to replicate duplicate JudgeAssignTasks problem #16382
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
71 changes: 71 additions & 0 deletions
71
spec/fixes/investigate_duplicate_judge_assign_task_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# frozen_string_literal: true | ||
|
||
require "helpers/sanitized_json_configuration.rb" | ||
require "helpers/sanitized_json_importer.rb" | ||
|
||
# required to load `explain` endpoint in an RSpec | ||
require "helpers/sanitized_json_exporter.rb" | ||
require "helpers/intake_renderer.rb" | ||
|
||
feature "duplicate JudgeAssignTask investigation" do | ||
before do | ||
User.authenticate!(css_id: "PETERSBVAM") | ||
Functions.grant!("System Admin", users: ["PETERSBVAM"]) # enable access to `export` endpoint | ||
end | ||
|
||
# Ticket: https://github.com/department-of-veterans-affairs/dsva-vacols/issues/174 | ||
# Target state: should only have 1 open JudgeAssignTask | ||
describe "Judge cancels AttorneyTask in 2 browser windows" do | ||
let!(:appeal) do | ||
sji = SanitizedJsonImporter.from_file("spec/records/appeal-121304-dup_jatasks.json", verbosity: 0) | ||
sji.import | ||
appeal = sji.imported_records[Appeal.table_name].first | ||
|
||
judge = User.find_by_css_id("PETERSBVAM") | ||
create(:staff, :judge_role, user: judge) | ||
|
||
appeal.reload | ||
end | ||
|
||
scenario "Caseflow creates 2 open JudgeAssignTasks" do | ||
within_window open_new_window do | ||
# Get a narrative of what happened; search for ":50:38" and ":50:44" | ||
visit "/explain/appeals/#{appeal.uuid}" | ||
expect(page).to have_content("Narrative table") | ||
end | ||
|
||
# Delete tasks created on or after 2021-06-13 so we can recreate the problem | ||
appeal.tasks.where("created_at >= ?", "2021-06-13").delete_all | ||
# Set task status so that user as task actions | ||
Task.find(2_001_437_274).assigned! | ||
Task.find(2_001_437_273).on_hold! | ||
|
||
# In first window | ||
visit "/queue/appeals/#{appeal.uuid}" | ||
|
||
# Open another window to the same page | ||
second_window = open_new_window | ||
within_window second_window do | ||
visit "/queue/appeals/#{appeal.uuid}" | ||
end | ||
|
||
# Back in first window | ||
click_dropdown(prompt: "Select an action", text: "Cancel task and return to judge") | ||
fill_in(COPY::ADD_COLOCATED_TASK_INSTRUCTIONS_LABEL, with: "cancel once") | ||
click_on "Submit" | ||
expect(page).to have_content("case has been cancelled") | ||
|
||
# Repeat same actions in second_window | ||
within_window second_window do | ||
click_dropdown(prompt: "Select an action", text: "Cancel task and return to judge") | ||
fill_in(COPY::ADD_COLOCATED_TASK_INSTRUCTIONS_LABEL, with: "cancel once") | ||
click_on "Submit" | ||
expect(page).to have_content("case has been cancelled") | ||
end | ||
|
||
# Notice there are 2 open JudgeAssignTasks | ||
appeal.reload.treee | ||
# binding.pry # Uncomment to examine the browser tabs | ||
end | ||
end | ||
end |
Oops, something went wrong.
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.
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.
Is it standard to link to tickets in comments? Part of me wonders if this could bloat the codebase over time.
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.
Not sure what you mean by bloat. The URL should always work. I like to include links to cross-references. In this case, the ticket provide more context in understanding the purpose of the RSpec and there may be updates to that ticket that aren't captured in this RSpec.
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.
Okay, fine by me.