From c741cc43e70c29a88f8905c2a16fab69f86a7d2b Mon Sep 17 00:00:00 2001 From: Prajwal Amatya <122557351+pamatyatake2@users.noreply.github.com> Date: Mon, 21 Aug 2023 09:00:33 -0600 Subject: [PATCH 1/3] Pamatya/APPEALS-24131: Fix flaky/skipped tests in models/idt/token_spec.rb (#19208) * removing the xit and adding new test * Added a test for an expired key for the Idt::Token active method * APPEALS-24131: removed unused let statement * Removed the sleep statement from the test. * Included a docket_spec test fix as well. --------- Co-authored-by: = --- spec/models/docket_spec.rb | 3 +-- spec/models/idt/token_spec.rb | 8 +++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/spec/models/docket_spec.rb b/spec/models/docket_spec.rb index 78e6734650b..fe65466a522 100644 --- a/spec/models/docket_spec.rb +++ b/spec/models/docket_spec.rb @@ -553,12 +553,11 @@ end it "sets the case ids when a redistribution occurs" do - distributed_case.id ymd = Time.zone.today.strftime("%F") result = subject expect(DistributedCase.find(distributed_case.id).case_id).to eq("#{distributed_appeal.uuid}-redistributed-#{ymd}") - expect(result[0].case_id).to eq(distributed_appeal.uuid) + expect(result.any? { |item| item.case_id == distributed_appeal.uuid }).to be_truthy end end diff --git a/spec/models/idt/token_spec.rb b/spec/models/idt/token_spec.rb index 90a17bf2c1b..6401aecfa79 100644 --- a/spec/models/idt/token_spec.rb +++ b/spec/models/idt/token_spec.rb @@ -7,6 +7,7 @@ let(:css_id) { "TEST_ID" } let(:key_token_pair) { Idt::Token.generate_one_time_key_and_proposed_token } + # rubocop:disable Metrics/LineLength let(:invalid_token) { "9373a256a2ac3c3bd320adeeb8a1e4d996ef064d1332357954410f25740bf0c17b6565e152760c461a85587e6a6845457f955ccfa20a8e462a77b776eb10b72c" } # rubocop:enable Metrics/LineLength @@ -50,7 +51,12 @@ expect(Idt::Token.active?(invalid_token)).to eq(false) end - xit "returns false after a token expires" do + it "returns false after a token expires" do + key, token = key_token_pair + Idt::Token.activate_proposed_token(key, css_id) + expect(Idt::Token.active?(token)).to eq(true) + Idt::Token.client.expire("valid_tokens_key" + token, -1) + expect(Idt::Token.active?(token)).to eq(false) end end end From 96cc94ecfa86f9aa8172ef0d8cb847beeb4d8170 Mon Sep 17 00:00:00 2001 From: Brandon Lee Dorner Date: Mon, 21 Aug 2023 10:34:09 -0500 Subject: [PATCH 2/3] Remove skipped and unneeded feature test (#19214) This will be explained more in the accompanying PR but this test has been skipped for a couple years and does not need to be in the code base anymore as it does not add any value. --- .../substitute_appellant_task_copy_spec.rb | 149 ------------------ 1 file changed, 149 deletions(-) delete mode 100644 spec/feature/queue/substitute_appellant/substitute_appellant_task_copy_spec.rb diff --git a/spec/feature/queue/substitute_appellant/substitute_appellant_task_copy_spec.rb b/spec/feature/queue/substitute_appellant/substitute_appellant_task_copy_spec.rb deleted file mode 100644 index 30b7536c417..00000000000 --- a/spec/feature/queue/substitute_appellant/substitute_appellant_task_copy_spec.rb +++ /dev/null @@ -1,149 +0,0 @@ -# frozen_string_literal: true - -def wait_for_page_render - # This find forces a wait for the page to render. Without it, a test asserting presence or absence of content - # may pass whether the content is present or not! - find("div", id: "caseTitleDetailsSubheader") -end - -def select_task_ids_in_ui(task_ids) - visit "/queue" - visit "/queue/appeals/#{appeal.uuid}" - wait_for_page_render - - click_on "+ Add Substitute" - - fill_in("substitutionDate", with: Time.zone.parse("2021-01-01")) - find("label", text: "Bob Vance, Spouse").click - click_on "Continue" - - # Uncomment this if you wish to use demo specific selections in the browser - # binding.pry - # appeal.treee - - task_ids.each do |task_id| - find("div", class: "checkbox-wrapper-taskIds[#{task_id}]").find("label").click - end - click_on "Continue" - click_on "Confirm" - wait_for_page_render -end - -# Since the appeal is imported from JSON, the IDs here are always the below values. -# Give them friendly names for easier access -TASKS = { - distribution: 2_000_758_353, - schedule_hearing: 2_000_758_355, - assign_hearing_disposition: 2_001_178_199, - address_verify: 2_001_143_838, - transcription: 2_001_233_993, - evidence_submission_window: 2_001_233_994, - evidence_or_argument_mail: 2_001_578_851 -}.freeze - -note = "This test is only used to aid manual testing/demonstration." -RSpec.feature "CASEFLOW-1501 Substitute appellant behavior", :postgres, skip: note do - describe "Substitute Appellant appeal creation" do - before do - cob_user = create(:user, css_id: "COB_USER", station_id: "101") - ClerkOfTheBoard.singleton.add_user(cob_user) - OrganizationsUser.make_user_admin(cob_user, ClerkOfTheBoard.singleton) - User.authenticate!(user: cob_user) - end - - let!(:appeal) do - sji = SanitizedJsonImporter.from_file( - "db/seeds/sanitized_json/b5eba21a-9baf-41a3-ac1c-08470c2b79c4.json", - verbosity: 0 - ) - sji.import - sji.imported_records[Appeal.table_name].first - end - - let(:new_appeal) do - appellant_substitution = AppellantSubstitution.find_by(source_appeal_id: appeal.id) - appellant_substitution.target_appeal - end - - context "with an EvidenceSubmissionWindowTask selected" do - before do - select_task_ids_in_ui([TASKS[:evidence_submission_window]]) - end - - it "show a success message" do - expect(page).to have_content("You have successfully added a substitute appellant") - end - - it "prints the generated task tree" do - new_appeal.treee - end - end - - context "with a ScheduleHearingTask selected" do - before do - select_task_ids_in_ui([TASKS[:schedule_hearing]]) - end - - it "prints a task tree" do - new_appeal.treee - end - end - - context "with a HearingAdminActionVerifyAddressTask selected" do - before do - select_task_ids_in_ui([TASKS[:address_verify]]) - end - - it "creates a proper task tree" do - new_appeal.treee - - sht = ScheduleHearingTask.find_by(appeal_id: new_appeal.id) - expect(sht.status).to eq "on_hold" - - haavat = HearingAdminActionVerifyAddressTask.find_by(appeal_id: new_appeal.id) - expect(haavat.status).to eq "assigned" - expect(haavat.assigned_to.type).to eq "HearingsManagement" - end - end - - context "with an AssignHearingDispositionTask selected" do - before do - select_task_ids_in_ui([TASKS[:assign_hearing_disposition]]) - end - - it "prints a task tree" do - new_appeal.treee - end - end - - context "with a TranscriptionTask selected" do - before do - select_task_ids_in_ui([TASKS[:transcription]]) - end - - it "prints a task tree" do - new_appeal.treee - end - end - - context "with EvidenceSubmissionWindow and Transcription selected" do - before do - select_task_ids_in_ui([TASKS[:evidence_submission_window], TASKS[:transcription]]) - end - - it "prints a task tree" do - new_appeal.treee - end - end - - context "with Verify Address and Schedule Hearing selected" do - before do - select_task_ids_in_ui([TASKS[:address_verify], TASKS[:schedule_hearing]]) - end - - it "prints a task tree" do - new_appeal.treee - end - end - end -end From 71aefea59f8e968f1e14c3f0bb6a46f1edd7aa69 Mon Sep 17 00:00:00 2001 From: Sean Craig <110493538+seancva@users.noreply.github.com> Date: Mon, 21 Aug 2023 10:45:03 -0500 Subject: [PATCH 3/3] APPEALS-24145 Fix test scenario "Assigning it to complete the claims establishment" (#19209) * deleted a flakey hang and added an expect for the url * Added a few more expects * small formating changes * removed no longer needed comment * removed unneccesarcy expect --- spec/feature/dispatch/establish_claim_spec.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/spec/feature/dispatch/establish_claim_spec.rb b/spec/feature/dispatch/establish_claim_spec.rb index 15442585c9a..02cab5c7992 100644 --- a/spec/feature/dispatch/establish_claim_spec.rb +++ b/spec/feature/dispatch/establish_claim_spec.rb @@ -141,6 +141,7 @@ end visit "/dispatch/work-assignments" + expect(page).to have_content("1.\nJanet Smith\n0 0 1 1 3") expect(page).to have_content("2.\nJune Smith\n1 0 0 1 2") expect(page).to have_content("3.\nJeffers Smith\n0 1 0 1 2") @@ -544,6 +545,7 @@ click_label("confirmNote") click_on "Finish routing claim" + expect(page).to have_current_path("/dispatch/establish-claim/#{task.id}") expect(page).to have_content("Success!") expect(page).to have_content("Reviewed Full Grant decision") expect(page).to have_content("Established EP: 070BVAGR - BVA Grant (070) for Station 351 - Muskogee") @@ -579,6 +581,7 @@ click_on "Finish routing claim" # Confirmation Page + expect(page).to have_current_path("/dispatch/establish-claim/#{task.id}") expect(page).to have_content("Success!") expect(page).to have_content("Added VBMS Note on Rice Compliance") @@ -623,7 +626,7 @@ ) end - scenario "Assigning it to complete the claims establishment", skip: "flakey hang" do + scenario "Assigning it to complete the claims establishment" do visit "/dispatch/establish-claim" click_on "Establish next claim" @@ -631,8 +634,9 @@ expect(page).to have_current_path("/dispatch/establish-claim/#{task.id}") expect(page).to have_content("Route Claim") expect(page).to have_selector(:link_or_button, "Assign to Claim") - click_on "Assign to Claim" # unknown reason sometimes hangs here + click_on "Assign to Claim" + expect(page).to have_current_path("/dispatch/establish-claim/#{task.id}") expect(page).to have_content("Success!") expect(task.reload.outgoing_reference_id).to eq(end_product.claim_id) @@ -671,6 +675,7 @@ click_on "Create End Product" # Confirmation Page + expect(page).to have_current_path("/dispatch/establish-claim/#{task.id}") expect(page).to have_content("Success!") expect(page).to have_content("Established EP: 070RMBVAGARC - ARC Remand with BVA Grant for Station 397 - ARC") expect(page).to have_content("VACOLS Updated: Changed Location to 98") @@ -768,6 +773,7 @@ safe_click "#button-Finish-routing-claim" + expect(page).to have_current_path("/dispatch/establish-claim/#{task.id}") expect(page).to have_content("Success!") expect(page).to have_content("VACOLS Updated: Changed Location to 50") expect(page).to have_content("Added VBMS Note on Rice Compliance") @@ -824,6 +830,7 @@ click_on "Finish routing claim" + expect(page).to have_current_path("/dispatch/establish-claim/#{task.id}") expect(page).to have_content("Success!") expect(task.reload.completion_status).to eq("special_issue_vacols_routed") end @@ -855,6 +862,7 @@ click_on "Create new EP" click_on "Create End Product" + expect(page).to have_current_path("/dispatch/establish-claim/#{task.id}") expect(page).to have_content("Success!") expect(Fakes::VBMSService).to have_received(:establish_claim!).with(