seed(); // DatabaseSeeder deliberately only seeds one admin fallback account and // no ticket data (see README) — this test needs a client and an operator // plus a ticket to exercise every page, so it creates its own on top of // the seeded reference data (categories/teams/statuses/priorities/etc). $client = User::query()->create(['name' => 'Smoke Client', 'email' => 'smoke-client@example.com', 'roles' => ['client']]); $operator = User::query()->create(['name' => 'Smoke Operator', 'email' => 'smoke-operator@example.com', 'roles' => ['operator']]); $admin = User::query()->withRole('admin')->firstOrFail(); $clientTicket = Ticket::query()->create([ 'number' => '9001', 'customer_id' => $client->id, 'email' => $client->email, 'name' => $client->name, 'subject' => 'Smoke test subject', 'body' => 'Smoke test body', 'status_key' => 'new', 'priority_key' => 'high', 'custom_fields' => [], ]); $anyTicket = $clientTicket; $this->get('/')->assertOk()->assertSee('Jak możemy pomóc'); $this->get('/login')->assertOk()->assertSee('Nowe zgłoszenie bez logowania'); $this->actingAs($client)->get('/client')->assertOk()->assertSee('Moje zgłoszenia')->assertSee('Panel Klienta'); $this->actingAs($client)->get('/client/new')->assertOk()->assertSee('Panel Klienta'); $this->actingAs($client)->get(route('client.ticket', $clientTicket))->assertOk()->assertSee($clientTicket->subject)->assertSee('Panel Klienta'); $this->actingAs($operator)->get('/operator')->assertOk()->assertSee('Otwarte')->assertSee('Panel Operatora'); $this->actingAs($operator)->get('/operator/new')->assertOk()->assertSee($client->email)->assertSee('Panel Operatora'); $this->actingAs($operator)->get(route('operator.ticket', $anyTicket))->assertOk()->assertSee($anyTicket->subject)->assertSee('Panel Operatora'); foreach (['categories', 'fields', 'users', 'teams', 'user-fields', 'reply-quick-actions', 'response-templates', 'statuses', 'priorities', 'templates', 'branding', 'config', 'about'] as $tab) { $this->actingAs($admin)->get('/admin')->assertOk()->assertSee('Panel Administratora'); Livewire::actingAs($admin)->test(Panel::class) ->call('setTab', $tab) ->assertOk(); } });