Closed jordandlaman closed 6 years ago
I am going to close as this seems to be the environment I am trying to run. I solved the issue by diving further into the /pkmslogout endpoint. It was calling some adobe service that was using http.responseText and I used blacklistHosts in the cypress.json to block their endpoint. While not a fix for cypress not swallowing the error it has hacked a fix for my testing needs. From the searching I have done online I am not sure if the cypress dev team could investigate any further into this as I can't create a repo for them to diagnose (company env) . I am attempting to get my team and company to adopt cypress as their primary e2e testing framework and as such the premium support model may be in our future but not currently. Hopefully this might help anyone who runs in to a problem that is similar.
Yeah, unfortunately it is very difficult to look into an issue without a reproducible example. 🙁
hi im also facing this issue here is my code
describe('template spec', () =>{
it('passes', () => {
cy.visit('https://test.nexelus.net/Nexelus-QA-Verification')
cy.get('#ctl00_MainContentPlaceHolder_username').type('kashifh')
cy.get('#ctl00_MainContentPlaceHolder_password').type('sa')
cy.get('#aIdLoginButton')
.should("be.visible")
.click({timeout:50})
})
})
even if I visit the link it throws the error and for that i used the code but after pressing the login button im still facing this refrence error and unable to process to next screen
Cypress.on('uncaught:exception', (err, runnable) => {
// returning false here prevents Cypress from
// failing the test
return false
})
@kashif-afk This issue is specifically tracking 'http is not defined' error, which you are not seeing. The error you are seeing is being thrown from your application under test.
When executing a cy.visit(url) I am getting ReferenceError: http is not defined at XMLHttpRequest.xhttp.onreadystatechange.
I know the problem child seems to have to do with /pkmslogout but no idea why its acting like http is not defined.
Here is also the console output.
I am already catching all uncaught exceptions as well. Have tried catching this specific error with the recipe in the docs as well inside the test.
UPDATE: I have successfully gotten cypress to swallow the bug by switching the context block to a describe block and adding a before/beforeEach block right below that to register the uncaught exception to return false. For some reason this particular error is not respecting my support/index.ts files global uncaught exception handler. Attached is both my index file and the relevant describe and beforeAll block for someone to look at in case I have made a mistake somewhere that is obvious.
index.ts file:
UPDATE 2: Looks like the describe switch isn't a total fix. When that /pkms endpoint is aborted the test will pass with the exception handler but if it returns 200 http is not defined will still fail the test.