percy-cypress: Fails to POST DOM snapshot to CLI server: `TypeError: Cannot read property 'end' of undefined`
Percy snapshot seems to be failing with the following error
CypressError:
cy.then()timed out after waiting
15000ms`.
Your callback function returned a promise that never resolved.
The callback function was:
async () => { if (Cypress.config(‘isInteractive’) && !Cypress.config(‘enablePercyInteractiveMode’)) { return cylog(‘Disabled in interactive mode’, { details: ‘use “cypress run” instead of “cypress open”’, name }); }
// Check if Percy is enabled
if (!await utils.isPercyEnabled()) {
return cylog('Not running', { name });
}
// Inject @percy/dom
if (!window.PercyDOM) {
// eslint-disable-next-line no-eval
eval(await utils.fetchPercyDOM());
}
// Serialize and capture the DOM
return cy.document({ log: false }).then(dom => {
let domSnapshot = window.PercyDOM.serialize({ ...options, dom });
// Post the DOM snapshot to Percy
return utils.postSnapshot({
...options,
environmentInfo: ENV_INFO,
clientInfo: CLIENT_INFO,
domSnapshot,
url: dom.URL,
name
}).then(() => {
// Log the snapshot name on success
cylog(name, { name });
}).catch(error => {
// Handle errors
log.error(`Could not take DOM snapshot "${name}"`);
log.error(error);
});
});
}
Code:
cy.visit('/') cy.url().should('include', '/auth/signup') cy.percySnapshot()
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 26 (10 by maintainers)
On different CircleCI tab I see the same error coming from Cypress from all failing tests including that one about
Error: The name of each snapshot must be unique, and this name already exists in the build
On running with
--verbose
I could see the following extra logs apart from the ones posted above(node:13894) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'end' of undefined at IncomingMessage.request.on (*/testFilePath/node_modules/@percy/core/dist/server.js:88:69) at processTicksAndRejections (internal/process/next_tick.js:81:5) (node:13894) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:13894) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.