Hello,
The following line:
var link = $("{$selector}");
in Laravel\Dusk\Concerns\MakesAssertions's seeLink() function is problematic for projects that do not use jQuery as developers will be presented with Facebook\WebDriver\Exception\UnknownServerException: unknown error: $ is not defined.
Would it be possible to remove the jQuery dependency with native javascript?
Hacking on it a bit and it's possible to do something like:
$script = <<<JS
return Array.prototype.slice.call(document.querySelectorAll('a')).some(function(element){return element.innerHTML === '$link'});
JS;
I can work on a PR if you think it's worth it.
I know this is closed, but I think one should use vanilla JS instead of pulling in JQuery. JQuery might break, in rare cases, someones application, and it's a lot of JS just to grab a link.
If someone can PR a Vanilla JS implementation that works in a sample test I will merge it.
Most helpful comment
I know this is closed, but I think one should use vanilla JS instead of pulling in JQuery. JQuery might break, in rare cases, someones application, and it's a lot of JS just to grab a link.