Skip to content

Instantly share code, notes, and snippets.

@bm2ilabs
Last active August 26, 2019 08:49
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 bm2ilabs/45d78027250dff77ae99e3892b8acc8e to your computer and use it in GitHub Desktop.
Save bm2ilabs/45d78027250dff77ae99e3892b8acc8e to your computer and use it in GitHub Desktop.
Check if selector exist Dusk Testing
<?php
use Laravel\Dusk\Browser;
use PHPUnit\Framework\Assert as PHPUnit;
Browser::macro('assertFind', function ($dom) {
$message = "Did not see expected element [{$dom}].";
if ($this->resolver->prefix) {
$message .= " within [{$this->resolver->prefix}].";
}
$element = $this->resolver->find($dom);
PHPUnit::assertNotNull($element, $message);
return $this;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment