create(['model_id' => 'public/model']); RunResult::factory()->count(3)->create(['benchmark_run_id' => $publicRun->id]); BenchmarkRun::factory()->private()->hasResults(2)->create(['model_id' => 'private/model']); $response = $this->get(route('home')); $response->assertOk() ->assertSee('public/model') ->assertDontSee('private/model'); }); test('authenticated users see their private runs mixed in', function () { $me = User::factory()->create(); BenchmarkRun::factory()->private()->hasResults(2)->create([ 'model_id' => 'my-private/model', 'user_id' => $me->id, ]); BenchmarkRun::factory()->private()->hasResults(1)->create(['model_id' => 'other-private/model']); $this->actingAs($me); $this->get(route('home'))->assertOk() ->assertSee('my-private/model') ->assertDontSee('other-private/model'); }); test('home page sorting orders by user tok/s', function () { $run = BenchmarkRun::factory()->create(); RunResult::factory()->create(['benchmark_run_id' => $run->id, 'task' => 'slow-task', 'user_tps' => 5]); RunResult::factory()->create(['benchmark_run_id' => $run->id, 'task' => 'fast-task', 'user_tps' => 95]); Volt::test('results.index', ['sortBy' => 'user_tps', 'sortDirection' => 'asc']) ->assertSeeInOrder(['slow-task', 'fast-task']); }); test('home page filters narrow by suite', function () { $run = BenchmarkRun::factory()->create(); RunResult::factory()->create(['benchmark_run_id' => $run->id, 'suite' => 'softbench', 'task' => 'soft-task']); RunResult::factory()->create(['benchmark_run_id' => $run->id, 'suite' => 'infrabench', 'task' => 'infra-task']); Volt::test('results.index', ['filters' => ['search' => null, 'suite' => 'softbench', 'level' => null, 'model' => null, 'result' => null]]) ->assertSee('soft-task') ->assertDontSee('infra-task'); }); test('run detail page shows metadata and results', function () { $run = BenchmarkRun::factory()->create(['model_id' => 'detail/model', 'engine' => 'vllm']); RunResult::factory()->create(['benchmark_run_id' => $run->id, 'task' => 'visible-task']); $this->get(route('runs.show', $run->run_id))->assertOk() ->assertSee('detail/model') ->assertSee('visible-task') ->assertSee('vllm'); }); test('private runs are hidden from guests on the detail page', function () { $run = BenchmarkRun::factory()->private()->create(); $this->get(route('runs.show', $run->run_id))->assertNotFound(); }); test('owners can edit notes from the run detail page', function () { $me = User::factory()->create(); $run = BenchmarkRun::factory()->create(['user_id' => $me->id]); $this->actingAs($me); Volt::test('runs.show', ['run' => $run->run_id]) ->set('notes', 'ran on the spare GPU while idle') ->call('saveNotes'); expect($run->fresh()->notes)->toBe('ran on the spare GPU while idle'); }); test('non-owners cannot edit notes', function () { $intruder = User::factory()->create(); $run = BenchmarkRun::factory()->create(['user_id' => User::factory()->create()->id]); $this->actingAs($intruder); Volt::test('runs.show', ['run' => $run->run_id]) ->set('notes', 'nice try') ->call('saveNotes'); expect($run->fresh()->notes)->toBeNull(); }); test('owner can toggle visibility from run detail page', function () { $me = User::factory()->create(); $run = BenchmarkRun::factory()->create(['user_id' => $me->id]); $this->actingAs($me); Volt::test('runs.show', ['run' => $run->run_id])->call('toggleVisibility'); expect($run->fresh()->visibility)->toBe('private'); }); test('my runs page lists only owned runs with counts', function () { $me = User::factory()->create(); $run = BenchmarkRun::factory()->create(['user_id' => $me->id, 'model_id' => 'mine/model']); RunResult::factory()->count(4)->create(['benchmark_run_id' => $run->id]); BenchmarkRun::factory()->create(['user_id' => User::factory()->create()->id, 'model_id' => 'theirs/model']); $this->actingAs($me); $this->get(route('my-runs'))->assertOk() ->assertSee('mine/model') ->assertDontSee('theirs/model'); });