1515require 'cdo/git_utils'
1616require 'cdo/rake_utils'
1717require 'cdo/test_flakiness'
18- require 'cdo/ci_utils'
1918
2019require 'haml'
2120require 'json'
@@ -63,7 +62,7 @@ def main(options)
6362 open_log_files
6463 configure_for_eyes if eyes?
6564 report_tests_starting
66- run_status_page_url = generate_status_page ( start_time ) if options . with_status_page
65+ generate_status_page ( start_time ) if options . with_status_page
6766
6867 run_results = Parallel . map ( browser_feature_generator , parallel_config ( options . parallel_limit ) ) do |browser , feature |
6968 run_feature browser , feature , options
@@ -87,7 +86,7 @@ def main(options)
8786 return 1001
8887 end
8988
90- report_tests_finished start_time , run_results , run_status_page_url
89+ report_tests_finished start_time , run_results
9190 run_results . count { |feature_succeeded , _ , _ | !feature_succeeded }
9291ensure
9392 close_log_files
@@ -414,7 +413,7 @@ def report_tests_starting
414413 end
415414end
416415
417- def report_tests_finished ( start_time , run_results , run_status_page_url = nil )
416+ def report_tests_finished ( start_time , run_results )
418417 suite_duration = Time . now - start_time
419418
420419 # How many flaky test reruns occurred across all tests (ignoring the initial attempt).
@@ -441,22 +440,28 @@ def report_tests_finished(start_time, run_results, run_status_page_url = nil)
441440 Infrastructure ::Logger . put ( 'runner_feature_tests_successful_flaky_reruns' , total_flaky_successful_reruns , extra_dimensions )
442441 Infrastructure ::Logger . put ( 'runner_feature_tests_count' , run_results . count , extra_dimensions )
443442 Infrastructure ::Logger . flush
444-
445- test_report = "\n #{ test_type . upcase } TEST REPORT: #{ failures . any? ? "*❌ FAILED*" : "*✅ PASSED*" } \n "
446- test_report += "\n #{ failures . count } x failed features:\n " + failures . map { |failure | "• #{ failure } \n " } . join if failures . any?
447- test_report += "\n "
448- test_report += "Applitools Eyes Results:\n #{ applitools_batch_url } \n \n " if applitools_batch_url
449- test_report += "#{ test_type } Test Status Page (permalink for this run):\n #{ run_status_page_url } \n \n " if run_status_page_url
450- test_report += "#{ test_type } Test Status Page (for this server, *if you're lost start here*):\n #{ server_status_page_url } \n \n " unless CI ::Utils . running_on_ci?
451- test_report += "\n "
452- test_report += "#{ suite_success_count } passed. #{ failures . count } failed. Test count: #{ run_results . count } . Duration: #{ RakeUtils . format_duration ( suite_duration ) } . Total successful reruns of flaky tests: #{ total_flaky_successful_reruns } .\n "
453- test_report += "\n "
454- test_report += "\n *#{ test_type . upcase } * TESTS #{ failures . any? ? "FAILED" : "PASSED" } \n \n "
455-
456- ChatClient . log test_report , color : 'purple'
443+ ChatClient . log "#{ suite_success_count } succeeded. #{ failures . count } failed. " \
444+ "Test count: #{ run_results . count } . " \
445+ "Total duration: #{ RakeUtils . format_duration ( suite_duration ) } . " \
446+ "Total reruns of flaky tests: #{ total_flaky_reruns } . " \
447+ "Total successful reruns of flaky tests: #{ total_flaky_successful_reruns } ." \
448+ + ( status_page_url ? " <a href=\" #{ status_page_url } \" >#{ test_type } test status page</a>." : '' ) \
449+ + ( applitools_batch_url ? " <a href=\" #{ applitools_batch_url } \" >Applitools results</a>." : '' )
450+
451+ a_status_page = status_page_url ? "<a href=\" #{ status_page_url } \" >" : ''
452+ end_a = status_page_url ? "</a>" : ''
453+
454+ if failures . empty?
455+ ChatClient . log "*#{ a_status_page } SUMMARY, #{ suite_success_count } DASHBOARD #{ test_type . upcase } TESTS PASSED#{ end_a } *" , color : 'purple'
456+ else
457+ ChatClient . log "*#{ a_status_page } SUMMARY, #{ failures . count } DASHBOARD #{ test_type . upcase } TESTS FAILED#{ end_a } :*" , color : 'purple'
458+ failures . each do |failure |
459+ ChatClient . log "\t • #{ failure } " , color : 'purple'
460+ end
461+ end
457462end
458463
459- def server_status_page_url
464+ def status_page_url
460465 return nil unless $options. with_status_page
461466 CDO . studio_url ( '/ui_test/' + status_page_filename , scheme_for_environment )
462467end
@@ -465,30 +470,15 @@ def status_page_filename
465470 "test_status_#{ test_type } .html"
466471end
467472
468- # Returns a permalink URL for the Test Status Page, assuming we can upload it to S3
469- def upload_status_page_to_s3 ( status_page_path = File . join ( UI_TEST_DIR , status_page_filename ) )
470- LOG_UPLOADER . upload_file ( File . join ( UI_TEST_DIR , 'test_status.css' ) , { content_type : 'text/css' } )
471- LOG_UPLOADER . upload_file ( File . join ( UI_TEST_DIR , 'test_status.js' ) , { content_type : 'text/javascript' } )
472-
473- return LOG_UPLOADER . upload_file ( status_page_path , { content_type : 'text/html' } )
474- rescue Aws ::Sigv4 ::Errors ::MissingCredentialsError
475- ChatClient . log "No AWS credentials set, skipping upload of the '#{ test_type } Test Status Page' to S3"
476- nil
477- rescue Exception => exception
478- ChatClient . log "WARNING: exception raised while attempting to upload the '#{ test_type } Test Status Page' to S3:\n #{ exception . class } : #{ exception } \n #{ exception . backtrace &.first ( 5 ) &.join ( "\n " ) } "
479- nil
480- end
481-
482473def scheme_for_environment
483474 ( rack_env? ( :development ) && !CDO . https_development ) ? 'http:' : 'https:'
484475end
485476
486477def generate_status_page ( suite_start_time )
487478 test_status_template = File . read ( File . join ( UI_TEST_DIR , 'test_status.haml' ) )
488479 haml_engine = Haml ::Engine . new ( test_status_template )
489- status_page_path = File . join ( UI_TEST_DIR , status_page_filename )
490480 File . write (
491- status_page_path ,
481+ File . join ( UI_TEST_DIR , status_page_filename ) ,
492482 haml_engine . render (
493483 Object . new ,
494484 {
@@ -503,10 +493,7 @@ def generate_status_page(suite_start_time)
503493 }
504494 )
505495 )
506- run_status_page_url = upload_status_page_to_s3 ( status_page_path )
507- ChatClient . log "#{ test_type } Test Status Page (permalink for this run):\n #{ run_status_page_url } \n \n " if run_status_page_url
508- ChatClient . log "#{ test_type } Test Status Page (for this server):\n #{ server_status_page_url } \n \n " unless CI ::Utils . running_on_ci?
509- return run_status_page_url
496+ ChatClient . log "A <a href=\" #{ status_page_url } \" >status page</a> has been generated for this #{ test_type } test run."
510497end
511498
512499def test_run_identifier ( browser , feature )
0 commit comments