-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
TypeError: Cannot read property 'replace' of undefined" at Object.appendErrMsg #1669
Comments
Can you try adding this to your suite and seeing what the Cypress.on('fail', (err, runnable) => {
debugger
}) |
Hi @jennifer-shehane! |
@bkucera I'm not sure if you noticed, but I'm using |
@James-E-Adams I believe you are supposed to put the event listener outside of the describe. Cypress.on('fail', (err, runnable) => {
debugger
})
describe('tests', () => {
beforeEach(() => {
cy.authenticatedVisit(
'some_url'
)
})
it('draws a box', () => {})
it('potato', () => {})
it('draws a circle', () => {})
it('draws nothing', () => {})
}) Also Bkucera's suggestion's was to call Cypress.Commands.add('authenticatedVisit', url => {
cy.visit(url);
cy.window().then(window => {
window.localStorage.setItem(
'authRefreshToken',
userJames.authRefreshToken
);
window.localStorage.setItem('authAccessToken', null) //it needs this field to have an entry
});
}); I'm not sure if that would solve your problem but I hope that gives you a working alternative. |
I'm getting a similar error in 3.1.5 when trying to Inserting that on-fail debugger as you showed yields |
This issue should be fixed as part of this refactor: #3762 |
Similar to @echurilov I'm unable to call cy.setCookie() within a beforeEach: Within the Cypress window I see the error TypeError: Cannot read property 'replace' of undefined - |
Resolved my issue by trimming the response. Whitespace was being included in the body. |
The code for this is done in cypress-io/cypress#5313, but has yet to be released. |
Released in |
Current behavior:
This is a weird issue that is isolated to a single machine.
If I try run a test file with more than one or two tests, I get the following:

The stack trace:
The test spec file like:
and the
authenticatedVisit
command is:It works perfectly fine on other machines with the exact same set up.
It works fine running a single test at a time - but I'm wondering if anyone else has experienced this before?
Happy to provide any extra info if I can!
Versions
Both cypress 2.1.0 and the previous version. Mac OS 10.13.4, chrome 66.0.3359.139
The text was updated successfully, but these errors were encountered: