{
  "doc": {
    "id": "app/configure/experiments",
    "title": "Experimental features in Cypress App",
    "description": "Enable experimental features in Cypress by configuring specific options.",
    "section": "app",
    "source_path": "/llm/markdown/app/configure/experiments.md",
    "version": "e4f4d57da4cfedd520d3d465137d387fd54b532f",
    "updated_at": "2026-09-08T17:49:12.214Z",
    "headings": [
      {
        "id": "app/configure/experiments#experimental-features",
        "text": "Experimental Features",
        "level": 1
      },
      {
        "id": "app/configure/experiments#configuration",
        "text": "Configuration",
        "level": 2
      },
      {
        "id": "app/configure/experiments#experimental-csp-allow-list",
        "text": "Experimental CSP Allow List",
        "level": 3
      },
      {
        "id": "app/configure/experiments#strip-all-csp-headers",
        "text": "Strip All CSP Headers",
        "level": 4
      },
      {
        "id": "app/configure/experiments#strip-minimum-csp-directives",
        "text": "Strip Minimum CSP Directives",
        "level": 4
      },
      {
        "id": "app/configure/experiments#allow-specific-csp-directives",
        "text": "Allow Specific CSP Directives",
        "level": 4
      },
      {
        "id": "app/configure/experiments#experimental-flake-detection-features",
        "text": "Experimental Flake Detection Features",
        "level": 2
      },
      {
        "id": "app/configure/experiments#experimental-test-retries",
        "text": "Experimental Test Retries",
        "level": 3
      },
      {
        "id": "app/configure/experiments#experimentalstrategy-detect-flake-and-pass-on-threshold",
        "text": "experimentalStrategy: 'detect-flake-and-pass-on-threshold'",
        "level": 4
      },
      {
        "id": "app/configure/experiments#experimentalstrategy-detect-flake-but-always-fail",
        "text": "experimentalStrategy: 'detect-flake-but-always-fail'",
        "level": 4
      },
      {
        "id": "app/configure/experiments#testing-type-specific-experiments",
        "text": "Testing Type-Specific Experiments",
        "level": 2
      },
      {
        "id": "app/configure/experiments#end-to-end-testing",
        "text": "End-to-End Testing",
        "level": 3
      },
      {
        "id": "app/configure/experiments#component-testing",
        "text": "Component Testing",
        "level": 3
      },
      {
        "id": "app/configure/experiments#history",
        "text": "History",
        "level": 2
      }
    ]
  },
  "chunks": [
    {
      "id": "app/configure/experiments#configuration",
      "doc_id": "app/configure/experiments",
      "heading": "Configuration",
      "heading_level": 2,
      "content_markdown": "## Configuration\n\nYou can pass the [Cypress configuration](/llm/markdown/app/references/configuration.md) options below to enable or disable experiments. See our [Configuration Guide](/llm/markdown/app/references/configuration.md) on how to pass configuration to Cypress.\n\n| Option | Default | Description |\n| --- | --- | --- |\n| `experimentalCspAllowList` | `false` | Indicates the Content-Security-Policy directives to be permitted during a test run. See [Content-Security-Policy](/llm/markdown/app/references/content-security-policy.md) for more information. |\n| `experimentalInteractiveRunEvents` | `false` | Allows listening to the [`before:run`](/llm/markdown/api/node-events/before-run-api.md), [`after:run`](/llm/markdown/api/node-events/after-run-api.md), [`before:spec`](/llm/markdown/api/node-events/before-spec-api.md), and [`after:spec`](/llm/markdown/api/node-events/after-spec-api.md) events in the [setupNodeEvents](/llm/markdown/app/plugins/plugins-guide.md#Using-a-plugin) function during interactive mode. |\n| `experimentalModifyObstructiveThirdPartyCode` | `false` | Whether Cypress will search for and replace obstructive code in third party `.js` or `.html` files. NOTE: Setting this flag removes [Subresource Integrity (SRI)](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity) from third-party resources. To also remove SRI from first-party resources, use [`removeSRIAttributes`](/llm/markdown/app/references/configuration.md#removeSRIAttributes). |\n| `experimentalRunAllSpecs` | `false` | Enables the \"Run All Specs\" UI feature, allowing the execution of multiple specs sequentially. |\n| `experimentalWebKitSupport` | `false` | Enable experimental support for running tests in WebKit. When set, installs of `playwright-webkit` will be detected and available in Cypress. See [Launching Browsers](/llm/markdown/app/references/launching-browsers.md#WebKit-Experimental) for more information. |\n| `retries.experimentalStrategy` | N/A | Applies a strategy for test retries according to your \"flake tolerance\"; options are detect-flake-but-always-fail or detect-flake-and-pass-on-threshold. See [Experimental Retries](/llm/markdown/app/references/experiments.md#Experimental-Flake-Detection-Features) for more details. |\n| `retries.experimentalOptions` | N/A | Sets retries strategy-specific options like maxRetries, passesRequired, and stopIfAnyPassed. See [Experimental Retries](/llm/markdown/app/references/experiments.md#Experimental-Flake-Detection-Features) for more details. |\n\n### Experimental CSP Allow List\n\nCypress by default strips all CSP headers (`Content-Security-Policy` and `Content-Security-Policy-Report-Only`) from the response before it is sent to the browser. The `experimentalCspAllowList` option allows for more granular control over which CSP directives are stripped from the CSP response headers, allowing you to test your application with CSP enabled. Valid values for this option are `false` (the default), `true`, or an array of CSP directive names.\n\n| Value | Example |\n| --- | --- |\n| [`false` (default)](#Strip-All-CSP-Headers) | `experimentalCspAllowList=false` |\n| [`true`](#Strip-Minimum-CSP-Directives) | `experimentalCspAllowList=true` |\n| [`<CspDirectives>[]`](#Allow-Specific-CSP-Directives) | `experimentalCspAllowList=[\"default-src\",\"script-src\"]` |\n\n#### Strip All CSP Headers\n\nThe value `experimentalCspAllowList=false` (default) will remove all CSP headers from the response before it is sent to the browser. This option should be used if you do not depend on CSP for any tests in your application.\n\n#### Strip Minimum CSP Directives\n\nIf you need to test your application with CSP enabled, setting the `experimentalCspAllowList` option will allow all CSP headers to be sent to the browser __except__ those that could prevent Cypress from functioning normally.\n\nThe following CSP directives will always be stripped:\n\n| Stripped Directive | Allowable | Reason |\n| --- | --- | --- |\n| `frame-ancestors` | No | Prevents Cypress from loading a test application into an iframe. |\n| `navigate-to` | No | Affects Cypress' ability to navigate to different URLs. |\n| `require-trusted-types-for` | No | Might prevent Cypress from rewriting the DOM. |\n| `sandbox` | No | Can restrict access to script and iframe functionality. |\n| `trusted-types` | No | Could cause Cypress injections to be marked as untrusted. |\n\nWhen `experimentalCspAllowList=true` the following directives are also stripped in addition to the ones listed above, but can be configured to be allowed to be sent to the browser:\n\n| Stripped Directive | Allowable | Reason |\n| --- | --- | --- |\n| `child-src` | Yes | Could prevent iframes from loading in combination with other Cypress options. |\n| `default-src` | Yes | Conditionally prevents Cypress from loading scripts and running. |\n| `frame-src` | Yes | Could prevent iframes from loading in combination with other Cypress options. |\n| `form-action` | Yes | Can prevent Cypress from monitoring form events. |\n| `script-src` | Yes | Conditionally prevents Cypress from loading scripts and running. |\n| `script-src-elem` | Yes | Conditionally prevents Cypress from loading scripts and running. |\n\n#### Allow Specific CSP Directives\n\nSet the `experimentalCspAllowList` option to an array of directive names marked as \"Allowable\" from the list above. This will allow the specified CSP directives to be sent to the browser.\n\nThe following configuration would allow the `default-src`, `script-src`, and `script-src-elem` directives to be sent to the browser:\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')\n\nmodule.exports = defineConfig({\n  experimentalCspAllowList: ['default-src', 'script-src', 'script-src-elem'],\n})\n```\n\n```\nimport { defineConfig } from 'cypress'\n\nexport default defineConfig({\n  experimentalCspAllowList: ['default-src', 'script-src', 'script-src-elem'],\n})\n```\n\nDefining `experimentalCspAllowList` __may__ cause Cypress to be unable to run tests against your application. If you experience issues, reduce the directives specified in your allow list to identify which directive is causing issues.\n\nThere is a known issue when using certain directives containing hash algorithm values and the `modifyObstructiveCode` option. Using this option in combination with the `experimentalCspAllowList` option can cause a mismatch between the original hashed directive value, and the modified HTML or JS value.\n",
      "section": "app",
      "anchors": [
        "configuration"
      ],
      "path": "/llm/json/chunked/app/configure/experiments.json",
      "token_estimate": 1061
    },
    {
      "id": "app/configure/experiments#experimental-csp-allow-list",
      "doc_id": "app/configure/experiments",
      "heading": "Experimental CSP Allow List",
      "heading_level": 3,
      "content_markdown": "### Experimental CSP Allow List\n\nCypress by default strips all CSP headers (`Content-Security-Policy` and `Content-Security-Policy-Report-Only`) from the response before it is sent to the browser. The `experimentalCspAllowList` option allows for more granular control over which CSP directives are stripped from the CSP response headers, allowing you to test your application with CSP enabled. Valid values for this option are `false` (the default), `true`, or an array of CSP directive names.\n\n| Value | Example |\n| --- | --- |\n| [`false` (default)](#Strip-All-CSP-Headers) | `experimentalCspAllowList=false` |\n| [`true`](#Strip-Minimum-CSP-Directives) | `experimentalCspAllowList=true` |\n| [`<CspDirectives>[]`](#Allow-Specific-CSP-Directives) | `experimentalCspAllowList=[\"default-src\",\"script-src\"]` |\n\n#### Strip All CSP Headers\n\nThe value `experimentalCspAllowList=false` (default) will remove all CSP headers from the response before it is sent to the browser. This option should be used if you do not depend on CSP for any tests in your application.\n\n#### Strip Minimum CSP Directives\n\nIf you need to test your application with CSP enabled, setting the `experimentalCspAllowList` option will allow all CSP headers to be sent to the browser __except__ those that could prevent Cypress from functioning normally.\n\nThe following CSP directives will always be stripped:\n\n| Stripped Directive | Allowable | Reason |\n| --- | --- | --- |\n| `frame-ancestors` | No | Prevents Cypress from loading a test application into an iframe. |\n| `navigate-to` | No | Affects Cypress' ability to navigate to different URLs. |\n| `require-trusted-types-for` | No | Might prevent Cypress from rewriting the DOM. |\n| `sandbox` | No | Can restrict access to script and iframe functionality. |\n| `trusted-types` | No | Could cause Cypress injections to be marked as untrusted. |\n\nWhen `experimentalCspAllowList=true` the following directives are also stripped in addition to the ones listed above, but can be configured to be allowed to be sent to the browser:\n\n| Stripped Directive | Allowable | Reason |\n| --- | --- | --- |\n| `child-src` | Yes | Could prevent iframes from loading in combination with other Cypress options. |\n| `default-src` | Yes | Conditionally prevents Cypress from loading scripts and running. |\n| `frame-src` | Yes | Could prevent iframes from loading in combination with other Cypress options. |\n| `form-action` | Yes | Can prevent Cypress from monitoring form events. |\n| `script-src` | Yes | Conditionally prevents Cypress from loading scripts and running. |\n| `script-src-elem` | Yes | Conditionally prevents Cypress from loading scripts and running. |\n\n#### Allow Specific CSP Directives\n\nSet the `experimentalCspAllowList` option to an array of directive names marked as \"Allowable\" from the list above. This will allow the specified CSP directives to be sent to the browser.\n\nThe following configuration would allow the `default-src`, `script-src`, and `script-src-elem` directives to be sent to the browser:\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')\n\nmodule.exports = defineConfig({\n  experimentalCspAllowList: ['default-src', 'script-src', 'script-src-elem'],\n})\n```\n\n```\nimport { defineConfig } from 'cypress'\n\nexport default defineConfig({\n  experimentalCspAllowList: ['default-src', 'script-src', 'script-src-elem'],\n})\n```\n\nDefining `experimentalCspAllowList` __may__ cause Cypress to be unable to run tests against your application. If you experience issues, reduce the directives specified in your allow list to identify which directive is causing issues.\n\nThere is a known issue when using certain directives containing hash algorithm values and the `modifyObstructiveCode` option. Using this option in combination with the `experimentalCspAllowList` option can cause a mismatch between the original hashed directive value, and the modified HTML or JS value.\n",
      "section": "app",
      "anchors": [
        "experimental-csp-allow-list"
      ],
      "path": "/llm/json/chunked/app/configure/experiments.json",
      "token_estimate": 757
    },
    {
      "id": "app/configure/experiments#strip-all-csp-headers",
      "doc_id": "app/configure/experiments",
      "heading": "Strip All CSP Headers",
      "heading_level": 4,
      "content_markdown": "#### Strip All CSP Headers\n\nThe value `experimentalCspAllowList=false` (default) will remove all CSP headers from the response before it is sent to the browser. This option should be used if you do not depend on CSP for any tests in your application.\n",
      "section": "app",
      "anchors": [
        "strip-all-csp-headers"
      ],
      "path": "/llm/json/chunked/app/configure/experiments.json",
      "token_estimate": 56
    },
    {
      "id": "app/configure/experiments#strip-minimum-csp-directives",
      "doc_id": "app/configure/experiments",
      "heading": "Strip Minimum CSP Directives",
      "heading_level": 4,
      "content_markdown": "#### Strip Minimum CSP Directives\n\nIf you need to test your application with CSP enabled, setting the `experimentalCspAllowList` option will allow all CSP headers to be sent to the browser __except__ those that could prevent Cypress from functioning normally.\n\nThe following CSP directives will always be stripped:\n\n| Stripped Directive | Allowable | Reason |\n| --- | --- | --- |\n| `frame-ancestors` | No | Prevents Cypress from loading a test application into an iframe. |\n| `navigate-to` | No | Affects Cypress' ability to navigate to different URLs. |\n| `require-trusted-types-for` | No | Might prevent Cypress from rewriting the DOM. |\n| `sandbox` | No | Can restrict access to script and iframe functionality. |\n| `trusted-types` | No | Could cause Cypress injections to be marked as untrusted. |\n\nWhen `experimentalCspAllowList=true` the following directives are also stripped in addition to the ones listed above, but can be configured to be allowed to be sent to the browser:\n\n| Stripped Directive | Allowable | Reason |\n| --- | --- | --- |\n| `child-src` | Yes | Could prevent iframes from loading in combination with other Cypress options. |\n| `default-src` | Yes | Conditionally prevents Cypress from loading scripts and running. |\n| `frame-src` | Yes | Could prevent iframes from loading in combination with other Cypress options. |\n| `form-action` | Yes | Can prevent Cypress from monitoring form events. |\n| `script-src` | Yes | Conditionally prevents Cypress from loading scripts and running. |\n| `script-src-elem` | Yes | Conditionally prevents Cypress from loading scripts and running. |\n",
      "section": "app",
      "anchors": [
        "strip-minimum-csp-directives"
      ],
      "path": "/llm/json/chunked/app/configure/experiments.json",
      "token_estimate": 355
    },
    {
      "id": "app/configure/experiments#allow-specific-csp-directives",
      "doc_id": "app/configure/experiments",
      "heading": "Allow Specific CSP Directives",
      "heading_level": 4,
      "content_markdown": "#### Allow Specific CSP Directives\n\nSet the `experimentalCspAllowList` option to an array of directive names marked as \"Allowable\" from the list above. This will allow the specified CSP directives to be sent to the browser.\n\nThe following configuration would allow the `default-src`, `script-src`, and `script-src-elem` directives to be sent to the browser:\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')\n\nmodule.exports = defineConfig({\n  experimentalCspAllowList: ['default-src', 'script-src', 'script-src-elem'],\n})\n```\n\n```\nimport { defineConfig } from 'cypress'\n\nexport default defineConfig({\n  experimentalCspAllowList: ['default-src', 'script-src', 'script-src-elem'],\n})\n```\n\nDefining `experimentalCspAllowList` __may__ cause Cypress to be unable to run tests against your application. If you experience issues, reduce the directives specified in your allow list to identify which directive is causing issues.\n\nThere is a known issue when using certain directives containing hash algorithm values and the `modifyObstructiveCode` option. Using this option in combination with the `experimentalCspAllowList` option can cause a mismatch between the original hashed directive value, and the modified HTML or JS value.\n",
      "section": "app",
      "anchors": [
        "allow-specific-csp-directives"
      ],
      "path": "/llm/json/chunked/app/configure/experiments.json",
      "token_estimate": 219
    },
    {
      "id": "app/configure/experiments#experimental-flake-detection-features",
      "doc_id": "app/configure/experiments",
      "heading": "Experimental Flake Detection Features",
      "heading_level": 2,
      "content_markdown": "## Experimental Flake Detection Features\n\n### Experimental Test Retries\n\n[Test retries](/llm/markdown/app/guides/test-retries.md) is a Cypress [Flake Detection](/llm/markdown/cloud/features/flaky-test-management.md#Flake-Detection) feature that enables you to re-attempt any tests that initially fail. The failure may not be a \"true\" failure, i.e. flaky. The only way to determine this is to retry the test.\n\nNormally, test retries simply stop on the first passing attempt. And the final test result of any flaky test is always \"passing\", regardless of how many prior attempts failed. The following experimental settings for retries give you more control over the retries process.\n\nThere are two strategies for retries:\n\n*   `detect-flake-and-pass-on-threshold`\n*   `detect-flake-but-always-fail`\n\nThe `detect-flake-and-pass-on-threshold` strategy is most like the current implementation of retries, where failing tests have a \"chance\" to still pass, but still detect flake. But this new experimental strategy also enables you to now set a threshold of passing attempts to achieve a passing final result. And if you want to ensure flaky tests are treated with the same urgency as failing tests, then you will prefer to use the `detect-flake-but-always-fail` strategy, which assures that every flaky test is still marked as failing.\n\n#### `experimentalStrategy: 'detect-flake-and-pass-on-threshold'`\n\nSetting `experimentalStrategy: 'detect-flake-and-pass-on-threshold'` within retries will give you ability to set how many passing attempts are required for the test result to be passing. There are two `experimentalOptions` that must be set with this strategy:\n\n*   `maxRetries` sets the maximum number of retries that can occur after the first attempt failed\n*   `passesRequired` sets the required number of passing attempts for the final test result to be passing. Cannot be greater than `maxRetries`.\n    *   `passesRequired` also determines how the retries may stop before `maxRetries` is reached; either if the number of passing attempts so far has met the `passesRequired` condition or if the number of failing attempts exceeds the difference between `maxRetries` and `passesRequired` (when it's impossible to achieve the passing result).\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')\n\nmodule.exports = defineConfig({\n  retries: {\n    experimentalStrategy: 'detect-flake-and-pass-on-threshold',\n    experimentalOptions: {\n      maxRetries: 2,\n      passesRequired: 2,\n    },\n\n    // you must also explicitly set openMode and runMode to\n    // either true or false when using experimental retries\n    openMode: true,\n    runMode: true,\n  },\n})\n```\n\n```\nimport { defineConfig } from 'cypress'\n\nexport default defineConfig({\n  retries: {\n    experimentalStrategy: 'detect-flake-and-pass-on-threshold',\n    experimentalOptions: {\n      maxRetries: 2,\n      passesRequired: 2,\n    },\n\n    // you must also explicitly set openMode and runMode to\n    // either true or false when using experimental retries\n    openMode: true,\n    runMode: true,\n  },\n})\n```\n\nExamples of the above configuration's results:\n\n**Scenario 1:**\n\n*   Attempt 1: Fail\n*   Attempt 2: Pass\n*   Attempt 3: Fail\n\nThe retries stop on attempt 3, since `maxRetries: 2` is now met and the test's final result is **failing** and **flaky**. Only one attempt passed, but two are needed to pass.\n\n**Scenario 2:**\n\n*   Attempt 1: Fail\n*   Attempt 2: Pass\n*   Attempt 3: Pass\n\nRetries stop at attempt 3 again, and the test is **passing** and **flaky**, since there are now two passing attempts.\n\n**Scenario 3:**\n\n*   Attempt 1: Fail\n*   Attempt 2: Fail\n\nRetries stop on attempt 2, and the test is **failing** , because the requisite two passing attempts for a passing result can no longer be achieved once the 1st retry failed. It's also **not flaky**, since there were no passing attempts.\n\n#### `experimentalStrategy: 'detect-flake-but-always-fail'`\n\nSetting `experimentalStrategy: 'detect-flake-but-always-fail'` within retries ensures any test with any failed attempt will always end with a failing final result. There are two `experimentalOptions` that must be set in this strategy:\n\n*   `maxRetries` sets the maximum number of retries that can occur after the first attempt failed\n*   `stopIfAnyPassed` will stop the retries before `maxRetries` is reached when there is any passing attempt.\n    *   `stopIfAnyPassed` causes retries to exit as soon as any flake is detected (a test that is retrying after a failure only needs to pass once to exhibit flaky behavior). However it may help to see more retry attempts, such as when the failure mode is also non-deterministic and more of these different errors are revealed on more retries, in which case `stopIfAnyPassed: false` may be desirable.\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')\n\nmodule.exports = defineConfig({\n  retries: {\n    experimentalStrategy: 'detect-flake-but-always-fail',\n    experimentalOptions: {\n      maxRetries: 2,\n      stopIfAnyPassed: true,\n    },\n\n    // you must also explicitly set openMode and runMode to\n    // either true or false when using experimental retries\n    openMode: true,\n    runMode: true,\n  },\n})\n```\n\n```\nimport { defineConfig } from 'cypress'\n\nexport default defineConfig({\n  retries: {\n    experimentalStrategy: 'detect-flake-but-always-fail',\n    experimentalOptions: {\n      maxRetries: 2,\n      stopIfAnyPassed: true,\n    },\n\n    // you must also explicitly set openMode and runMode to\n    // either true or false when using experimental retries\n    openMode: true,\n    runMode: true,\n  },\n})\n```\n\nExamples of the above configuration's results:\n\n**Scenario 1:**\n\n*   Attempt 1: Fail\n*   Attempt 2: Fail\n*   Attempt 3: Fail\n\nThe retries stop on attempt 3, since `maxRetries: 2` is now met and the test is **failing** , but also **not flaky**.\n\n**Scenario 2:**\n\n*   Attempt 1: Fail\n*   Attempt 2: Pass\n\nRetries stop on the first retry, due to the passing attempt. The test is **failing** and **flaky**. If `stopIfAnyPassed` was `false`, then the retries would have proceeded once more.\n\n**Note:** Experimental retries can only be configured at the global level and **not** per individual test, whereas non-experimental `retries` [can be configured per test](/llm/markdown/app/guides/test-retries.md#Individual-Tests). If you configure retries on a per-test basis while using experimental retries globally, that particular test's `retries` configuration will override the experimental retries and ignore it.\n\nAlso, while using experimental retries, you cannot set numeric values for `openMode` or `runMode` [at the global level](/llm/markdown/app/guides/test-retries.md#Global-Configuration). You can instead set `true` or `false` for each.\n",
      "section": "app",
      "anchors": [
        "experimental-flake-detection-features"
      ],
      "path": "/llm/json/chunked/app/configure/experiments.json",
      "token_estimate": 1243
    },
    {
      "id": "app/configure/experiments#experimental-test-retries",
      "doc_id": "app/configure/experiments",
      "heading": "Experimental Test Retries",
      "heading_level": 3,
      "content_markdown": "### Experimental Test Retries\n\n[Test retries](/llm/markdown/app/guides/test-retries.md) is a Cypress [Flake Detection](/llm/markdown/cloud/features/flaky-test-management.md#Flake-Detection) feature that enables you to re-attempt any tests that initially fail. The failure may not be a \"true\" failure, i.e. flaky. The only way to determine this is to retry the test.\n\nNormally, test retries simply stop on the first passing attempt. And the final test result of any flaky test is always \"passing\", regardless of how many prior attempts failed. The following experimental settings for retries give you more control over the retries process.\n\nThere are two strategies for retries:\n\n*   `detect-flake-and-pass-on-threshold`\n*   `detect-flake-but-always-fail`\n\nThe `detect-flake-and-pass-on-threshold` strategy is most like the current implementation of retries, where failing tests have a \"chance\" to still pass, but still detect flake. But this new experimental strategy also enables you to now set a threshold of passing attempts to achieve a passing final result. And if you want to ensure flaky tests are treated with the same urgency as failing tests, then you will prefer to use the `detect-flake-but-always-fail` strategy, which assures that every flaky test is still marked as failing.\n\n#### `experimentalStrategy: 'detect-flake-and-pass-on-threshold'`\n\nSetting `experimentalStrategy: 'detect-flake-and-pass-on-threshold'` within retries will give you ability to set how many passing attempts are required for the test result to be passing. There are two `experimentalOptions` that must be set with this strategy:\n\n*   `maxRetries` sets the maximum number of retries that can occur after the first attempt failed\n*   `passesRequired` sets the required number of passing attempts for the final test result to be passing. Cannot be greater than `maxRetries`.\n    *   `passesRequired` also determines how the retries may stop before `maxRetries` is reached; either if the number of passing attempts so far has met the `passesRequired` condition or if the number of failing attempts exceeds the difference between `maxRetries` and `passesRequired` (when it's impossible to achieve the passing result).\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')\n\nmodule.exports = defineConfig({\n  retries: {\n    experimentalStrategy: 'detect-flake-and-pass-on-threshold',\n    experimentalOptions: {\n      maxRetries: 2,\n      passesRequired: 2,\n    },\n\n    // you must also explicitly set openMode and runMode to\n    // either true or false when using experimental retries\n    openMode: true,\n    runMode: true,\n  },\n})\n```\n\n```\nimport { defineConfig } from 'cypress'\n\nexport default defineConfig({\n  retries: {\n    experimentalStrategy: 'detect-flake-and-pass-on-threshold',\n    experimentalOptions: {\n      maxRetries: 2,\n      passesRequired: 2,\n    },\n\n    // you must also explicitly set openMode and runMode to\n    // either true or false when using experimental retries\n    openMode: true,\n    runMode: true,\n  },\n})\n```\n\nExamples of the above configuration's results:\n\n**Scenario 1:**\n\n*   Attempt 1: Fail\n*   Attempt 2: Pass\n*   Attempt 3: Fail\n\nThe retries stop on attempt 3, since `maxRetries: 2` is now met and the test's final result is **failing** and **flaky**. Only one attempt passed, but two are needed to pass.\n\n**Scenario 2:**\n\n*   Attempt 1: Fail\n*   Attempt 2: Pass\n*   Attempt 3: Pass\n\nRetries stop at attempt 3 again, and the test is **passing** and **flaky**, since there are now two passing attempts.\n\n**Scenario 3:**\n\n*   Attempt 1: Fail\n*   Attempt 2: Fail\n\nRetries stop on attempt 2, and the test is **failing** , because the requisite two passing attempts for a passing result can no longer be achieved once the 1st retry failed. It's also **not flaky**, since there were no passing attempts.\n\n#### `experimentalStrategy: 'detect-flake-but-always-fail'`\n\nSetting `experimentalStrategy: 'detect-flake-but-always-fail'` within retries ensures any test with any failed attempt will always end with a failing final result. There are two `experimentalOptions` that must be set in this strategy:\n\n*   `maxRetries` sets the maximum number of retries that can occur after the first attempt failed\n*   `stopIfAnyPassed` will stop the retries before `maxRetries` is reached when there is any passing attempt.\n    *   `stopIfAnyPassed` causes retries to exit as soon as any flake is detected (a test that is retrying after a failure only needs to pass once to exhibit flaky behavior). However it may help to see more retry attempts, such as when the failure mode is also non-deterministic and more of these different errors are revealed on more retries, in which case `stopIfAnyPassed: false` may be desirable.\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')\n\nmodule.exports = defineConfig({\n  retries: {\n    experimentalStrategy: 'detect-flake-but-always-fail',\n    experimentalOptions: {\n      maxRetries: 2,\n      stopIfAnyPassed: true,\n    },\n\n    // you must also explicitly set openMode and runMode to\n    // either true or false when using experimental retries\n    openMode: true,\n    runMode: true,\n  },\n})\n```\n\n```\nimport { defineConfig } from 'cypress'\n\nexport default defineConfig({\n  retries: {\n    experimentalStrategy: 'detect-flake-but-always-fail',\n    experimentalOptions: {\n      maxRetries: 2,\n      stopIfAnyPassed: true,\n    },\n\n    // you must also explicitly set openMode and runMode to\n    // either true or false when using experimental retries\n    openMode: true,\n    runMode: true,\n  },\n})\n```\n\nExamples of the above configuration's results:\n\n**Scenario 1:**\n\n*   Attempt 1: Fail\n*   Attempt 2: Fail\n*   Attempt 3: Fail\n\nThe retries stop on attempt 3, since `maxRetries: 2` is now met and the test is **failing** , but also **not flaky**.\n\n**Scenario 2:**\n\n*   Attempt 1: Fail\n*   Attempt 2: Pass\n\nRetries stop on the first retry, due to the passing attempt. The test is **failing** and **flaky**. If `stopIfAnyPassed` was `false`, then the retries would have proceeded once more.\n\n**Note:** Experimental retries can only be configured at the global level and **not** per individual test, whereas non-experimental `retries` [can be configured per test](/llm/markdown/app/guides/test-retries.md#Individual-Tests). If you configure retries on a per-test basis while using experimental retries globally, that particular test's `retries` configuration will override the experimental retries and ignore it.\n\nAlso, while using experimental retries, you cannot set numeric values for `openMode` or `runMode` [at the global level](/llm/markdown/app/guides/test-retries.md#Global-Configuration). You can instead set `true` or `false` for each.\n",
      "section": "app",
      "anchors": [
        "experimental-test-retries"
      ],
      "path": "/llm/json/chunked/app/configure/experiments.json",
      "token_estimate": 1236
    },
    {
      "id": "app/configure/experiments#experimentalstrategy-detect-flake-and-pass-on-threshold",
      "doc_id": "app/configure/experiments",
      "heading": "experimentalStrategy: 'detect-flake-and-pass-on-threshold'",
      "heading_level": 4,
      "content_markdown": "#### `experimentalStrategy: 'detect-flake-and-pass-on-threshold'`\n\nSetting `experimentalStrategy: 'detect-flake-and-pass-on-threshold'` within retries will give you ability to set how many passing attempts are required for the test result to be passing. There are two `experimentalOptions` that must be set with this strategy:\n\n*   `maxRetries` sets the maximum number of retries that can occur after the first attempt failed\n*   `passesRequired` sets the required number of passing attempts for the final test result to be passing. Cannot be greater than `maxRetries`.\n    *   `passesRequired` also determines how the retries may stop before `maxRetries` is reached; either if the number of passing attempts so far has met the `passesRequired` condition or if the number of failing attempts exceeds the difference between `maxRetries` and `passesRequired` (when it's impossible to achieve the passing result).\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')\n\nmodule.exports = defineConfig({\n  retries: {\n    experimentalStrategy: 'detect-flake-and-pass-on-threshold',\n    experimentalOptions: {\n      maxRetries: 2,\n      passesRequired: 2,\n    },\n\n    // you must also explicitly set openMode and runMode to\n    // either true or false when using experimental retries\n    openMode: true,\n    runMode: true,\n  },\n})\n```\n\n```\nimport { defineConfig } from 'cypress'\n\nexport default defineConfig({\n  retries: {\n    experimentalStrategy: 'detect-flake-and-pass-on-threshold',\n    experimentalOptions: {\n      maxRetries: 2,\n      passesRequired: 2,\n    },\n\n    // you must also explicitly set openMode and runMode to\n    // either true or false when using experimental retries\n    openMode: true,\n    runMode: true,\n  },\n})\n```\n\nExamples of the above configuration's results:\n\n**Scenario 1:**\n\n*   Attempt 1: Fail\n*   Attempt 2: Pass\n*   Attempt 3: Fail\n\nThe retries stop on attempt 3, since `maxRetries: 2` is now met and the test's final result is **failing** and **flaky**. Only one attempt passed, but two are needed to pass.\n\n**Scenario 2:**\n\n*   Attempt 1: Fail\n*   Attempt 2: Pass\n*   Attempt 3: Pass\n\nRetries stop at attempt 3 again, and the test is **passing** and **flaky**, since there are now two passing attempts.\n\n**Scenario 3:**\n\n*   Attempt 1: Fail\n*   Attempt 2: Fail\n\nRetries stop on attempt 2, and the test is **failing** , because the requisite two passing attempts for a passing result can no longer be achieved once the 1st retry failed. It's also **not flaky**, since there were no passing attempts.\n",
      "section": "app",
      "anchors": [
        "experimentalstrategy-detect-flake-and-pass-on-threshold"
      ],
      "path": "/llm/json/chunked/app/configure/experiments.json",
      "token_estimate": 479
    },
    {
      "id": "app/configure/experiments#experimentalstrategy-detect-flake-but-always-fail",
      "doc_id": "app/configure/experiments",
      "heading": "experimentalStrategy: 'detect-flake-but-always-fail'",
      "heading_level": 4,
      "content_markdown": "#### `experimentalStrategy: 'detect-flake-but-always-fail'`\n\nSetting `experimentalStrategy: 'detect-flake-but-always-fail'` within retries ensures any test with any failed attempt will always end with a failing final result. There are two `experimentalOptions` that must be set in this strategy:\n\n*   `maxRetries` sets the maximum number of retries that can occur after the first attempt failed\n*   `stopIfAnyPassed` will stop the retries before `maxRetries` is reached when there is any passing attempt.\n    *   `stopIfAnyPassed` causes retries to exit as soon as any flake is detected (a test that is retrying after a failure only needs to pass once to exhibit flaky behavior). However it may help to see more retry attempts, such as when the failure mode is also non-deterministic and more of these different errors are revealed on more retries, in which case `stopIfAnyPassed: false` may be desirable.\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')\n\nmodule.exports = defineConfig({\n  retries: {\n    experimentalStrategy: 'detect-flake-but-always-fail',\n    experimentalOptions: {\n      maxRetries: 2,\n      stopIfAnyPassed: true,\n    },\n\n    // you must also explicitly set openMode and runMode to\n    // either true or false when using experimental retries\n    openMode: true,\n    runMode: true,\n  },\n})\n```\n\n```\nimport { defineConfig } from 'cypress'\n\nexport default defineConfig({\n  retries: {\n    experimentalStrategy: 'detect-flake-but-always-fail',\n    experimentalOptions: {\n      maxRetries: 2,\n      stopIfAnyPassed: true,\n    },\n\n    // you must also explicitly set openMode and runMode to\n    // either true or false when using experimental retries\n    openMode: true,\n    runMode: true,\n  },\n})\n```\n\nExamples of the above configuration's results:\n\n**Scenario 1:**\n\n*   Attempt 1: Fail\n*   Attempt 2: Fail\n*   Attempt 3: Fail\n\nThe retries stop on attempt 3, since `maxRetries: 2` is now met and the test is **failing** , but also **not flaky**.\n\n**Scenario 2:**\n\n*   Attempt 1: Fail\n*   Attempt 2: Pass\n\nRetries stop on the first retry, due to the passing attempt. The test is **failing** and **flaky**. If `stopIfAnyPassed` was `false`, then the retries would have proceeded once more.\n\n**Note:** Experimental retries can only be configured at the global level and **not** per individual test, whereas non-experimental `retries` [can be configured per test](/llm/markdown/app/guides/test-retries.md#Individual-Tests). If you configure retries on a per-test basis while using experimental retries globally, that particular test's `retries` configuration will override the experimental retries and ignore it.\n\nAlso, while using experimental retries, you cannot set numeric values for `openMode` or `runMode` [at the global level](/llm/markdown/app/guides/test-retries.md#Global-Configuration). You can instead set `true` or `false` for each.\n",
      "section": "app",
      "anchors": [
        "experimentalstrategy-detect-flake-but-always-fail"
      ],
      "path": "/llm/json/chunked/app/configure/experiments.json",
      "token_estimate": 519
    },
    {
      "id": "app/configure/experiments#testing-type-specific-experiments",
      "doc_id": "app/configure/experiments",
      "heading": "Testing Type-Specific Experiments",
      "heading_level": 2,
      "content_markdown": "## Testing Type-Specific Experiments\n\nYou can provide configuration options for either E2E or Component Testing by creating `e2e` and `component` objects inside your Cypress configuration.\n\n### End-to-End Testing\n\nThese experiments are available to be specified inside the `e2e` configuration object:\n\n| Option | Default | Description |\n| --- | --- | --- |\n| `experimentalOriginDependencies` | `false` | Enables support for `Cypress.require` within `cy.origin`. |\n\n### Component Testing\n\nThese experiments are available to be specified inside the `component` configuration object:\n\n| Option | Default | Description |\n| --- | --- | --- |\n| `experimentalSingleTabRunMode` | `false` | Run all specs in a single tab, instead of creating a new tab per spec. This can improve run mode performance, but can impact spec isolation and reliability on large test suites. |\n",
      "section": "app",
      "anchors": [
        "testing-type-specific-experiments"
      ],
      "path": "/llm/json/chunked/app/configure/experiments.json",
      "token_estimate": 177
    },
    {
      "id": "app/configure/experiments#end-to-end-testing",
      "doc_id": "app/configure/experiments",
      "heading": "End-to-End Testing",
      "heading_level": 3,
      "content_markdown": "### End-to-End Testing\n\nThese experiments are available to be specified inside the `e2e` configuration object:\n\n| Option | Default | Description |\n| --- | --- | --- |\n| `experimentalOriginDependencies` | `false` | Enables support for `Cypress.require` within `cy.origin`. |\n",
      "section": "app",
      "anchors": [
        "end-to-end-testing"
      ],
      "path": "/llm/json/chunked/app/configure/experiments.json",
      "token_estimate": 55
    },
    {
      "id": "app/configure/experiments#component-testing",
      "doc_id": "app/configure/experiments",
      "heading": "Component Testing",
      "heading_level": 3,
      "content_markdown": "### Component Testing\n\nThese experiments are available to be specified inside the `component` configuration object:\n\n| Option | Default | Description |\n| --- | --- | --- |\n| `experimentalSingleTabRunMode` | `false` | Run all specs in a single tab, instead of creating a new tab per spec. This can improve run mode performance, but can impact spec isolation and reliability on large test suites. |\n",
      "section": "app",
      "anchors": [
        "component-testing"
      ],
      "path": "/llm/json/chunked/app/configure/experiments.json",
      "token_estimate": 89
    },
    {
      "id": "app/configure/experiments#history",
      "doc_id": "app/configure/experiments",
      "heading": "History",
      "heading_level": 2,
      "content_markdown": "## History\n\n| Version | Changes |\n| --- | --- |\n| [16.0.0](/llm/markdown/app/references/changelog.md#16-0-0) | Removed `experimentalSourceRewriting`. The default regex-based source rewriting is now the only implementation. |\n| [16.0.0](/llm/markdown/app/references/changelog.md#16-0-0) | Removed `experimentalFastVisibility`. The modern visibility algorithm is now the default. |\n| [16.0.0](/llm/markdown/app/references/changelog.md#16-0-0) | Removed `experimentalMemoryManagement`. Memory management graduated to [`manageBrowserMemory`](/llm/markdown/app/references/configuration.md#manageBrowserMemory), enabled by default. |\n| [15.9.0](/llm/markdown/app/references/changelog.md#15-9-0) | Added component testing support for `experimentalRunAllSpecs`. |\n| [15.8.0](/llm/markdown/app/references/changelog.md#15-8-0) | Added support for `experimentalFastVisibility` experiment. |\n| [15.4.0](/llm/markdown/app/references/changelog.md) | Removed `experimentalStudio`. Cypress Studio is available as default behavior. |\n| [14.0.0](/llm/markdown/app/references/changelog.md#14-0-0) | Removed `experimentalFetchPolyfill`, `experimentalJustInTimeCompile`, and `experimentalSkipDomainInjection` and made it default behavior. |\n| [13.14.0](/llm/markdown/app/references/changelog.md#13-14-0) | Added support for configuring the Experimental Just-In-Time (JIT) Compiling for component testing via `experimentalJustInTimeCompile`. |\n| [13.4.0](/llm/markdown/app/references/changelog.md#13-4-0) | Added support for configuring the Experimental Flake Detection strategy via `retries.experimentalStrategy` and `retries.experimentalOptions`. |\n| [12.6.0](/llm/markdown/app/references/changelog.md#12-6-0) | Removed `require`/`import` and added `Cypress.require` for `experimentalOriginDependencies`. |\n| [12.4.0](/llm/markdown/app/references/changelog.md#12-4-0) | Added `experimentalSkipDomainInjection` and `experimentalMemoryManagement`. |\n| [12.0.0](/llm/markdown/app/references/changelog.md#12-0-0) | Removed `experimentalSessionAndOrigin` and made it the default behavior. Added `experimentalOriginDependencies`. |\n| [11.2.0](/llm/markdown/app/references/changelog.md#11-2-0) | Added `experimentalRunAllSpecs`. |\n| [10.8.0](/llm/markdown/app/references/changelog.md#10-8-0) | Added `experimentalWebKitSupport`. |\n| [10.6.0](/llm/markdown/app/references/changelog.md#10-6-0) | Added support for `experimentalSingleTabRunMode`. |\n| [10.4.0](/llm/markdown/app/references/changelog.md#10-4-0) | Added support for `experimentalModifyObstructiveThirdPartyCode`. |\n| [9.6.0](/llm/markdown/app/references/changelog.md#9-6-0) | Added support for `experimentalSessionAndOrigin` and removed `experimentalSessionSupport`. |\n| [8.2.0](/llm/markdown/app/references/changelog.md#8-2-0) | Added support for `experimentalSessionSupport`. |\n| [7.1.0](/llm/markdown/app/references/changelog.md#7-1-0) | Added support for `experimentalInteractiveRunEvents`. |\n| [7.0.0](/llm/markdown/app/references/changelog.md#7-0-0) | Removed `experimentalComponentTesting` and made it the default behavior. |\n| [6.7.0](/llm/markdown/app/references/changelog.md#6-7-0) | Removed `experimentalRunEvents` and made it the default behavior. |\n| [6.3.0](/llm/markdown/app/references/changelog.md#6-3-0) | Added support for `experimentalStudio`. |\n| [6.2.0](/llm/markdown/app/references/changelog.md#6-2-0) | Added support for `experimentalRunEvents`. |\n| [6.0.0](/llm/markdown/app/references/changelog.md#6-0-0) | Removed `experimentalNetworkStubbing` and made it the default behavior when using [cy.intercept()](/llm/markdown/api/commands/intercept.md). |\n| [6.0.0](/llm/markdown/app/references/changelog.md#6-0-0) | Deprecated `experimentalFetchPolyfill`. |\n| [5.2.0](/llm/markdown/app/references/changelog.md#5-2-0) | Removed `experimentalShadowDomSupport` and made it the default behavior. |\n| [5.1.0](/llm/markdown/app/references/changelog.md#5-1-0) | Added support for `experimentalNetworkStubbing`. |\n| [5.0.0](/llm/markdown/app/references/changelog.md#5-0-0) | Removed `experimentalGetCookiesSameSite` and made it the default behavior. |\n| [4.9.0](/llm/markdown/app/references/changelog.md#4-9-0) | Added support for `experimentalFetchPolyfill`. |\n| [4.8.0](/llm/markdown/app/references/changelog.md#4-8-0) | Added support for `experimentalShadowDomSupport`. |\n| [4.6.0](/llm/markdown/app/references/changelog.md#4-6-0) | Added support for `experimentalSourceRewriting`. |\n| [4.5.0](/llm/markdown/app/references/changelog.md#4-5-0) | Added support for `experimentalComponentTesting`. |\n| [4.3.0](/llm/markdown/app/references/changelog.md#4-3-0) | Added support for `experimentalGetCookiesSameSite`. |\n",
      "section": "app",
      "anchors": [
        "history"
      ],
      "path": "/llm/json/chunked/app/configure/experiments.json",
      "token_estimate": 477
    }
  ]
}