TypeError: Cannot read property 'replace' of undefined" at Object.appendErrMsg
See original GitHub issueCurrent 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:
TypeError: Cannot read property 'replace' of undefined
Because this error occurred during a 'before each' hook we are skipping the remaining tests in the current suite: 'bulk actions'
at Object.appendErrMsg (http://localhost:3000/__cypress/runner/cypress_runner.js:66723:23)
at Runner.<anonymous> (http://localhost:3000/__cypress/runner/cypress_runner.js:65768:20)
at Runner.EventEmitter.emit (http://localhost:3000/__cypress/runner/cypress_runner.js:28665:13)
at Runner.fail (http://localhost:3000/__cypress/runner/cypress_runner.js:65066:17)
at Runner.failHook (http://localhost:3000/__cypress/runner/cypress_runner.js:33083:8)
at http://localhost:3000/__cypress/runner/cypress_runner.js:33128:16
at http://localhost:3000/__cypress/runner/cypress_runner.js:65918:11
From previous event:
at onNext (http://localhost:3000/__cypress/runner/cypress_runner.js:65917:57)
at done (http://localhost:3000/__cypress/runner/cypress_runner.js:32741:5)
at Hook.Runnable.run (http://localhost:3000/__cypress/runner/cypress_runner.js:32776:5)
at http://localhost:3000/__cypress/runner/cypress_runner.js:65936:28
From previous event:
at Object.onRunnableRun (http://localhost:3000/__cypress/runner/cypress_runner.js:65935:20)
at $Cypress.action (http://localhost:3000/__cypress/runner/cypress_runner.js:61399:51)
at Hook.Runnable.run (http://localhost:3000/__cypress/runner/cypress_runner.js:65075:20)
at next (http://localhost:3000/__cypress/runner/cypress_runner.js:33119:10)
at http://localhost:3000/__cypress/runner/cypress_runner.js:33141:5
at timeslice (http://localhost:3000/__cypress/runner/cypress_runner.js:28382:27)
The test spec file like:
describe('tests', () => {
beforeEach(() => {
cy.authenticatedVisit(
'some_url'
)
})
it('draws a box', () => {})
it('potato', () => {})
it('draws a circle', () => {})
it('draws nothing', () => {})
})
and the authenticatedVisit
command is:
Cypress.Commands.add('authenticatedVisit', url => {
cy.visit(url, {
onBeforeLoad() {
window.localStorage.setItem(
'authRefreshToken',
userJames.authRefreshToken
)
window.localStorage.setItem('authAccessToken', null) //it needs this field to have an entry
},
})
})
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
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (2 by maintainers)
Top Results From Across the Web
TypeError: Cannot read property 'replace' of undefined
I have been trying to make my first express application and I have been getting a error with range.replace() ...
Read more >TypeError: Cannot read property 'replace' of undefined
but I get the error “TypeError: Cannot read property 'replace' of undefined” when I do this: const img_url = resultTitle.attr("src").replace(" ...
Read more >[SOLVED] Cannot Read Property 'replace' of Undefined in JS
This error occurs when you attempt to call the replace() method on a variable that has a value of undefined . const str...
Read more >Cannot read property 'replace' of undefined error
Hi everyone, I am trying to run the GetStream/stream-nodejs example app of getStream.io . But I am facing the following error. var STREAM_URL...
Read more >TypeError: Cannot read property 'replace' of undefined
Issue Description Not able to upload package in ORchestrator Production server - Receiving error “TypeError: Cannot read property 'replace' ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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 -
I’m getting a similar error in 3.1.5 when trying to
cy.setCookie
in a before:TypeError: Cannot read property 'replace' of undefined"
atObject.appendErrMsg
Inserting that on-fail debugger as you showed yields
err = Error
andrunnable.trace.message = "Error: done() called multiple times"
at Hook.Runnable