<?php

namespace Tests\Feature;

use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;

class AdminPlatformBatchShowPageCopyLinkButtonsShouldIncludeLabelsTest 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_copy_link_buttons_should_include_data_label(): void
    {
        $this->loginAsPlatformAdmin();

        $runId = 'BAS_COPY_LABEL_0001';

        $html = $this->get('/admin/platform-batches/show?type=bas&run_id=' . $runId)
            ->assertOk()
            ->getContent();

        // 至少校验“本批次失败”的复制按钮携带 label
        $this->assertStringContainsString('data-role="copy-failed-link"', $html);
        $this->assertStringContainsString('data-label="本批次失败"', $html);
    }
}
