Skip to content

Instantly share code, notes, and snippets.

@uno-de-piera
Created May 31, 2020 08:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uno-de-piera/c2f916057a1807297689ed4dcfc804b2 to your computer and use it in GitHub Desktop.
Save uno-de-piera/c2f916057a1807297689ed4dcfc804b2 to your computer and use it in GitHub Desktop.
<?php
public function testDatatablesSearchable()
{
factory(User::class, 10)->create();
$userToLogin = User::find(2);
$userToSearch = User::find(8);
$this->browse(function (Browser $browser) use($userToLogin, $userToSearch)
{
$browser->loginAs($userToLogin)
->visit('/users/datatables')
->pause(1000) //peticiones ajax
->with('.table', function ($table) use ($userToSearch)
{
$table->assertDontSee($userToSearch->email);
})
->type('input[type=search]', $userToSearch->name)
->pause(500)
->with('.table', function (Browser $table) use ($userToSearch)
{
$table->assertSee($userToSearch->email);
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment