Skip to content

Commit

Permalink
Add experimentalFetchPolyfill docs (#2881) (#2887)
Browse files Browse the repository at this point in the history
Co-authored-by: Gleb Bahmutov <gleb.bahmutov@gmail.com>
  • Loading branch information
jennifer-shehane and bahmutov authored Jun 16, 2020
1 parent dc1c967 commit 9b62470
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions source/_partial/network_stubbing_warning.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{% note danger %}
🚨 Please be aware that Cypress only currently supports intercepting XMLHttpRequests. **Requests using the Fetch API and other types of network requests like page loads and `<script>` tags will not be intercepted or visible in the Command Log.** See {% issue 95 %} for more details and temporary workarounds.
{% endnote %}
🚨 Please be aware that Cypress only currently supports intercepting XMLHttpRequests. **Requests using the Fetch API and other types of network requests like page loads and `<script>` tags will not be intercepted or visible in the Command Log.** See {% issue 95 %} for more details and temporary workarounds. You can automatically polyfill `window.fetch` to spy on and stub requests by enabling an [experimental](https://on.cypress.io/experimental) feature `experimentalFetchPolyfill`.
{% endnote %}
2 changes: 2 additions & 0 deletions source/guides/references/experiments.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Option | Default | Description
`experimentalComponentTesting` | `false` | When set to `true`, Cypress allows you to execute component tests using framework-specific adaptors. By default `cypress/component` is the path for component tests. You can change this setting by setting the `componentFolder` configuration option. For more details see the {% url "cypress-react-unit-test" https://github.com/bahmutov/cypress-react-unit-test %} and {% url "cypress-vue-unit-test" https://github.com/bahmutov/cypress-vue-unit-test %} repos.
`experimentalSourceRewriting` | `false` | Enables AST-based JS/HTML rewriting. This may fix issues caused by the existing regex-based JS/HTML replacement algorithm. See {% issue 5273 %} for details.
`experimentalShadowDomSupport` | `false` | Enables shadow DOM support. Adds the `cy.shadow()` command and the `includeShadowDom` option to some DOM commands.
`experimentalFetchPolyfill` | `false` | Automatically replaces `window.fetch` with a polyfill that Cypress can spy on and stub.

# Component Testing

Expand Down Expand Up @@ -117,6 +118,7 @@ cy.get('.container .my-button', { includeShadowDom: true })
In the selector `.container .my-button`, the first part (`.container`) exists in the light DOM and the second part (`.my-button`) exists in the shadow DOM. This will not find the button element. Instead, you can use one of the methods in the above examples.

{% history %}
{% url "4.9.0" changelog#4-9-0 %} | Added support for `experimentalFetchPolyfill`.
{% url "4.8.0" changelog#4-8-0 %} | Added support for `experimentalShadowDomSupport`.
{% url "4.6.0" changelog#4-6-0 %} | Added support for `experimentalSourceRewriting`.
{% url "4.5.0" changelog#4-5-0 %} | Added support for `experimentalComponentTesting`.
Expand Down
2 changes: 1 addition & 1 deletion source/guides/references/trade-offs.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Many of these issues are currently being worked on or are on our {% url "Roadmap
- {% issue 170#issuecomment-340012621 "Testing file uploads is application specific." %}
- {% issue 433#issuecomment-280465552 "Testing file downloads is application specific." %}
- {% issue 685 "iframe support is somewhat limited, but does work." %}
- {% issue 95#issuecomment-281273126 "You cannot use `cy.route()` on `window.fetch` but there is a workaround." %} See the implementation in {% url "this recipe." https://github.com/cypress-io/cypress-example-recipes/tree/master/examples/stubbing-spying__window-fetch/cypress/integration %}
- {% issue 95#issuecomment-281273126 "You cannot use `cy.route()` on `window.fetch` but there is a workaround." %} You can enable an automatic `window.fetch` polyfill from Cypress to spy and stub those requests, see {% url experimental experiments %}
- {% issue 144 "There is no shadow DOM support, but there are workarounds." %} See {% url "this comment." https://github.com/cypress-io/cypress/issues/830#issuecomment-449411701 %}

# Permanent trade-offs
Expand Down

0 comments on commit 9b62470

Please # to comment.