<?php

namespace Tests\Browser;

use Laravel\Dusk\Browser;
use Tests\DuskTestCase;

class ItemCategoriesUiTest extends DuskTestCase
{
    public function test_item_category_create(): void
    {
        $this->browse(function (Browser $browser) {
            $user = \App\Models\User::where('email', 'owner@erp.local')->first();

            if ($user) { $user->forceFill(['email_verified_at'=>now(),'is_active'=>1])->save(); }

            $browser->loginAs($user)
                ->visit('/item-categories/create')
                ->waitFor('form', 10)
                ->type('#name', 'Dusk Category '.uniqid())
                ->press('Create')
                ->waitForLocation('/item-categories', 10);
        });
    }
}


