Skip to content
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

'Screenshot on failure' function fails when the driver reports document size as 0 #729

Closed
RaZeR-RBI opened this issue Feb 10, 2020 · 0 comments

Comments

@RaZeR-RBI
Copy link
Contributor

  • Dusk Version: 5.9.0
  • Laravel Version: 5.8.36
  • PHP Version: 7.4.1
  • Database Driver & Version: SQLite 3.8.7.1
  • Using chromium/chromedriver

Description:

TL,DR: Browser->fitToContent is missing a size validity check, and an invalid window size breaks the driver's screenshot capability.


When a test failure occurs, the test worker (by default) tries to resize the browser window in order to capture the whole page.
The problem is that sometimes the page size reported by the driver can have a dimension (or both) equal to 0 - in my case it was the filp/whoops handler, which (as it seems) relies on fixed position layout.

When any dimension of the browser window's size is set to 0, chromedriver is unable to capture a screenshot (because, well, that's impossible).
Here is how it looks like when the chromedriver's verbose logging is turned on:

[1581338013,476][INFO]: [f653fb55efd9ae2d62a31540b0b47065] RESPONSE GetElementSize {
   "height": 0,
   "width": 1920
   ...skipped...
}
[1581338013,477][INFO]: [f653fb55efd9ae2d62a31540b0b47065] COMMAND SetWindowSize {
   "height": 0,
   "width": 1920,
   "windowHandle": "current"
}

... skipped ...

[1581338013,581][DEBUG]: DevTools WebSocket Command: Page.captureScreenshot (id=708) 4C0AF02CD013BE0655BE91CBEEAF34BC {}
[1581338023,581][SEVERE]: Timed out receiving message from renderer: 10,000

Steps To Reproduce:

  1. Visit any page that has it's height reported as zero
  2. Intentionally fail the test within the code
  3. Dusk CLI hangs for several minutes and finally aborts with an timeout exception (may vary) because the driver hangs

This seems to be a simple fix, we just need to add a check here. I can do it by myself and send a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant