seedLookupData(); $admin = $this->admin(['name' => 'Settings Admin']); $this->browse(function (Browser $browser) use ($admin): void { $browser->loginAs($admin) ->visitRoute('helpdesk.settings') ->waitFor('@helpdesk-settings-manager') ->assertSee('Support configuration') ->assertSourceHas('Statuses') ->assertSourceHas('Priorities') ->assertSourceHas('Categories') ->assertSourceHas('Teams') ->assertSourceHas('Projects') ->assertSourceHas('Git') ->assertSourceHas('Workflow') ->assertSourceHas('Canned') ->assertSourceHas('SLA') ->assertSourceHas('Rules') ->assertSourceHas('Checks') ->assertSourceHas('Tags') ->assertSourceHas('Products'); $this->openSettingsSection($browser, 'Git', 'Git repositories'); $browser->assertSee('Remote URL'); $this->openSettingsSection($browser, 'Workflow', 'Workflow messages'); $browser->assertSee('HTML email body'); $this->openSettingsSection($browser, 'Canned', 'Canned responses'); $browser->assertSee('Reply body'); $this->openSettingsSection($browser, 'SLA', 'SLA policies'); $browser->assertSee('First response minutes'); $this->openSettingsSection($browser, 'Rules', 'Email automation rules'); $browser->assertSee('Subject contains'); $this->openSettingsSection($browser, 'Checks', 'Checklist templates'); $browser->assertSee('Checklist items'); $this->openSettingsSection($browser, 'Tags', 'Ticket tags'); $browser->assertSee('Colour'); $this->openSettingsSection($browser, 'Products', 'Products and services'); $browser->assertSee('Release/build'); }); } /** * Click a visible Helpdesk settings section card by its rendered label. * * This intentionally exercises the real UI instead of mutating Livewire internals. */ private function openSettingsSection(Browser $browser, string $label, string $expectedText): void { $encodedLabel = json_encode($label, JSON_THROW_ON_ERROR); $browser->script(<< { const text = candidate.textContent.replace(/\s+/g, ' ').trim(); return text === {$encodedLabel} || text.startsWith({$encodedLabel} + ' '); }); if (! button) { throw new Error('Helpdesk settings section button was not found: ' + {$encodedLabel}); } button.click(); JS); $browser->waitForText($expectedText, 10); } }