-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Recruitment Performance report Show mid-cycle / recruitment performance based on FeatureFlag Add specs for single / multiple providers
- Loading branch information
1 parent
ae299e3
commit 90dc2a5
Showing
7 changed files
with
198 additions
and
139 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
module ProviderInterface | ||
class ReportsController < ProviderInterfaceController | ||
def index | ||
@providers = current_user.providers | ||
@providers = current_user.providers.preload(:performance_reports) | ||
@performance_reports = current_user.providers.any? { _1.performance_reports.present? } | ||
end | ||
end | ||
end |
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/provider_interface/provider_reports_page_spec.rb
This file was deleted.
Oops, something went wrong.
38 changes: 38 additions & 0 deletions
38
spec/system/provider_interface/reports/index_provider_user_one_provider_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,38 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.feature 'Provider reports index' do | ||
include DfESignInHelpers | ||
scenario 'when provider user has one provider' do | ||
given_a_provider_and_provider_user_exists | ||
and_i_am_signed_in_as_provider_user | ||
when_i_visit_the_reports_index | ||
then_the_page_has_the_right_content | ||
end | ||
|
||
def when_i_visit_the_reports_index | ||
visit provider_interface_reports_path | ||
expect(page).to have_current_path('/provider/reports') | ||
end | ||
|
||
def given_a_provider_and_provider_user_exists | ||
@provider_user = create(:provider_user, :with_dfe_sign_in, email_address: '[email protected]') | ||
@provider = @provider_user.providers.first | ||
end | ||
|
||
def then_the_page_has_the_right_content | ||
expect(page).to have_css('h1', text: 'Reports') | ||
expect(page).to have_css('h2', text: 'Application data for this recruitment cycle') | ||
expect(page).to have_link('Status of active applications', href: provider_interface_reports_provider_status_of_active_applications_path(provider_id: @provider)) | ||
expect(page).to have_link('Sex, disability, ethnicity and age of candidates', href: provider_interface_reports_provider_diversity_report_path(provider_id: @provider)) | ||
expect(page).to have_link('Withdrawals', href: provider_interface_reports_provider_withdrawal_report_path(provider_id: @provider)) | ||
expect(page).to have_css('h2', text: 'Download and export') | ||
expect(page).to have_link('Export application data', href: provider_interface_new_application_data_export_path) | ||
expect(page).to have_link('Export data for Higher Education Statistics Agency (HESA)', href: provider_interface_reports_hesa_exports_path) | ||
end | ||
|
||
def and_i_am_signed_in_as_provider_user | ||
provider_exists_in_dfe_sign_in | ||
provider_signs_in_using_dfe_sign_in | ||
expect(page).to have_current_path('/provider/applications') | ||
end | ||
end |
48 changes: 48 additions & 0 deletions
48
spec/system/provider_interface/reports/index_provider_user_two_providers_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,48 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.feature 'Provider with two providers reports index' do | ||
include DfESignInHelpers | ||
scenario 'when a provider user has more than one provider' do | ||
given_a_provider_user_with_two_providers_exists | ||
and_i_am_signed_in_as_provider_user | ||
when_i_visit_the_reports_index | ||
and_the_page_has_all_the_right_elements | ||
end | ||
|
||
def when_i_visit_the_reports_index | ||
visit provider_interface_reports_path | ||
expect(page).to have_current_path('/provider/reports') | ||
end | ||
|
||
def given_a_provider_user_with_two_providers_exists | ||
@provider_user = create(:provider_user, :with_dfe_sign_in, email_address: '[email protected]') | ||
@provider = @provider_user.providers.first | ||
@second_provider = create(:provider) | ||
# add a second provider to the users account | ||
@provider_user.providers << @second_provider | ||
end | ||
|
||
def and_the_page_has_all_the_right_elements | ||
expect(page).to have_css('h1', text: 'Reports') | ||
expect(page).to have_css('h2', text: 'Application data for this recruitment cycle') | ||
expect(page).to have_link('Export application data', href: provider_interface_new_application_data_export_path) | ||
expect(page).to have_link('Export data for Higher Education Statistics Agency (HESA)', href: provider_interface_reports_hesa_exports_path) | ||
expect(page).to have_css('h3', text: @provider.name) | ||
expect(page).to have_link('Status of active applications', href: provider_interface_reports_provider_status_of_active_applications_path(provider_id: @provider)) | ||
expect(page).to have_link('Sex, disability, ethnicity and age of candidates', href: provider_interface_reports_provider_diversity_report_path(provider_id: @provider)) | ||
expect(page).to have_link('Withdrawals', href: provider_interface_reports_provider_withdrawal_report_path(provider_id: @second_provider)) | ||
expect(page).to have_css('h3', text: @second_provider.name) | ||
expect(page).to have_link('Status of active applications', href: provider_interface_reports_provider_status_of_active_applications_path(provider_id: @second_provider)) | ||
expect(page).to have_link('Sex, disability, ethnicity and age of candidates', href: provider_interface_reports_provider_diversity_report_path(provider_id: @second_provider)) | ||
expect(page).to have_link('Withdrawals', href: provider_interface_reports_provider_withdrawal_report_path(provider_id: @second_provider)) | ||
expect(page).to have_css('h2', text: 'Download and export') | ||
expect(page).to have_link('Export application data', href: provider_interface_new_application_data_export_path) | ||
expect(page).to have_link('Export data for Higher Education Statistics Agency (HESA)', href: provider_interface_reports_hesa_exports_path) | ||
end | ||
|
||
def and_i_am_signed_in_as_provider_user | ||
provider_exists_in_dfe_sign_in | ||
provider_signs_in_using_dfe_sign_in | ||
expect(page).to have_current_path('/provider/applications') | ||
end | ||
end |
56 changes: 56 additions & 0 deletions
56
...vider_interface/reports/index_provider_user_two_providers_with_performance_report_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,56 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.feature 'Provider with two providers reports index' do | ||
include DfESignInHelpers | ||
before { FeatureFlag.activate(:recruitment_performance_report) } | ||
|
||
scenario 'when provider user has multiple provider with performance report' do | ||
given_a_provider_user_with_two_providers_exists | ||
and_a_provider_has_a_recruitment_peroformance_report | ||
and_i_am_signed_in_as_provider_user | ||
when_i_visit_the_reports_index | ||
then_the_page_has_the_right_content | ||
end | ||
|
||
def when_i_visit_the_reports_index | ||
visit provider_interface_reports_path | ||
expect(page).to have_current_path('/provider/reports', ignore_query: true) | ||
end | ||
|
||
def and_a_provider_has_a_recruitment_peroformance_report | ||
create(:provider_recruitment_performance_report, provider: @provider) | ||
end | ||
|
||
def given_a_provider_user_with_two_providers_exists | ||
@provider_user = create(:provider_user, :with_dfe_sign_in, email_address: '[email protected]') | ||
@provider = @provider_user.providers.first | ||
@second_provider = create(:provider) | ||
@provider_user.providers << @second_provider | ||
end | ||
|
||
def then_the_page_has_the_right_content | ||
expect(page).to have_css('h1', text: 'Reports') | ||
expect(page).to have_css('h2', text: 'Weekly recruitment performance report') | ||
expect(page).to have_link('Weekly report for week ending 2024-06-01', href: provider_interface_reports_provider_recruitment_performance_report_path(@provider)) | ||
expect(page).to have_css('h2', text: 'Application data for this recruitment cycle') | ||
expect(page).to have_link('Export application data', href: provider_interface_new_application_data_export_path) | ||
expect(page).to have_link('Export data for Higher Education Statistics Agency (HESA)', href: provider_interface_reports_hesa_exports_path) | ||
expect(page).to have_css('h3', text: @provider.name) | ||
expect(page).to have_link('Status of active applications', href: provider_interface_reports_provider_status_of_active_applications_path(provider_id: @provider)) | ||
expect(page).to have_link('Sex, disability, ethnicity and age of candidates', href: provider_interface_reports_provider_diversity_report_path(provider_id: @provider)) | ||
expect(page).to have_link('Withdrawals', href: provider_interface_reports_provider_withdrawal_report_path(provider_id: @provider)) | ||
expect(page).to have_css('h3', text: @second_provider.name) | ||
expect(page).to have_link('Status of active applications', href: provider_interface_reports_provider_status_of_active_applications_path(provider_id: @second_provider)) | ||
expect(page).to have_link('Sex, disability, ethnicity and age of candidates', href: provider_interface_reports_provider_diversity_report_path(provider_id: @second_provider)) | ||
expect(page).to have_link('Withdrawals', href: provider_interface_reports_provider_withdrawal_report_path(provider_id: @second_provider)) | ||
expect(page).to have_css('h2', text: 'Download and export') | ||
expect(page).to have_link('Export application data', href: provider_interface_new_application_data_export_path) | ||
expect(page).to have_link('Export data for Higher Education Statistics Agency (HESA)', href: provider_interface_reports_hesa_exports_path) | ||
end | ||
|
||
def and_i_am_signed_in_as_provider_user | ||
provider_exists_in_dfe_sign_in | ||
provider_signs_in_using_dfe_sign_in | ||
expect(page).to have_current_path('/provider/applications', ignore_query: true) | ||
end | ||
end |