When page has style rule background-image: url();
Cypress fails with:
SecurityError: Blocked a frame with origin "http://your.page.dev" from accessing a cross-origin frame.
For sure better messaging what's the problem, it was very hard to find the source of this issue in a working full app.
Then again there is a question, why this error happens in Cypress ? Cypress should not fail as there is no such error on tested page when browsed separately.
<html>
<body>
<div>
<style> .headerstrip { background-image: url(); } </style>
<div class='headerstrip'>abc</div>
</div>
</body>
</html>
describe('cypress error', () => {
beforeEach(() => {
cy.visit([page address])
})
it('should not fail', () => {
})
})
Please look into our workarounds with cross origin errors here: https://on.cypress.io/web-security#Common-Workarounds
Also, look into upgrading to version 0.20.0 as there were a lot of technical improvements.
When is this actually erroring? And can you provide an example of the background-url
?
When Cypress runs it runs on the same domain as your app expects, so it avoids most cross origin errors.
However we do special stuff when we restore snapshots and should handle this situation.
Is this problem occuring during snapshot handling or somewhere else? Can you provide a screenshot
@brian-mann the point is that is happening when url()
is empty in background-image
exactly as in the example. The example given is the minimal code to reproduce the error. It is also occurring for 0.20.0
The error disappears when I remove background-image: url();
css rule. Happens also for headless run. This was run on 0.20.0
. Also found out that after adding background-image: url();
need to rerun tests 2 times, to start failing (like it is caching previous working run at some point)
I'm facing the same issue in Out-System application. I would really appreciate if any has solution or any workaround for this issue ?
same issue here
I got around this by setting in cypress.json
:
{
...
"chromeWebSecurity": false
}
and reading best-practices really helped :)
I'm unable to recreate this in version 3.4.0. Closing as resolved. Please comment if you are still having this issue and we will consider reopening.
Most helpful comment
I got around this by setting in
cypress.json
:and reading best-practices really helped :)