Created
August 26, 2019 08:47
-
-
Save bm2ilabs/88c699847870f2e604181b6da15be623 to your computer and use it in GitHub Desktop.
Find link with href Dusk
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 | |
Browser::macro('assertSeeLinkWithHref', function ($link, $href) { | |
$message = "Did not see expected link [{$link}] with href [{$href}]."; | |
if ($this->resolver->prefix) { | |
$message .= " within [{$this->resolver->prefix}]."; | |
} | |
$anchor = $this->resolver->find("a[href$='{$href}']"); | |
$hasText = $anchor && (strpos($anchor->getText(), $link) !== false); | |
PHPUnit::assertTrue($anchor && $hasText, $message); | |
return $this; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment