Files
pricebuddy/tests/Feature/Filament/StoreAvailabilitySchemaOrgTest.php
Jeremy e56eac068c feat: schema.org availability inference and deterministic-first self-healing
Infer availability from schema.org StockStatus via a type-aware
resolveAvailability, hiding the match-values UI when the type is
schema.org and labelling inferred results in the test modal.

- AutoCreateStore::detect uses schema.org availability
- Try deterministic heuristics before escalating to the AI agent,
  with browser escalation when needed
- Match schema.org Product @type case-insensitively (and array types)
- Suppress intermediate scrape error toasts during create/self-heal
2026-06-09 15:07:40 +10:00

36 lines
1.0 KiB
PHP

<?php
namespace Tests\Feature\Filament;
use App\Filament\Resources\StoreResource\Pages\EditStore;
use App\Models\Store;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Livewire\Livewire;
use Tests\TestCase;
class StoreAvailabilitySchemaOrgTest extends TestCase
{
use RefreshDatabase;
protected function setUp(): void
{
parent::setUp();
$this->actingAs(User::factory()->create(['email' => 'test@test.com']));
}
public function test_match_values_hidden_for_schema_org_and_shown_for_selector(): void
{
$store = Store::factory()->create([
'scrape_strategy' => ['availability' => ['type' => 'selector', 'value' => '.stock']],
]);
Livewire::test(EditStore::class, ['record' => $store->getKey()])
->assertSee('Match values')
->assertSee('Default status')
->set('data.scrape_strategy.availability.type', 'schema_org')
->assertDontSee('Match values')
->assertDontSee('Default status');
}
}