diff --git a/app/Http/Controllers/BuildController.php b/app/Http/Controllers/BuildController.php index ef4a523355..60bb1977bc 100644 --- a/app/Http/Controllers/BuildController.php +++ b/app/Http/Controllers/BuildController.php @@ -121,7 +121,7 @@ public function update(int $build_id): View ]); } - public function tests(int $build_id): View + public function tests(Request $request, int $build_id): View { $this->setBuildById($build_id); @@ -129,14 +129,24 @@ public function tests(int $build_id): View $eloquent_project = Project::findOrFail((int) $this->project->Id); - return $this->vue('build-tests-page', 'Tests', [ + $params = [ 'build-id' => $this->build->Id, 'show-test-time-status' => (bool) $eloquent_project->showtesttime, 'project-name' => $eloquent_project->name, 'build-time' => Carbon::parse($this->build->StartTime)->toIso8601String(), 'initial-filters' => $filters, 'pinned-measurements' => $eloquent_project->pinnedTestMeasurements()->orderBy('position')->pluck('name')->toArray(), - ]); + ]; + + if ($request->has('onlydelta')) { + $params['only-delta'] = true; + $previousBuildId = $this->build->GetPreviousBuildId(); + if ($previousBuildId > 0) { + $params['previous-build-id'] = $previousBuildId; + } + } + + return $this->vue('build-tests-page', 'Tests', $params); } public function coverage(int $build_id): View diff --git a/resources/js/angular/views/partials/build.html b/resources/js/angular/views/partials/build.html index 66cba572df..6b4d202463 100644 --- a/resources/js/angular/views/partials/build.html +++ b/resources/js/angular/views/partials/build.html @@ -335,7 +335,7 @@ {{::build.test.notrun}} - + +{{::build.test.nnotrundiffp}} -{{::build.test.nnotrundiffn}} @@ -348,7 +348,7 @@ {{::build.test.fail}} - + +{{::build.test.nfaildiffp}} @@ -363,7 +363,7 @@ {{::build.test.pass}} - + +{{::build.test.npassdiffp}} @@ -382,7 +382,7 @@ {{::build.test.timestatus}} - + +{{::build.test.ntimediffp}} @@ -392,7 +392,7 @@ {{::build.test.time}} - + +{{::build.test.ntimediffp}} diff --git a/resources/js/vue/components/BuildTestsPage.vue b/resources/js/vue/components/BuildTestsPage.vue index 5eba0cbeff..bfb18c8b9a 100644 --- a/resources/js/vue/components/BuildTestsPage.vue +++ b/resources/js/vue/components/BuildTestsPage.vue @@ -13,8 +13,15 @@ :execute-query-link="executeQueryLink" @change-filters="filters => changedFilters = filters" /> - + +
+ No tests with changed state for this build. +
id}/tests?onlydelta") + ->waitFor('@tests-table') + ->assertDontSeeIn('@tests-table', $current_test_failed_again->testname) + ->assertSeeIn('@tests-table', $current_test_newly_failed->testname) + ->assertSeeIn('@tests-table', $current_test_entirely_new_failed->testname) + ->assertSeeIn('@tests-table', $current_test_fixed->testname) + ->assertDontSeeIn('@tests-table', $current_test_stayed_passed->testname) + ; + }); + } + + public function testOnlyDeltaNoResults(): void + { + /** @var Build $previous_build */ + $previous_build = $this->project->builds()->create([ + 'siteid' => $this->site->id, + 'name' => 'test-build', + 'uuid' => Str::uuid()->toString(), + 'starttime' => '2025-01-01 10:00:00', + 'type' => 'Experimental', + ]); + + /** @var Test $previous_test_failed */ + $previous_test_failed = $previous_build->tests()->create([ + 'testname' => 'failed-before', + 'status' => 'failed', + 'outputid' => $this->testOutput->id, + ]); + + /** @var Build $current_build */ + $current_build = $this->project->builds()->create([ + 'siteid' => $this->site->id, + 'name' => 'test-build', + 'uuid' => Str::uuid()->toString(), + 'starttime' => '2025-01-01 11:00:00', + 'type' => 'Experimental', + ]); + + /** @var Test $current_test_failed_again */ + $current_test_failed_again = $current_build->tests()->create([ + 'testname' => 'failed-before', + 'status' => 'failed', + 'outputid' => $this->testOutput->id, + ]); + + $this->browse(function (Browser $browser) use ($current_build): void { + $browser->visit("/builds/{$current_build->id}/tests?onlydelta") + ->waitForText('No tests with changed state for this build.') + ->assertSee('No tests with changed state for this build.') + ->assertMissing('@tests-table') + ; + }); + } }