PHPackages                             christophrumpel/missing-livewire-assertions - 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. christophrumpel/missing-livewire-assertions

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

christophrumpel/missing-livewire-assertions
===========================================

This package adds missing livewire test assertions.

v4.0.0(2mo ago)149336.0k↑18.6%27[3 issues](https://github.com/christophrumpel/missing-livewire-assertions/issues)6MITPHPPHP ^8.1CI passing

Since Apr 20Pushed 1mo ago4 watchersCompare

[ Source](https://github.com/christophrumpel/missing-livewire-assertions)[ Packagist](https://packagist.org/packages/christophrumpel/missing-livewire-assertions)[ Docs](https://github.com/christophrumpel/missing-livewire-assertions)[ RSS](/packages/christophrumpel-missing-livewire-assertions/feed)WikiDiscussions production Synced 1mo ago

READMEChangelog (10)Dependencies (16)Versions (30)Used By (6)

[![CleanShot 2023-02-14 at 17 17 03@2x](https://user-images.githubusercontent.com/1394539/218795579-da45e8c0-2f7d-44d9-9e50-08fd8c99aa6b.png)](https://user-images.githubusercontent.com/1394539/218795579-da45e8c0-2f7d-44d9-9e50-08fd8c99aa6b.png)

This Package Adds Missing Livewire Test Assertions
==================================================

[](#this-package-adds-missing-livewire-test-assertions)

[![Latest Version on Packagist](https://camo.githubusercontent.com/0e2dc98d0fcf42ba5a8ebe24496e297e7669d25b4e3586112ab5c26f6ed34548/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6368726973746f706872756d70656c2f6d697373696e672d6c697665776972652d617373657274696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/christophrumpel/missing-livewire-assertions)[![GitHub Tests Action Status](https://camo.githubusercontent.com/cd63db49bffeaa48608e846e06dfb8b9ee90692bc937a7ac82e345282cf080e4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6368726973746f706872756d70656c2f6d697373696e672d6c697665776972652d617373657274696f6e732f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/christophrumpel/missing-livewire-assertions/actions?query=workflow%3Arun-tests+branch%3Aproduction)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/cf06cb1a1738bd1808c983337c6a214cb6e4cee45a024bec873e5720c2802b4a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6368726973746f706872756d70656c2f6d697373696e672d6c697665776972652d617373657274696f6e732f436865636b253230262532306669782532307374796c696e673f6c6162656c3d636f64652532307374796c65)](https://github.com/christophrumpel/missing-livewire-assertions/actions?query=workflow%3A%22Check+%26+fix+styling%22+branch%3Aproduction)[![Total Downloads](https://camo.githubusercontent.com/b1e785f4c4ae01b0c0bcca01de6a2f0b82aac61461ccdabd8d148c8130dafe8d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6368726973746f706872756d70656c2f6d697373696e672d6c697665776972652d617373657274696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/christophrumpel/missing-livewire-assertions)

This package adds some nice new Livewire assertions which I was missing while testing my applications using Livewire. If you want to know more about WHY I needed them, check out my [blog article](https://christoph-rumpel.com/2021/4/how-I-test-livewire-components).

➡️ `Version 2.0` of this package only supports `Livewire 3`. Please use a lower version of this package for other Livewire versions.

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

[](#installation)

You can install the package via composer:

```
composer require christophrumpel/missing-livewire-assertions
```

Usage
-----

[](#usage)

The new assertions get added automatically, so you can use them immediately.

### Check if a Livewire property is wired to an HTML field

[](#check-if-a-livewire-property-is-wired-to-an-html-field)

```
Livewire::test(FeedbackForm::class)
    ->assertPropertyWired('email');
```

It looks for a string like `wire:model="email"` in your component's view file. It also detects variations like `wire:model.live="email"`, `wire:model.lazy="email"`, `wire:model.debounce="email"`, `wire:model.lazy.10s="email"` or `wire:model.debounce.500ms="email"`.

### Check if a Livewire method is wired to an HTML field

[](#check-if-a-livewire-method-is-wired-to-an-html-field)

```
Livewire::test(FeedbackForm::class)
    ->assertMethodWired('submit');
```

It looks for a string like `wire:click="submit"` in your component's view file.

### Check if a Livewire magic action is wired to an HTML field

[](#check-if-a-livewire-magic-action-is-wired-to-an-html-field)

```
Livewire::test(FeedbackForm::class)
    ->assertMethodWired('$toggle(\'sortAsc\')');
```

### Check if a generic Livewire method is wired to an HTML field

[](#check-if-a-generic-livewire-method-is-wired-to-an-html-field)

```
Livewire::test(FeedbackForm::class)
    ->assertMethodWiredToAction('mouseenter', 'enter');
```

It looks for a string like `wire:mouseenter="enter"` in your component's view file. Also, note that it can also look for any events, like `wire:keydown` or `wire:custom-event`.

It looks for a string like `wire:click="$refresh"`, `wire:click="$toggle('sortAsc')`, `$dispatch('post-created')`, along with all other [magic actions](https://livewire.laravel.com/docs/actions#magic-actions). When testing for magic actions, you must escape single quotes like shown above.

### Check if a Livewire method is wired to an HTML form

[](#check-if-a-livewire-method-is-wired-to-an-html-form)

```
Livewire::test(FeedbackForm::class)
    ->assertMethodWiredToForm('upload');
```

It looks for a string like `wire:submit.prevent="upload"` in your component's view file.

### Check if a Livewire method is wired to a specific javascript event

[](#check-if-a-livewire-method-is-wired-to-a-specific-javascript-event)

```
Livewire::test(FeedbackForm::class)
    ->assertMethodWiredToEvent('setValue', 'change');
```

It looks for a string like `wire:change.debounce.150ms="setValue"` in your component's view file.

You can also check for actions without any additional modifiers:

```
Livewire::test(FeedbackForm::class)
    ->assertMethodWiredToEventWithoutModifiers('reset', 'keyup');
```

This will match `wire:keyup="reset"`, but not `wire:keyup.escape="reset"`. You could match that with

```
Livewire::test(FeedbackForm::class)
    ->assertMethodWiredToEventWithoutModifiers('reset', 'keyup.escape');
```

### Check if a Livewire component contains another Livewire component

[](#check-if-a-livewire-component-contains-another-livewire-component)

```
Livewire::test(FeedbackForm::class)
    ->assertContainsLivewireComponent(CategoryList::class);
```

You can use the component tag name as well:

```
Livewire::test(FeedbackForm::class)
    ->assertContainsLivewireComponent('category-list');
```

### Check if a Livewire component contains a Blade component

[](#check-if-a-livewire-component-contains-a-blade-component)

```
Livewire::test(FeedbackForm::class)
    ->assertContainsBladeComponent(Button::class);
```

You can use the component tag name as well:

```
Livewire::test(FeedbackForm::class)
    ->assertContainsBladeComponent('button');
```

### Check to see if a string comes before another string

[](#check-to-see-if-a-string-comes-before-another-string)

```
Livewire::test(FeedbackForm::class)
    ->assertSeeBefore('first string', 'second string');
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Christoph Rumpel](https://github.com/christophrumpel)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

65

—

FairBetter than 99% of packages

Maintenance89

Actively maintained with recent releases

Popularity54

Moderate usage in the ecosystem

Community34

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 53.8% 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 ~64 days

Recently: every ~125 days

Total

29

Last Release

60d ago

Major Versions

v0.7.0 → v1.0.02023-02-12

v1.0.0 → v2.0.02023-09-28

v2.11.0 → v3.0.02026-01-15

v3.0.0 → v4.0.02026-03-19

PHP version history (3 changes)v0.1.0PHP ^8.0

v0.2.2PHP ^7.4|^8.0

v2.0.0PHP ^8.1

### Community

Maintainers

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

---

Top Contributors

[![christophrumpel](https://avatars.githubusercontent.com/u/1394539?v=4)](https://github.com/christophrumpel "christophrumpel (64 commits)")[![nuernbergerA](https://avatars.githubusercontent.com/u/13331388?v=4)](https://github.com/nuernbergerA "nuernbergerA (14 commits)")[![peterfox](https://avatars.githubusercontent.com/u/1716506?v=4)](https://github.com/peterfox "peterfox (7 commits)")[![joshualukecaine](https://avatars.githubusercontent.com/u/25837573?v=4)](https://github.com/joshualukecaine "joshualukecaine (6 commits)")[![alexmanase](https://avatars.githubusercontent.com/u/10696975?v=4)](https://github.com/alexmanase "alexmanase (4 commits)")[![GertjanRoke](https://avatars.githubusercontent.com/u/6010509?v=4)](https://github.com/GertjanRoke "GertjanRoke (4 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (3 commits)")[![jonjakoblich](https://avatars.githubusercontent.com/u/106980918?v=4)](https://github.com/jonjakoblich "jonjakoblich (2 commits)")[![cheesegrits](https://avatars.githubusercontent.com/u/934456?v=4)](https://github.com/cheesegrits "cheesegrits (2 commits)")[![mpociot](https://avatars.githubusercontent.com/u/804684?v=4)](https://github.com/mpociot "mpociot (1 commits)")[![pikepa](https://avatars.githubusercontent.com/u/6476091?v=4)](https://github.com/pikepa "pikepa (1 commits)")[![squaredpx](https://avatars.githubusercontent.com/u/5882114?v=4)](https://github.com/squaredpx "squaredpx (1 commits)")[![aarongmx](https://avatars.githubusercontent.com/u/43938927?v=4)](https://github.com/aarongmx "aarongmx (1 commits)")[![titantwentyone](https://avatars.githubusercontent.com/u/1583366?v=4)](https://github.com/titantwentyone "titantwentyone (1 commits)")[![abenerd](https://avatars.githubusercontent.com/u/7523903?v=4)](https://github.com/abenerd "abenerd (1 commits)")[![bretterer](https://avatars.githubusercontent.com/u/1906920?v=4)](https://github.com/bretterer "bretterer (1 commits)")[![dostrog](https://avatars.githubusercontent.com/u/948264?v=4)](https://github.com/dostrog "dostrog (1 commits)")[![fdalcin](https://avatars.githubusercontent.com/u/1761690?v=4)](https://github.com/fdalcin "fdalcin (1 commits)")[![Ing-LuisGuerrero](https://avatars.githubusercontent.com/u/48639261?v=4)](https://github.com/Ing-LuisGuerrero "Ing-LuisGuerrero (1 commits)")[![leganz](https://avatars.githubusercontent.com/u/3373530?v=4)](https://github.com/leganz "leganz (1 commits)")

---

Tags

laravellivewirelaravelassertionslivewirechristophrumpel

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/christophrumpel-missing-livewire-assertions/health.svg)

```
[![Health](https://phpackages.com/badges/christophrumpel-missing-livewire-assertions/health.svg)](https://phpackages.com/packages/christophrumpel-missing-livewire-assertions)
```

###  Alternatives

[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.4k43.5M5.2k](/packages/larastan-larastan)[timacdonald/log-fake

A drop in fake logger for testing with the Laravel framework.

4235.9M56](/packages/timacdonald-log-fake)[spatie/laravel-mail-preview

A mail driver to quickly preview mail

1.3k419.3k5](/packages/spatie-laravel-mail-preview)[bezhansalleh/filament-google-analytics

Google Analytics integration for FilamentPHP

205144.8k5](/packages/bezhansalleh-filament-google-analytics)[encodia/laravel-health-env-vars

Custom check for Spatie's Laravel Health - Ensure every .env variable you need has been set

20143.5k](/packages/encodia-laravel-health-env-vars)[calebdw/larastan-livewire

A Larastan / PHPStan extension for Livewire.

43482.4k3](/packages/calebdw-larastan-livewire)

PHPackages © 2026

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