Closed
Description
Current behavior:
The testscript (test.spec.js)
describe('Screenshot-Test', () => {
it('should create screenshots', () => {
cy.visit('http://localhost:8080/index.html');
cy.screenshot('a');
});
});
is executed via the module api
var cypress = require('cypress/index');
process.env.DEBUG = 'cypress:*';
cypress.run({
spec: 'cypress/integration/test.spec.js',
});
When the debug logs are activated, no screenshots are created, followed by the error message
Error: unexpected end of file
at Zlib.zlibOnError [as onerror] (zlib.js:170:17)
at Inflate._processChunk ....
Without the debug logs, creating screenshots work as expected.
Desired behavior:
Screenshots should also be created when debug logs are activated.
Versions
Cypress 4.0.2 / 4.1.0
Windows 10 / Linux
No cypress configs
Activity
jennifer-shehane commentedon Mar 9, 2020
@Konstruktour Thank you for providing a reproducible example!
I am able to recreate this.
browser: 'chrome'
tocypress.run
)This helped me narrow does the logging necessary to recreate to the specific logs from
cypress:server:browsers:electron
.This may be due to something in this diff of the
electron.coffee
file between 3.7.0 and 3.8.0. Seems to be the changes are from this PR: #5849 cc @flotwigv3.7.0...v3.8.0#diff-ab788b716b2ba4290d63618c58f3cbe4
script.js
spec.js
Logs of running
node script.js
ends up throwing errflotwig commentedon Mar 9, 2020
Starting to see this in the PR to upgrade to Electron 8 as well: #6555 According to the debug logs, for some reason,
Page.captureScreenshot
doesn't receive a response until the test times out and a secondPage.captureScreenshot
is taken (due to the failure), which seems to immediately return.Failure is only in 7_record_spec: https://circleci.com/gh/cypress-io/cypress/275151?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link
flotwig commentedon Mar 9, 2020
I see the issue. When
cypress:server:browsers:electron
's debug flag is enabled, theres
object is cloned so thatres.data
(the screenshot PNG) can be truncated for readability:cypress/packages/server/lib/browsers/electron.js
Lines 233 to 242 in 2a0bc32
However, the cloned
res
object ends up getting returned 🤦♂️ I'll open a PR to fix this.6 remaining items