Files
saasshop/tests/Feature/AdminPlatformOrderIndexClearErrorButtonsShouldDisableWhenNotInFailedScopeTest.php

44 lines
1.5 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminPlatformOrderIndexClearErrorButtonsShouldDisableWhenNotInFailedScopeTest 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_clear_error_buttons_should_disable_when_filters_not_in_failed_scopes(): void
{
$this->loginAsPlatformAdmin();
// 默认列表(未进入失败集合)
$res = $this->get('/admin/platform-orders');
$res->assertOk();
$html = (string) $res->getContent();
$this->assertStringContainsString('清除同步失败标记(当前筛选范围)', $html);
$this->assertStringContainsString('data-role="clear-sync-errors-blocked-hint"', $html);
$this->assertStringContainsString('同步失败', $html);
$this->assertStringContainsString('清除批量标记支付失败标记(当前筛选范围)', $html);
$this->assertStringContainsString('data-role="clear-bmpa-errors-blocked-hint"', $html);
$this->assertStringContainsString('BMPA失败', $html);
// 按钮 disabled宽松断言
$this->assertTrue(str_contains($html, 'type="submit" disabled') || str_contains($html, 'disabled="disabled"'));
}
}