feat(batch): 批次页治理入口增加复制链接按钮

This commit is contained in:
萝卜
2026-03-17 16:49:45 +08:00
parent 6d94583231
commit d219712567
3 changed files with 93 additions and 19 deletions

View File

@@ -0,0 +1,38 @@
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminPlatformBatchShowPageCopyGovernanceLinksButtonsShouldRenderTest extends TestCase
{
use RefreshDatabase;
protected function loginAsPlatformAdmin(): void
{
$this->seed();
$this->post('/admin/login', [
'email' => 'platform.admin@demo.local',
'password' => 'Platform@123456',
])->assertRedirect('/admin');
}
public function test_batch_show_page_should_render_copy_buttons_for_governance_links_when_present(): void
{
$this->loginAsPlatformAdmin();
// 不依赖 DB该页面即使 summary 缺失也会渲染治理入口(本批次失败/按Top原因是否存在取决于 controller summary。
// 这里用 BAS + 任意 run_id只校验按钮结构存在治理链接内容在其它测试已覆盖。
$runId = 'BAS_COPY_LINKS_0001';
// 该 run_id 在空库下 summary 为空controller 仍会生成 failed/all/retry 链接,因此“本批次失败”应存在。
$html = $this->get('/admin/platform-batches/show?type=bas&run_id=' . $runId)
->assertOk()
->getContent();
$this->assertStringContainsString('data-action="copy-link"', $html);
$this->assertStringContainsString('data-role="copy-failed-link"', $html);
}
}