@@ -588,6 +588,45 @@ def test_flake_rate_filtering_on_test_results(self) -> None:
588588 ]
589589 }
590590
591+ def test_flake_rate_filtering_by_term (self ) -> None :
592+ repo = RepositoryFactory (author = self .owner , active = True , private = True )
593+ test = TestFactory (repository = repo , name = "hello" )
594+ _ = DailyTestRollupFactory (
595+ test = test ,
596+ date = datetime .date .today () - datetime .timedelta (days = 1 ),
597+ repoid = repo .repoid ,
598+ pass_count = 1 ,
599+ fail_count = 1 ,
600+ flaky_fail_count = 1 ,
601+ )
602+ _ = DailyTestRollupFactory (
603+ test = test ,
604+ date = datetime .date .today (),
605+ repoid = repo .repoid ,
606+ pass_count = 3 ,
607+ fail_count = 0 ,
608+ flaky_fail_count = 0 ,
609+ )
610+ test_2 = TestFactory (repository = repo , name = "world" )
611+ _ = DailyTestRollupFactory (
612+ test = test_2 ,
613+ date = datetime .date .today (),
614+ repoid = repo .repoid ,
615+ pass_count = 2 ,
616+ fail_count = 3 ,
617+ flaky_fail_count = 1 ,
618+ )
619+ res = self .fetch_test_analytics (
620+ repo .name ,
621+ """testResults(filters: { term: "hello" }) { edges { node { name failureRate } } }""" ,
622+ )
623+
624+ assert res ["testResults" ] == {
625+ "edges" : [
626+ {"node" : {"name" : test .name , "failureRate" : 0.2 }},
627+ ]
628+ }
629+
591630 def test_desc_flake_rate_ordering_on_test_results (self ) -> None :
592631 repo = RepositoryFactory (author = self .owner , active = True , private = True )
593632 test = TestFactory (repository = repo )
@@ -662,17 +701,19 @@ def test_test_results_aggregates(self) -> None:
662701 )
663702 res = self .fetch_test_analytics (
664703 repo .name ,
665- """testResultsAggregates { totalDuration, slowestTestsDuration, totalFails, totalSkips, totalDurationPercentChange, slowestTestsDurationPercentChange, totalFailsPercentChange, totalSkipsPercentChange }""" ,
704+ """testResultsAggregates { totalDuration, slowestTestsDuration, totalFails, totalSkips, totalSlowTests, totalDurationPercentChange, slowestTestsDurationPercentChange, totalFailsPercentChange, totalSkipsPercentChange, totalSlowTestsPercentChange }""" ,
666705 )
667706 assert res ["testResultsAggregates" ] == {
668707 "totalDuration" : 570.0 ,
669- "slowestTestsDuration" : 29.0 ,
670- "totalFails" : 10 ,
671- "totalSkips" : 5 ,
672708 "totalDurationPercentChange" : - 63.1068 ,
709+ "slowestTestsDuration" : 29.0 ,
673710 "slowestTestsDurationPercentChange" : - 50.84746 ,
711+ "totalFails" : 10 ,
674712 "totalFailsPercentChange" : 100.0 ,
713+ "totalSkips" : 5 ,
675714 "totalSkipsPercentChange" : - 50.0 ,
715+ "totalSlowTests" : 1 ,
716+ "totalSlowTestsPercentChange" : 0.0 ,
676717 }
677718
678719 def test_test_results_aggregates_no_history (self ) -> None :
@@ -696,18 +737,20 @@ def test_test_results_aggregates_no_history(self) -> None:
696737
697738 res = self .fetch_test_analytics (
698739 repo .name ,
699- """testResultsAggregates { totalDuration, slowestTestsDuration, totalFails, totalSkips, totalDurationPercentChange, slowestTestsDurationPercentChange, totalFailsPercentChange, totalSkipsPercentChange }""" ,
740+ """testResultsAggregates { totalDuration, slowestTestsDuration, totalFails, totalSkips, totalSlowTests, totalDurationPercentChange, slowestTestsDurationPercentChange, totalFailsPercentChange, totalSkipsPercentChange, totalSlowTestsPercentChange }""" ,
700741 )
701742
702743 assert res ["testResultsAggregates" ] == {
703744 "totalDuration" : 570.0 ,
704- "slowestTestsDuration" : 29.0 ,
705- "totalFails" : 10 ,
706- "totalSkips" : 5 ,
707745 "totalDurationPercentChange" : None ,
746+ "slowestTestsDuration" : 29.0 ,
708747 "slowestTestsDurationPercentChange" : None ,
748+ "totalFails" : 10 ,
709749 "totalFailsPercentChange" : None ,
750+ "totalSkips" : 5 ,
710751 "totalSkipsPercentChange" : None ,
752+ "totalSlowTests" : 1 ,
753+ "totalSlowTestsPercentChange" : None ,
711754 }
712755
713756 def test_flake_aggregates (self ) -> None :
0 commit comments