<?php

namespace Tests\Feature;

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

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

        $runId = 'BAS_COPY_BTN_0001';

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

        $this->assertStringContainsString('data-action="copy-run-id"', $html);
        $this->assertStringContainsString('data-run-id="' . $runId . '"', $html);
        $this->assertStringContainsString('复制 run_id', $html);
    }
}
