Last active
August 26, 2019 08:49
-
-
Save bm2ilabs/45d78027250dff77ae99e3892b8acc8e to your computer and use it in GitHub Desktop.
Check if selector exist Dusk Testing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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