I'm running Dusk tests via Chrome on a 27" iMac, which automatically opens Chrome filling the entire left-hand side of the screen. Errors appear normally within Chrome, but the screenshots of those errors are badly cropped when saved by Dusk - with about half of the left side of the screenshot chopped off.
I'm aware that WebDriver has a Chrome flag available, --start-maximized, but I can't figure out where to put it within Dusk to have any effect.
Is this a known bug with Dusk, or if not, where would I go adding the --start-maximized option to have any effect?
Try this in your DuskTestCase.php:
protected function driver()
{
$options = new ChromeOptions();
// for windows you should use --start-maximized key here
$options->addArguments(['--kiosk']);
$capabilities = DesiredCapabilities::chrome();
$capabilities->setCapability(ChromeOptions::CAPABILITY, $options);
return RemoteWebDriver::create(
'http://localhost:9515',
$capabilities
);
}
@novitskiy-aleksei Nice one - that does the trick. Thanks for your help!
Most helpful comment
Try this in your DuskTestCase.php: