{"_id":"56b3a7de0e4c450d00699d22","category":{"_id":"5696c1168560a60d00e2c1d6","__v":9,"pages":["5696c11aaa12bc0d0050332c","5696c11aaa12bc0d0050332d","5696c11a8400d52d00dd5631","5696c11a59a6692d003fad06","56a007d14583912300b5efcf","56a007d166c8420d00d7fc7c","56a6824e683cfb0d00dc586f","56b383fe3ccec63700a7ac1c","56b3a7de0e4c450d00699d22"],"project":"568fde81b700ce0d002f4b43","version":"56954a94fe18811700c9bfda","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-01-13T21:26:46.069Z","from_sync":false,"order":5,"slug":"references","title":"References"},"user":"568fffce769f210d0013258f","project":"568fde81b700ce0d002f4b43","parentDoc":null,"version":{"_id":"56954a94fe18811700c9bfda","project":"568fde81b700ce0d002f4b43","__v":6,"createdAt":"2016-01-12T18:48:52.007Z","releaseDate":"2016-01-12T18:48:52.007Z","categories":["56954a95fe18811700c9bfdb","56954a95fe18811700c9bfdc","56954a95fe18811700c9bfdd","56954a95fe18811700c9bfde","56954a95fe18811700c9bfdf","56954a95fe18811700c9bfe0","56954a95fe18811700c9bfe1","56954a95fe18811700c9bfe2","56954a95fe18811700c9bfe3","56954a95fe18811700c9bfe4","5695649fdcaf0d1700cb8721","5696c1168560a60d00e2c1d6","56a7a32e79395317007c1ad6","5898fc3eec49fb0f004c2663","589cc675ea37da23004e05e1"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"foo","version_clean":"0.0.0","version":"0.0"},"__v":0,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-02-04T19:34:54.062Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"auth":"required","params":[],"url":""},"isReference":false,"order":3,"body":"# Contents\n\n- :fa-angle-right: [Missing Commands](#section-missing-dom-action-commands)\n  - [Right click](#section-right-click)\n  - [Hover](#section-hover)\n- :fa-angle-right: [Difficult use cases](#section-missing-dom-action-commands)\n  - [Iframes](#section-iframes)\n  - [OAuth](#section-oauth)\n  - [window.fetch](#section-window-fetch-routing-and-stubbing)\n\n***\n\n# Missing Commands\n\nSome commands have not been implemented in Cypress. Some commands will be implemented in the future and some do not make sense to implement in Cypress.\n\n***\n\n## Right click\n\n[Issue #53](https://github.com/cypress-io/cypress/issues/53)\n\n**Workaround**\n\nOftentimes you can use [`cy.invoke`](https://on.cypress.io/api/invoke) or [`cy.wrap`](https://on.cypress.io/api/wrap) to trigger the event or execute the action in the DOM.\n\n**Example of right clicking on an element using jQuery**\n[block:code]\n{\n    \"codes\": [\n        {\n            \"code\": \"cy.get(\\\"#nav\\\").first().invoke(\\\"trigger\\\", \\\"contextmenu\\\")\\n\",\n            \"language\": \"javascript\"\n        }\n    ]\n}\n[/block]\n\n**Example of right clicking on an element without jQuery**\n[block:code]\n{\n    \"codes\": [\n        {\n            \"code\": \"// need to create the event to later dispatch\\nvar e = new Event('contextmenu', {bubbles: true, cancelable: true})\\n// set coordinates of click\\ne.clientX = 451\\ne.clientY = 68\\n\\ncy\\n  .get(\\\"#nav\\\").first().then(function($el) {\\n    $el[0].dispatchEvent(e)\\n  })\\n\",\n            \"language\": \"javascript\"\n        }\n    ]\n}\n[/block]\n\n***\n\n## Hover\n\n[Issue #10](https://github.com/cypress-io/cypress/issues/10)\n\nSometimes an element has specific logic on hover. Maybe the element doesn't even display to be clickable until you hover over a specific element.\n\n**Workaround**\n\nOftentimes you can use [`cy.invoke`](https://on.cypress.io/api/invoke) or [`cy.wrap`](https://on.cypress.io/api/wrap) to show the element before you perform the action.\n\n**Example of showing an element in order to perform action**\n[block:code]\n{\n    \"codes\": [\n        {\n            \"code\": \"cy.get(\\\".content\\\").invoke(\\\"show\\\").click()\\n\",\n            \"language\": \"javascript\"\n        }\n    ]\n}\n[/block]\n\nYou can also force the action to be performed on the element regardless of whether the element is visible or not.\n\n**Example of clicking on a hidden element**\n[block:code]\n{\n    \"codes\": [\n        {\n            \"code\": \"cy.get(\\\".content\\\").click({force: true})\\n\",\n            \"language\": \"javascript\"\n        }\n    ]\n}\n[/block]\n\n**Example of checking a hidden element**\n[block:code]\n{\n    \"codes\": [\n        {\n            \"code\": \"cy.get(\\\".checkbox\\\").check({force: true})\\n\",\n            \"language\": \"javascript\"\n        }\n    ]\n}\n[/block]\n\n***\n\n# Difficult use cases\n\nCypress does not support the following use cases.\n\n## Iframes\n\n[Issue #136](https://github.com/cypress-io/cypress/issues/136)\n\nYou cannot target elements or interact with anything in an iframe - regardless of it being a same domain or cross domain iframe.\n\nThis is actively being worked on in Cypress and you'll first see support for same domain iframes, followed by cross domain (they are much harder to do).\n\n**Workaround**\n\nSit tight, comment on the issue so we know you care about this support, and be patient.\n\n***\n\n## OAuth\n\nThis is related to the iframe issue above, but basically `oauth` usually will not work. This is one of the hardest things for Cypress to be able to handle as there are so many different implementations and mechanisms.\n\nLikely we will be able to support server side oauth redirects, but for client side popups you'll simply use `sinon` and `stub` the oauth response directly in your code. This is actually possible to do right now but we don't have any good docs or tutorials on it.\n\n**Workaround**\n\n[Come into Gitter](https://gitter.im/cypress-io/cypress) and talk to us about what you're trying to do. We'll tell you if you're able to mock this and how to do it.\n\n***\n\n## window.fetch routing and stubbing\n\n[Issue #95](https://github.com/cypress-io/cypress/issues/95)\n\nSupport for `fetch` has not been added but it's possible to handle in the same way as we handle `XHRs`. This biggest challenge here is that you can use `fetch` in `Service Workers` outside of the global context. We'll likely have to move routing to the server and handle it in the proxy layer but it should be possible.\n\nWhile we currently provide things like the stack trace and initiator line for XHR's we will not be able to provide that for `fetch`.\n\n**Workaround**\n\nSit tight, comment on the issue so we know you care about this support, and be patient.","excerpt":"Known issues which cause problems in Cypress","slug":"known-issues","type":"basic","title":"Known Issues"}

Known Issues

Known issues which cause problems in Cypress

# Contents - :fa-angle-right: [Missing Commands](#section-missing-dom-action-commands) - [Right click](#section-right-click) - [Hover](#section-hover) - :fa-angle-right: [Difficult use cases](#section-missing-dom-action-commands) - [Iframes](#section-iframes) - [OAuth](#section-oauth) - [window.fetch](#section-window-fetch-routing-and-stubbing) *** # Missing Commands Some commands have not been implemented in Cypress. Some commands will be implemented in the future and some do not make sense to implement in Cypress. *** ## Right click [Issue #53](https://github.com/cypress-io/cypress/issues/53) **Workaround** Oftentimes you can use [`cy.invoke`](https://on.cypress.io/api/invoke) or [`cy.wrap`](https://on.cypress.io/api/wrap) to trigger the event or execute the action in the DOM. **Example of right clicking on an element using jQuery** [block:code] { "codes": [ { "code": "cy.get(\"#nav\").first().invoke(\"trigger\", \"contextmenu\")\n", "language": "javascript" } ] } [/block] **Example of right clicking on an element without jQuery** [block:code] { "codes": [ { "code": "// need to create the event to later dispatch\nvar e = new Event('contextmenu', {bubbles: true, cancelable: true})\n// set coordinates of click\ne.clientX = 451\ne.clientY = 68\n\ncy\n .get(\"#nav\").first().then(function($el) {\n $el[0].dispatchEvent(e)\n })\n", "language": "javascript" } ] } [/block] *** ## Hover [Issue #10](https://github.com/cypress-io/cypress/issues/10) Sometimes an element has specific logic on hover. Maybe the element doesn't even display to be clickable until you hover over a specific element. **Workaround** Oftentimes you can use [`cy.invoke`](https://on.cypress.io/api/invoke) or [`cy.wrap`](https://on.cypress.io/api/wrap) to show the element before you perform the action. **Example of showing an element in order to perform action** [block:code] { "codes": [ { "code": "cy.get(\".content\").invoke(\"show\").click()\n", "language": "javascript" } ] } [/block] You can also force the action to be performed on the element regardless of whether the element is visible or not. **Example of clicking on a hidden element** [block:code] { "codes": [ { "code": "cy.get(\".content\").click({force: true})\n", "language": "javascript" } ] } [/block] **Example of checking a hidden element** [block:code] { "codes": [ { "code": "cy.get(\".checkbox\").check({force: true})\n", "language": "javascript" } ] } [/block] *** # Difficult use cases Cypress does not support the following use cases. ## Iframes [Issue #136](https://github.com/cypress-io/cypress/issues/136) You cannot target elements or interact with anything in an iframe - regardless of it being a same domain or cross domain iframe. This is actively being worked on in Cypress and you'll first see support for same domain iframes, followed by cross domain (they are much harder to do). **Workaround** Sit tight, comment on the issue so we know you care about this support, and be patient. *** ## OAuth This is related to the iframe issue above, but basically `oauth` usually will not work. This is one of the hardest things for Cypress to be able to handle as there are so many different implementations and mechanisms. Likely we will be able to support server side oauth redirects, but for client side popups you'll simply use `sinon` and `stub` the oauth response directly in your code. This is actually possible to do right now but we don't have any good docs or tutorials on it. **Workaround** [Come into Gitter](https://gitter.im/cypress-io/cypress) and talk to us about what you're trying to do. We'll tell you if you're able to mock this and how to do it. *** ## window.fetch routing and stubbing [Issue #95](https://github.com/cypress-io/cypress/issues/95) Support for `fetch` has not been added but it's possible to handle in the same way as we handle `XHRs`. This biggest challenge here is that you can use `fetch` in `Service Workers` outside of the global context. We'll likely have to move routing to the server and handle it in the proxy layer but it should be possible. While we currently provide things like the stack trace and initiator line for XHR's we will not be able to provide that for `fetch`. **Workaround** Sit tight, comment on the issue so we know you care about this support, and be patient.