Created
July 15, 2020 18:49
-
-
Save jhoff/4b83b7dc39ffc3e8c3c7c808c2dedd0c to your computer and use it in GitHub Desktop.
Revisions
-
jhoff created this gist
Jul 15, 2020 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ <?php use Laravel\Dusk\Browser; Browser::macro('waitUntilWire', function ($component, $key, $value, $seconds = null) { return $this->waitUsing($seconds, 100, function () use ($component, $key, $value) { return $value == $this->wireAttribute($component, $key); }); }); Browser::macro('waitUntilWireNot', function ($component, $key, $value, $seconds = null) { return $this->waitUsing($seconds, 100, function () use ($component, $key, $value) { return $value != $this->wireAttribute($component, $key); }); }); Browser::macro('wireAttribute', function ($component, $key) { return $this->driver->executeScript(' return (component = window._.first(window._.filter(window.livewire.components.components(), {name: "' . $component . '"}))) ? component.data["' . $key . '"] : undefined; '); });