PHPackages                             luttje/livewire-gloom - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. luttje/livewire-gloom

ActiveLibrary[Testing &amp; Quality](/categories/testing)

luttje/livewire-gloom
=====================

Laravel Dusk helpers for working with Livewire

4.0.0(2mo ago)0345MITPHPCI passing

Since Dec 25Pushed 1w ago1 watchersCompare

[ Source](https://github.com/luttje/livewire-gloom)[ Packagist](https://packagist.org/packages/luttje/livewire-gloom)[ Docs](https://github.com/luttje/livewire-gloom)[ GitHub Sponsors](https://github.com/luttje)[ RSS](/packages/luttje-livewire-gloom/feed)WikiDiscussions livewire-v4 Synced yesterday

READMEChangelog (8)Dependencies (45)Versions (15)Used By (0)

Livewire Gloom
==============

[](#livewire-gloom)

Add functions to Laravel Dusk for working with Livewire.

[![Livewire Gloom](banner.png)](banner.png)

[![run-tests](https://github.com/luttje/livewire-gloom/actions/workflows/run-tests.yml/badge.svg)](https://github.com/luttje/livewire-gloom/actions/workflows/run-tests.yml)[![Coverage Status](https://camo.githubusercontent.com/1571fa8e73483fca3fe3e13b301d1038f6f4067745de75c0b9808339af7fbd3d/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6c7574746a652f6c697665776972652d676c6f6f6d2f62616467652e7376673f6272616e63683d6d61696e)](https://coveralls.io/github/luttje/livewire-gloom?branch=main)

Warning

This package is still in development. It is not yet ready for production use and the API may change at any time.

Provided macros
---------------

[](#provided-macros)

*The examples below test the [`NameComponent`](tests/Browser/Fixtures/NameComponent.php) Livewire component.*

### `waitUntilLivewireCommitSucceeds`

[](#waituntillivewirecommitsucceeds)

*It can be tricky to know if Livewire finished a request cycle. You can work with `$browser->pause(...)` but that's not very reliable.*

The `waitUntilLivewireCommitSucceeds` method waits until Livewire finished a request cycle for the specified method (and optionally parameters).

```
$browser->type('@name-input', 'John Doe')
    ->click('@split-button-debounced')
    ->waitUntilLivewireCommitSucceeds('splitNameParts', ['John Doe'])
    ->assertSeeIn('@first-name', 'John');
```

The above call won't match the request if the call has no parameters, or has different parameters. If you don't care about the parameters, you can omit them.

```
$browser->type('@name-input', 'John Doe')
    ->click('@split-button-debounced')
    ->waitUntilLivewireCommitSucceeds('splitNameParts')
    ->assertSeeIn('@first-name', 'John');
```

### `waitUntilLivewireCommitFails`

[](#waituntillivewirecommitfails)

The inverse of `waitUntilLivewireCommitSucceeds`.

```
$browser->type('@name-input', 'John Doe')
    ->click('@button-to-404-debounced')
    ->waitUntilLivewireCommitFails('throws404')
    ->assertSeeIn('@first-name', 'empty');
```

### `clickAndWaitUntilLivewireCommitSucceeds`

[](#clickandwaituntillivewirecommitsucceeds)

This sets up `waitUntilLivewireCommitSucceeds` to listen for a Livewire request cycle and clicks the element.

```
$parameters = ['John Doe']; // Optional, leave this out if you don't have parameters or wish to match any parameters

$browser->type('@name-input', 'John Doe')
    ->clickAndWaitUntilLivewireCommitSucceeds('@split-button-debounced', 'splitNameParts', $parameters)
    ->assertSeeIn('@first-name', 'John');
```

### `waitUntilLivewireUpdateSucceeds`

[](#waituntillivewireupdatesucceeds)

*It can be tricky to know if Livewire finished a request cycle surrounding the updating of a property. You can work with `$browser->pause(...)` but that's not very reliable.*

The `waitUntilLivewireUpdateSucceeds` method waits until Livewire finished a request cycle for the specified property keys.

```
$browser->type('@age-input', '42')
    ->click('@split-button-debounced')
    ->waitUntilLivewireUpdateSucceeds(['age'])
    ->assertSeeIn('@age', '42');
```

Or for multiple properties:

```
$browser->type('@age-input', '42')
    ->type('@job-input', 'Plumber')
    ->click('@split-button-debounced')
    ->waitUntilLivewireUpdateSucceeds(['age', 'job'])
    ->assertSeeIn('@age', '42')
    ->assertSeeIn('@job', 'Plumber');
```

*With this last example the browser will wait until an update cycle is finished in which both the `age` and `job` livewire properties are updated. If those properties are deferred (by default) then Livewire will wait a request is made. In the example above they are deferred until clicking `@split-button-debounced`.*

#### Regex matching

[](#regex-matching)

You can use Regex matching in `waitUntilLivewireUpdateSucceeds`, just start the property key with a `/` and end it with `/`:

```
$browser->type('@hobby-name-2', 'Gaming Professionally')
    ->click('@split-button-debounced')
    ->waitUntilLivewireUpdateSucceeds(['/hobbies\.[^\.]+\.name/'])
    ->assertValue('@hobby-name-2', 'Gaming Professionally');
```

### `waitUntilLivewireUpdateFails`

[](#waituntillivewireupdatefails)

The inverse of `waitUntilLivewireUpdateSucceeds`.

```
$browser->type('@age-input', '42')
    ->click('@button-to-404-debounced')
    ->waitUntilLivewireUpdateFails(['age'])
    ->assertSeeIn('@age', '-1');
```

### `clickAndWaitUntilLivewireUpdateSucceeds`

[](#clickandwaituntillivewireupdatesucceeds)

This sets up `waitUntilLivewireUpdateSucceeds` to listen for a Livewire request cycle and clicks the element.

```
$browser->type('@age-input', '42')
    ->clickAndWaitUntilLivewireUpdateSucceeds('@split-button-debounced', ['age'])
    ->assertSeeIn('@age', '42');
```

### The `action` parameter

[](#the-action-parameter)

Sometimes a sequence of actions may trigger too fast for you to listen for a Livewire commit or update:

```
// ! This test fails sometimes when the button is kinda slow. In that case the waitUntilLivewireCommitSucceeds is in time (but that's not reliable).
$browser->type('@name-input', 'John Doe')
    ->click('@split-button')
    // *🚀 hyperfast split-button somehow already completed a full commit here*
    ->waitUntilLivewireCommitSucceeds('splitNameParts', ['John Doe']) // test fails here due to timeout
    ->assertSeeIn('@first-name', 'John');
```

Because the `waitUntilLivewireCommitSucceeds` sets up the listener, it will miss the commit that happened before it was set up. The test will then fail with a timeout exception.

In such a situation you will want to be sure that before an action is started, we setup the listener. That way we don't miss the commit. To reiterate we want to:

1. **Set up the listener** for the Livewire commit
2. **Click the button** which triggers the Livewire commit
3. **Wait for the listener** to be triggered by the Livewire commit (succeeding or failing)
4. **Assert** now that we know the Livewire commit is finished

You can ensure of the above sequence by providing a closure, which we call an action. It will be executed after the listener is set up. The following functions support this:

- `waitUntilLivewireCommitSucceeds`
- `waitUntilLivewireCommitFails`
- `waitUntilLivewireUpdateSucceeds`
- `waitUntilLivewireUpdateFails`

Here is an example how you can use this `action` parameter with `waitUntilLivewireCommitSucceeds`:

```
$browser->type('@name-input', 'John Doe')
    ->waitUntilLivewireCommitSucceeds(
        'splitNameParts',
        ['John Doe'],
        action: function () use ($browser) {
            $browser->click('@split-button');
        }
    )
    ->assertSeeIn('@first-name', 'John');
```

*Internally the `clickAndWaitUntilLivewireCommitSucceeds` and `clickAndWaitUntilLivewireUpdateSucceeds` functions use the `action` parameter to call `click` on the Browser. So the above example can be simplified by using either of those functions.*

Note

All of the above examples are taken from the tests. If you want to see more code surrounding the examples, [check out those tests](tests/Browser/ReadmeExamplesTest.php).

To generate the examples, run `composer compile-readme`. This is done through [luttje/php-example-tester](https://github.com/luttje/php-example-tester).

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require luttje/livewire-gloom
```

Usage
-----

[](#usage)

Create a new Dusk test case and use the macros described above:

```
class ExampleTest extends BrowserTestCase
{
    public function testExample(): void
    {
        $this->browse(function (Browser $browser) {
            $browser->visit('/example')
                ->type('@name-input', 'John Doe')
                ->clickAndWaitUntilLivewireCommitSucceeds('@split-button', 'splitNameParts', ['John Doe'])
                ->assertSeeIn('@first-name', 'John');
        });
    }
}
```

Testing
-------

[](#testing)

Make sure you have installed the Dusk Chrome driver by running:

```
./vendor/bin/dusk-updater detect --auto-update
```

Then run the tests with:

```
composer test
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

e (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance92

Actively maintained with recent releases

Popularity12

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~120 days

Recently: every ~210 days

Total

8

Last Release

77d ago

Major Versions

0.3.2 → 3.3.32026-03-17

3.3.3 → 4.0.02026-04-18

### Community

Maintainers

![](https://www.gravatar.com/avatar/d50c11122445f7743eb6ec278ca6322a0f3d9c9296df290a66c0e5ab0df5e750?d=identicon)[luttje](/maintainers/luttje)

---

Top Contributors

[![luttje](https://avatars.githubusercontent.com/u/2738114?v=4)](https://github.com/luttje "luttje (79 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (26 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (14 commits)")

---

Tags

testinglaravellivewireduskluttje

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/luttje-livewire-gloom/health.svg)

```
[![Health](https://phpackages.com/badges/luttje-livewire-gloom/health.svg)](https://phpackages.com/packages/luttje-livewire-gloom)
```

###  Alternatives

[code-distortion/adapt

A Laravel package that builds databases for your tests, improving their speed.

2838.1k](/packages/code-distortion-adapt)[davestewart/sketchpad

An innovative front-end environment for interactive Laravel development

29512.9k1](/packages/davestewart-sketchpad)[appstract/laravel-dusk-safari

Run Dusk tests on Safari

117.9k](/packages/appstract-laravel-dusk-safari)[srlabs/laravel-testing-utilities

Helper utilities for testing Laravel Applications

1011.9k](/packages/srlabs-laravel-testing-utilities)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
