extend(TestCase::class)->in('Feature', 'Browser'); /** * The element name (under `<`) and the attributes of the first tag in a rendered component, by * name; a boolean attribute Blade renders as `name="name"`. For the layout components' render * tests, which assert what their root carries. * * @return array */ function layoutRoot(string $html): array { preg_match('/^\s*<([a-z]+)\b([^>]*)>/s', $html, $tag); preg_match_all('/([\w:.@-]+)(?:="([^"]*)")?/', $tag[2] ?? '', $pairs, PREG_SET_ORDER); return ['<' => $tag[1] ?? ''] + collect($pairs)->mapWithKeys(fn (array $pair): array => [$pair[1] => $pair[2] ?? ''])->all(); } // A shared CI runner is slower than a workstation: an animation or a smooth scroll can take longer // than the default five seconds to settle there. BROWSER_TIMEOUT (milliseconds) raises the limit. if (($timeout = (int) getenv('BROWSER_TIMEOUT')) > 0) { pest()->browser()->timeout($timeout); }