Skip to content
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

fix: Fix error when testing cross-origin code #685

Merged
merged 11 commits into from
Jul 3, 2024

Conversation

Nojay-Games
Copy link
Contributor

@Nojay-Games Nojay-Games commented Aug 19, 2023

When testing cross-origin websites with cy.origin(), the following error gets thrown:
DOMException: Blocked a frame with origin "http://localhost:3000" from accessing a cross-origin frame.
This occurs when accessing win.__coverage__ in the code. Since you don't control cross-origin code and it therefore doesn't need code coverage, you can simply ignore the code coverage if accessing win.__coverage__ throws an error.

@CLAassistant
Copy link

CLAassistant commented Aug 19, 2023

CLA assistant check
All committers have signed the CLA.

@cypress-app-bot
Copy link

@Nojay-Games Nojay-Games marked this pull request as draft August 20, 2023 12:44
@Nojay-Games Nojay-Games marked this pull request as ready for review August 20, 2023 12:44
@jennifer-shehane
Copy link
Member

@Nojay-Games Thanks for the contribution! Can you write a test to cover the logic for the fix you wrote?

@jennifer-shehane jennifer-shehane changed the title Fix error when testing cross-origin code fix: Fix error when testing cross-origin code Jan 19, 2024
@xxluke xxluke mentioned this pull request Feb 21, 2024
@JRSalica
Copy link

JRSalica commented Mar 4, 2024

That fix is what I need, there is no way to merge it into production so I can update the dependency solve the conflict I have with the library when doing my tests? thanks!

@jennifer-shehane
Copy link
Member

@Nojay-Games Will you have time to write a test for this? If the PR is incomplete, we'll have to close this.

alecmestroni
alecmestroni approved these changes May 6, 2024
@alecmestroni
Copy link

@jennifer-shehane logs are expired and i cannot understand whats wrong in tests, is ok for u to rerun the merge so we can see whats going wrong?

@jennifer-shehane
Copy link
Member

@alecmestroni I pushed an empty commit. I believe the original ask was to write a test case that tests the added behavior here. Since there's nothing confirming this fixes the behavior or prevents regressions from being introduced.

@alecmestroni
Copy link

alecmestroni commented May 8, 2024

@alecmestroni I pushed an empty commit. I believe the original ask was to write a test case that tests the added behavior here. Since there's nothing confirming this fixes the behavior or prevents regressions from being introduced.

@jennifer-shehane Sadly its not an error during the test but its a permission bug related to the account used

Run snyk test --all-projects --detection-depth=4 --exclude=docker,Dockerfile,test-apps --severity-threshold=critical
`snyk` requires an authenticated account. Please run `snyk auth` and try again.
Error: Process completed with exit code 2.

@jennifer-shehane
Copy link
Member

@alecmestroni Yah, the snyk failure can be ignored. It doesn't run properly for contributors.

@alecmestroni
Copy link

@alecmestroni Yah, the snyk failure can be ignored. It doesn't run properly for contributors.

@jennifer-shehane so tests are passing and merge can be applied

@jennifer-shehane
Copy link
Member

@alecmestroni There is no test for the change in behavior here verifying the behavior at all.

@alecmestroni
Copy link

@jennifer-shehane test added Nojay-Games#1

@mschile mschile self-requested a review June 4, 2024 15:37
@alecmestroni
Copy link

@jennifer-shehane any news?

@jennifer-shehane
Copy link
Member

@alecmestroni - @mschile is assigned to review this is he finds some extra time. Thanks for your patience.

@alecmestroni
Copy link

@jennifer-shehane he has done the changing. please approve them

@lhimstedt
Copy link

@Nojay-Games thank you for this one, I just found this problem and it's super annyoing! @alecmestroni and thank you for the tests!

@jennifer-shehane could you push this?

@mschile
Copy link
Contributor

mschile commented Jul 2, 2024

@alecmestroni and @lhimstedt, the tests are failing, so I still need to investigate that before this PR can be merged.

@mschile mschile merged commit aaf6ad0 into cypress-io:master Jul 3, 2024
23 of 24 checks passed
@cypress-app-bot
Copy link

🎉 This PR is included in version 3.12.40 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cross-origin not working
9 participants