diff --git a/Gemfile.lock b/Gemfile.lock index 06413b5f3..8e9cdfd63 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -395,7 +395,7 @@ GEM mongoid (>= 3.0, < 10.0) mongoid-tree (2.3.0) mongoid (>= 4.0, < 10) - msgpack (1.8.0) + msgpack (1.8.3) multi_json (1.20.1) multi_test (1.1.0) mustache (1.1.2) diff --git a/app/helpers/test_executions_helper.rb b/app/helpers/test_executions_helper.rb index 3cb48f5f3..d321451a1 100644 --- a/app/helpers/test_executions_helper.rb +++ b/app/helpers/test_executions_helper.rb @@ -112,7 +112,7 @@ def info_title_for_product_test(product_test) # returns [file_name, error_result] def file_name_and_error_result_from_execution(execution) - errs = Cypress::ErrorCollector.collected_errors(execution) + errs = Cypress::ErrorCollector.collected_errors(execution, file_name: params[:file_name]) files = errs.files.select { |file_name, _| route_file_name(file_name) == params[:file_name] } file_name_and_error_result_from_files(files, params[:file_name]) end diff --git a/app/views/products/report/_failing_measure_tests.html.erb b/app/views/products/report/_failing_measure_tests.html.erb index 0b19ef85d..b0078f5fe 100644 --- a/app/views/products/report/_failing_measure_tests.html.erb +++ b/app/views/products/report/_failing_measure_tests.html.erb @@ -34,7 +34,7 @@ <% errors = execution.execution_errors %> <% if task.is_a? C2Task - collected_errors = Cypress::ErrorCollector.collected_errors(execution) + collected_errors = Cypress::ErrorCollector.collected_errors(execution, include_locations: false) collected_errors.files.each do |file_name, error_result| %> <% error_result.each do |error_type, error_hash| %> <% report_sup_data_errors = population_data_errors(error_hash.execution_errors, 'supplemental_data') %> @@ -42,7 +42,7 @@ <% pop_sum_errors = population_data_errors(error_hash.execution_errors - pop_errors, 'population_sum') %> <% non_pop_errors = error_hash.execution_errors - report_sup_data_errors - pop_errors - pop_sum_errors %> <% errors = errors - report_sup_data_errors - pop_errors - pop_sum_errors - non_pop_errors %> - <%= render partial: 'test_executions/results/error_table', locals: { errors: non_pop_errors, message_title: error_type, export: false} %> + <%= render partial: 'test_executions/results/error_table', locals: { errors: non_pop_errors, message_title: error_type, export: false, on_execution_show_page: true} %> <%= render partial: 'test_executions/results/supplemental_data_error_table', locals: { errors: report_sup_data_errors + pop_errors + pop_sum_errors, pop_errors_hash: population_error_hash(pop_errors + pop_sum_errors, report_sup_data_errors), task: task } %> <% end %> <% end %> diff --git a/app/views/test_executions/_execution_results.html.erb b/app/views/test_executions/_execution_results.html.erb index 2bbbd14e5..2eb6fe758 100644 --- a/app/views/test_executions/_execution_results.html.erb +++ b/app/views/test_executions/_execution_results.html.erb @@ -60,7 +60,7 @@ end %> <% end %> - <% collected_errors = Cypress::ErrorCollector.collected_errors(execution) %> + <% collected_errors = Cypress::ErrorCollector.collected_errors(execution, include_locations: false ) %> <% if collected_errors[:exception] %>

An internal error occurred when loading this page

diff --git a/app/views/test_executions/results/_error_table.html.erb b/app/views/test_executions/results/_error_table.html.erb index 15f114250..26f19faec 100644 --- a/app/views/test_executions/results/_error_table.html.erb +++ b/app/views/test_executions/results/_error_table.html.erb @@ -16,12 +16,19 @@ <% message_title = 'Error' if message_title == 'Errors' message_title = 'Warning' if message_title == 'Warnings' %> <%= "#{message_title} message" %> - <% unless export %> + <% unless export || on_execution_show_page %> Go To in XML <% end %> + <% if on_execution_show_page %> + <% errors.each do |error| %> + + <%= error.message %> + + <% end %> + <% else %> <% errors.sort { |a, b| compare_error_locations_across_files(a, b) }.each do |error| %> <%= error.message %> @@ -33,5 +40,6 @@ <% end %> + <% end %> diff --git a/app/views/test_executions/results/_execution_results_for_file.html.erb b/app/views/test_executions/results/_execution_results_for_file.html.erb index 68df25ec1..63480c72f 100644 --- a/app/views/test_executions/results/_execution_results_for_file.html.erb +++ b/app/views/test_executions/results/_execution_results_for_file.html.erb @@ -55,7 +55,7 @@ <% pop_errors = population_data_errors(error_hash.execution_errors - report_sup_data_errors, 'population') %> <% pop_sum_errors = population_data_errors(error_hash.execution_errors - pop_errors, 'population_sum') %> <% non_pop_errors = error_hash.execution_errors - report_sup_data_errors - pop_errors - pop_sum_errors %> - <%= render partial: 'test_executions/results/error_table', locals: { errors: non_pop_errors, message_title: message_title, export: export} %> + <%= render partial: 'test_executions/results/error_table', locals: { errors: non_pop_errors, message_title: message_title, export: export, on_execution_show_page: on_execution_show_page } %> <%= render partial: 'test_executions/results/supplemental_data_error_table', locals: { errors: report_sup_data_errors + pop_errors + pop_sum_errors, pop_errors_hash: population_error_hash(pop_errors + pop_sum_errors, report_sup_data_errors), task: @task } %> <% unless on_execution_show_page %> diff --git a/lib/cypress/error_collector.rb b/lib/cypress/error_collector.rb index cbabb4f0f..19770cc89 100644 --- a/lib/cypress/error_collector.rb +++ b/lib/cypress/error_collector.rb @@ -6,10 +6,12 @@ class FileNotFound < StandardError end # include_locations (default true) to include the xml locations mapping with collected errors - def self.collected_errors(execution, include_locations: true) + def self.collected_errors(execution, include_locations: true, file_name: nil) # gonna return all the errors for this execution, structured in a reasonable way. collected_errors = { nonfile: get_nonfile_errors(execution), files: {} } execution.artifact.file_names.each do |this_name| + next unless file_name.nil? || file_name == ApplicationController.helpers.route_file_name(this_name) + all_errs = execution.execution_errors.by_file(this_name.force_encoding('UTF-8')) related_errs = execution.sibling_execution ? execution.sibling_execution.execution_errors.by_file(this_name) : [] # c3 next unless (all_errs.count + related_errs.count).positive?