You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Allow cy.visit to visit cross origin sites. (#23297)
* Initial async changes
* Small fixes and test updates.
* updating tests
* Fixes for cookie login tests
* remove the onlys
* Most tests passing
* Fix driver tests?
* fix firefox test?
* fix unit tests
* fix tests??
* a better check
* fix integration tests
* minor cleanup
* Comment out tyler fix for 10.0 origin issue
* also fix integration tests
* remove fixmes
* Adding Retries for cookie actions. May break other error tests.
* Address (some) PR comments
* update to warn about cross origin command AUT in assertions
* Fix type errors
* Move document.cookie patch to injection
* Adding iframe patching.
* forward errors prior to attaching
* Add error message when using visit to visit a cross origin site with the onLoad or onBeforeLoad options.
* Attempt to fix test errors.
* more fixes, but not all
* use the origin policy
* Fix types
* more fixes
* consider chromeWebSecurity when checking if you can communicate with the AUT
* firefox
* prevent hangs if before unload happens after on load.
* Fix some ToDos
* code cleanup
* remove quotes
* Code review changes
* more cr changes
* fix tests possibly
* for realz this time
* roll back change
* Fix some flake
* Fix flakey xhr test hopefully.
* oops, forgot communicator changes. need those.
* modify error message to not lose the original error
* read config right derp
* simpler check
* no unused vars
* don't put config on window
* Make isRunnerAbleToCommunicateWithTheAUT a util function instead of attaching it to cypress.
* fix a race condition maybe
* clear document when window is cross origin... we'll see if this breaks anything.
* Retry if querying against the wrong AUT
* use timeout
* Don't print the retrying string unless you're retrying due to command aut origin mismatch
* try handling undefined document
* Code review updates. What could go wrong??
* Apply suggestions from code review
Co-authored-by: Bill Glesias <[email protected]>
* minor fixes
* try aut location and move the async state collection.
* fix flake around the loading message, probably
* Fix system tests and some flake around redirect counts.
* Improve error handler prior to attaching.
* Code review suggestions
* use a generated ID when promisifying post message
* clean up promise helper
* skip xhr test until issue is resolved.
* Apply suggestions from code review
Co-authored-by: Chris Breiding <[email protected]>
* use state directly
* Apply suggestions from code review
Co-authored-by: Bill Glesias <[email protected]>
* Update packages/driver/src/cypress/error_messages.ts
Co-authored-by: Chris Breiding <[email protected]>
Co-authored-by: Bill Glesias <[email protected]>
Co-authored-by: Chris Breiding <[email protected]>
consterror=Cypress.isBrowser('firefox') ? 'Permission denied to access property "document" on cross-origin object' : 'Blocked a frame with origin "http://localhost:3500" from accessing a cross-origin frame.'
2237
-
2238
-
// When the experimentalSessionAndOrigin feature is disabled, we will immediately and display this message.
2239
-
expect(err.message).to.contain(stripIndent`\
2240
-
Cypress detected a cross origin error happened on page load:\n
2241
-
> ${error}\n
2242
-
Before the page load, you were bound to the origin policy:\n
2243
-
> http://localhost:3500\n
2244
-
A cross origin error happens when your application navigates to a new URL which does not match the origin policy above.\n
2245
-
A new URL does not match the origin policy if the 'protocol', 'port' (if specified), and/or 'host' (unless of the same superdomain) are different.\n
2246
-
Cypress does not allow you to navigate to a different origin URL within a single test.\n
2247
-
You may need to restructure some of your test code to avoid this problem.\n
2248
-
Alternatively you can also disable Chrome Web Security in Chromium-based browsers which will turn off this restriction by setting { chromeWebSecurity: false }`)
consterror=Cypress.isBrowser('firefox') ? 'Permission denied to get property "href" on cross-origin object' : 'Blocked a frame with origin "http://localhost:3500" from accessing a cross-origin frame.'
2239
+
2240
+
// When the experimentalSessionAndOrigin feature is disabled, we will immediately and display this message.
2241
+
expect(err.message).to.contain(stripIndent`\
2242
+
Cypress detected a cross origin error happened on page load:\n
2243
+
> ${error}\n
2244
+
Before the page load, you were bound to the origin policy:\n
2245
+
> http://localhost:3500\n
2246
+
A cross origin error happens when your application navigates to a new URL which does not match the origin policy above.\n
2247
+
A new URL does not match the origin policy if the 'protocol', 'port' (if specified), and/or 'host' (unless of the same superdomain) are different.\n
2248
+
Cypress does not allow you to navigate to a different origin URL within a single test.\n
2249
+
You may need to restructure some of your test code to avoid this problem.\n
2250
+
Alternatively you can also disable Chrome Web Security in Chromium-based browsers which will turn off this restriction by setting { chromeWebSecurity: false }`)
// We only need to check .get here because the other commands are chained off of it.
193
+
it('.get()',{defaultCommandTimeout: 50},(done)=>{
194
+
cy.on('fail',(err)=>{
195
+
expect(err.message).to.include(`Timed out retrying after 50ms:`)
196
+
expect(err.message).to.include(`The command was expected to run against origin \`http://localhost:3500\` but the application is at origin \`http://foobar.com:3500\`.`)
197
+
expect(err.message).to.include(`This commonly happens when you have either not navigated to the expected origin or have navigated away unexpectedly.`)
198
+
// make sure that the secondary origin failures do NOT show up as spec failures or AUT failures
199
+
expect(err.message).not.to.include(`The following error originated from your test code, not from Cypress`)
200
+
expect(err.message).not.to.include(`The following error originated from your application code, not from Cypress`)
0 commit comments