-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
System tests for Payments payer response
- Loading branch information
Jamie
committed
Feb 3, 2025
1 parent
7a45903
commit b97b2d1
Showing
15 changed files
with
860 additions
and
112 deletions.
There are no files selected for viewing
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
3 changes: 3 additions & 0 deletions
3
spec/fixtures/claims/payment/invalid_payer_response_upload_with_invalid_claim_status.csv
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,3 @@ | ||
claim_reference,claim_status,claim_unpaid_reason | ||
11111111,paid, | ||
22222222,clawback_complete,Some reason |
3 changes: 3 additions & 0 deletions
3
spec/fixtures/claims/payment/invalid_payer_response_upload_without_unpaid_reason.csv
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,3 @@ | ||
claim_reference,claim_status,claim_unpaid_reason | ||
11111111,paid, | ||
22222222,unpaid, |
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
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
105 changes: 0 additions & 105 deletions
105
spec/system/claims/support/claims/payments/upload_esfa_response_spec.rb
This file was deleted.
Oops, something went wrong.
60 changes: 60 additions & 0 deletions
60
...load_payer_responses_when_there_are_no_claims_with_the_status_payment_in_progress_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,60 @@ | ||
require "rails_helper" | ||
|
||
RSpec.describe "Support user can not upload payer responses when there are no claims with the status 'payment_in_progress'", | ||
service: :claims, | ||
type: :system do | ||
scenario do | ||
given_i_am_signed_in | ||
|
||
when_i_navigate_to_the_payments_claims_index_page | ||
then_i_see_the_payments_claims_index_page | ||
and_i_see_no_payment_claims_have_been_uploaded | ||
|
||
when_i_click_on_upload_payer_response | ||
then_i_see_there_are_no_claims_waiting_for_a_response | ||
end | ||
|
||
private | ||
|
||
def given_i_am_signed_in | ||
sign_in_claims_support_user | ||
end | ||
|
||
def when_i_navigate_to_the_payments_claims_index_page | ||
within primary_navigation do | ||
click_on "Claims" | ||
end | ||
|
||
within secondary_navigation do | ||
click_on "Payments" | ||
end | ||
end | ||
|
||
def then_i_see_the_payments_claims_index_page | ||
expect(page).to have_title("Claims - Claim funding for mentor training - GOV.UK") | ||
expect(page).to have_h1("Claims") | ||
expect(primary_navigation).to have_current_item("Claims") | ||
expect(secondary_navigation).to have_current_item("Payments") | ||
expect(page).to have_current_path(claims_support_claims_payments_path, ignore_query: true) | ||
end | ||
|
||
def and_i_see_no_payment_claims_have_been_uploaded | ||
expect(page).to have_h2("Payments") | ||
expect(page).to have_element(:p, text: "There are no claims waiting to be processed.") | ||
end | ||
|
||
def when_i_click_on_upload_payer_response | ||
click_on "Upload payer response" | ||
end | ||
|
||
def then_i_see_there_are_no_claims_waiting_for_a_response | ||
expect(page).to have_title("You cannot upload a payer response - Payments - Claims - Claim funding for mentor training - GOV.UK") | ||
expect(page).to have_h1("You cannot upload a payer response") | ||
expect(page).to have_element(:span, text: "Payment") | ||
expect(page).to have_element( | ||
:p, | ||
text: "You cannot upload a payer response as there are no claims waiting for a response.", | ||
class: "govuk-body", | ||
) | ||
end | ||
end |
73 changes: 73 additions & 0 deletions
73
...support/claims/payments/upload_payer_response/support_user_does_not_upload_a_file_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,73 @@ | ||
require "rails_helper" | ||
|
||
RSpec.describe "Support user does not upload a file", | ||
service: :claims, | ||
type: :system do | ||
scenario do | ||
given_claims_exist | ||
and_i_am_signed_in | ||
|
||
when_i_navigate_to_the_payments_claims_index_page | ||
then_i_see_the_payments_claims_index_page | ||
and_i_see_no_payment_claims_have_been_uploaded | ||
|
||
when_i_click_on_upload_payer_response | ||
then_i_see_the_upload_csv_page | ||
|
||
when_i_click_on_upload_csv_file | ||
then_i_see_validation_error_regarding_invalid_data | ||
end | ||
|
||
private | ||
|
||
def given_claims_exist | ||
@claim = create(:claim, | ||
:payment_in_progress, | ||
reference: 11_111_111) | ||
end | ||
|
||
def and_i_am_signed_in | ||
sign_in_claims_support_user | ||
end | ||
|
||
def when_i_navigate_to_the_payments_claims_index_page | ||
within primary_navigation do | ||
click_on "Claims" | ||
end | ||
|
||
within secondary_navigation do | ||
click_on "Payments" | ||
end | ||
end | ||
|
||
def then_i_see_the_payments_claims_index_page | ||
expect(page).to have_title("Claims - Claim funding for mentor training - GOV.UK") | ||
expect(page).to have_h1("Claims") | ||
expect(primary_navigation).to have_current_item("Claims") | ||
expect(secondary_navigation).to have_current_item("Payments") | ||
expect(page).to have_current_path(claims_support_claims_payments_path, ignore_query: true) | ||
end | ||
|
||
def then_i_see_the_upload_csv_page | ||
expect(page).to have_h1("Upload payer response") | ||
have_element(:span, text: "Payments", class: "govuk-caption-l") | ||
expect(page).to have_element(:label, text: "Upload CSV file") | ||
end | ||
|
||
def and_i_see_no_payment_claims_have_been_uploaded | ||
expect(page).to have_h2("Payments") | ||
expect(page).to have_element(:p, text: "There are no claims waiting to be processed.") | ||
end | ||
|
||
def when_i_click_on_upload_payer_response | ||
click_on "Upload payer response" | ||
end | ||
|
||
def when_i_click_on_upload_csv_file | ||
click_on "Upload CSV file" | ||
end | ||
|
||
def then_i_see_validation_error_regarding_invalid_data | ||
expect(page).to have_validation_error("Select a CSV file to upload") | ||
end | ||
end |
Oops, something went wrong.