-
Notifications
You must be signed in to change notification settings - Fork 323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Screenshots cropped when test fails within an iframe #715
Comments
did this start happening recently? I'm curious if maybe my auto-resizing PR has something to do with this. Could you try adding this to your test, and see if it still happens? $browser->disableFitOnFailure(); |
Regression confirmed. It works if I use v5.6.3 or |
@browner12 I don't see how that pr could cause this? It's a totally opt-in feature? |
You can opt to You can opt out of it globally by overriding the Browser and setting The underlying I was under the assumption that I think I can debug and fix this rather quickly so we don't have to revert the PR. I'll get back to you ASAP. |
Perfect 👍 |
I have run some tests, and the existing code seems to be behaving fine with one or even multiple Here's the simplified view I used: <html>
<body>
<iframe id="one" src="https://laravel.com" height="300px" width="700px"></iframe>
<iframe id="two" src="https://laravel.com" height="500px" width="200px"></iframe>
</body>
</html> and the Dusk test I used: public function testExample()
{
$this->browse(function (Browser $browser) {
$browser->visit('/test');
$body = $browser->driver->findElement(WebDriverBy::tagName('body'));
echo "\r\n" . 'Width: ' . $body->getSize()->getWidth();
echo "\r\n" . 'Height: ' . $body->getSize()->getHeight();
$browser->fitContent()
->screenshot('test')
->with('#one', function ($firstIframe) {
$firstIframe->assertSee('laravel');
})
->assertSee('dne');
});
} @alecpl could you please share your View and Test so we can see if there's anything unique to your code? |
As I said my code uses |
Description:
When a test within an iframe fails the screenshot is cropped. It looks like it contains the main window, but resized to the size of an iframe. Or maybe it loads the main page into the iframe and makes screenshot of that.
Steps To Reproduce:
Create a page with an iframe which is e.g. 50% of the screen. and a failing assertion inside
withinFrame
method.The text was updated successfully, but these errors were encountered: