Skip to content

Livewire phpunit tests #476

Answered by kolydart
kolydart asked this question in Q&A
Discussion options

You must be logged in to vote

Ok, it seems pretty intuitive. I think I have found the way:

$item = Item::factory()->create();
Livewire::test(Items::class)
  ->assertSee($item->id)
  ->set('search', $item->title)
  ->assertSee($item->id)
  ->set('search', 'notexists')
  ->assertDontSee($item->title)
  ->set('search', '')
  ->assertSee($item->id)
  ->set('filters.input_text.items.id',$item->id)
  ->assertSee($item->id)
  ->set('filters.input_text.items.id','notexists')
  ->assertDontSee($item->title)
  ;

Could somebody confirm I am on the right path?
thanks

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by kolydart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant