When I use a component and a $browser->within(new MyComponent, . . .), I'm always getting an error:
public function test_dashboard_available()
{
$this->browse(function (Browser $browser) {
$browser->within((new Multiselect('#search-status-selector')), function ($browser) {
$browser->clickOption(3);
});
});
}
Resulting in:
Error: Call to a member function collect() on null
/home/vagrant/code/dusk-dashboard/src/Dusk/Concerns/MakesAssertions.php:262
/home/vagrant/code/a-nice-project/tests/Browser/Components/Bootstrap/Multiselect.php:39
I can work around the bug by passing the BrowserActionCollector through from the test case, and then calling setActionCollector myself before the component uses the browser instance, but this is kinda gross.
When I use a component and a
$browser->within(new MyComponent, . . .)
, I'm always getting an error:Resulting in:
I think the problem is that the Laravel\Dusk\Browser is just doing a
new static()
to make a Browser for the component -- it doesn't know that it needs to callsetActionCollector()
.I can work around the bug by passing the
BrowserActionCollector
through from the test case, and then callingsetActionCollector
myself before the component uses the browser instance, but this is kinda gross.I'm not sure what the right way to solve this is!