{"id":19277552,"url":"https://github.com/deploysentinel/cypress-quarantine","last_synced_at":"2025-04-21T23:32:30.037Z","repository":{"id":65900591,"uuid":"600594843","full_name":"DeploySentinel/cypress-quarantine","owner":"DeploySentinel","description":"Cypress plugin that helps skip/quarantine flaky tests dynamically","archived":false,"fork":false,"pushed_at":"2023-02-15T07:53:48.000Z","size":25637,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-03T22:38:47.489Z","etag":null,"topics":["cypress","flaky-tests","plugin","testing"],"latest_commit_sha":null,"homepage":"https://www.deploysentinel.com/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DeploySentinel.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-12T00:53:22.000Z","updated_at":"2023-11-03T05:35:02.000Z","dependencies_parsed_at":"2023-06-04T10:15:09.117Z","dependency_job_id":null,"html_url":"https://github.com/DeploySentinel/cypress-quarantine","commit_stats":{"total_commits":7,"total_committers":1,"mean_commits":7.0,"dds":0.0,"last_synced_commit":"f35161ab5d2cd6ef42f49724b9d364a4c0702109"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeploySentinel%2Fcypress-quarantine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeploySentinel%2Fcypress-quarantine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeploySentinel%2Fcypress-quarantine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeploySentinel%2Fcypress-quarantine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DeploySentinel","download_url":"https://codeload.github.com/DeploySentinel/cypress-quarantine/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223881912,"owners_count":17219269,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cypress","flaky-tests","plugin","testing"],"created_at":"2024-11-09T21:06:13.629Z","updated_at":"2024-11-09T21:06:14.229Z","avatar_url":"https://github.com/DeploySentinel.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DeploySentinel Cypress Quarantine\n\nDeploySentinel Cypress Quarantine is a plugin for Cypress that helps developers quarantine tests dynamically.\nWith this plugin, you can dynamically skip tests that are unstable, flaky, or not ready to run based off an API call made at test time.\n\n## Installation\n\nTo install the Cypress plugin, run:\n\n```sh\nnpm install -D @deploysentinel/cypress-quarantine\n```\n\n## Usage\n\n### Add Support File\n\nIn your Cypress project's **support** file (ex. `cypress/support/index.js`) add:\n\n```js\n// ❗ Must be declared at the top of the file ❗\nimport \"@deploysentinel/cypress-quarantine/support\";\n\n...\nimport \"./commands\";\n```\n\n### Add Plugin\n\nIn your Cypress project's **plugin** file (ex. `cypress.config.ts`) add:\n\n```ts\nimport { defineConfig } from 'cypress';\nimport cyQuarantine from '@deploysentinel/cypress-quarantine/plugin';\n\nexport default defineConfig({\n  ...\n  e2e: {\n    setupNodeEvents(on, config) {\n      cyQuarantine(on, config, {\n        // your custom API endpoint that returns which tests to skip per spec file (required)\n        apiUrl: 'http://localhost:8000/ci/quarantine-tests',\n        meta: {\n          testFramework: 'cypress',\n          // or any custom static metadata (optional)\n        },\n        // specify the method that generates unique test id based on titles\n        // ex: titles: ['describe A', 'test case B'] -\u003e 'describe A \u003e test case B' (stored in db)\n        // default to only test case name (leaf node); 'test case B' in this case\n        getTestId: (titles: string[]) =\u003e titles.join(' \u003e '),\n        topLevelKey: 'xxx', // (optional)\n      });\n      return config;\n    },\n  },\n});\n```\n\n## How Does it Work ?\n\nWhen you use the plugin, it will make an `POST` API request to your server to retrieve quarantined tests for a specific file.\nThe resulting API response should look like\n```\n{\n    'describe A \u003e test case B': true,\n    'describe A \u003e test case C': false,\n    ...\n}\n```\nThe key is a unique test ID derived from `getTestId`.\nAnd the value indicates whether the test case should be skipped (quarantined).\n\n### Top Level API Key\nIn case the API response has top level key attached, for example:\n```\n{\n    data: {\n        'describe A \u003e test case B': true,\n        'describe A \u003e test case C': false,\n        ...\n    }\n}\n```\nYou can set `topLevelKey` field in config to `data` in this case.\n\n\n### Custom Metadata\n\nThe API request body includes a few default custom fields by default.\nYou can utilize this information to develop a test quarantine algorithm.\n\n```ts\n{\n    cypressVesion: string;\n    // test environment variables\n    envs: Record\u003cstring, string\u003e;\n    // git information\n    commitInfo: {\n      authorEmail: string | null;\n      authorName: string | null;\n      branch: string | null;\n      defaultBranch: string | null;\n      message: string | null;\n      remoteBranch: string | null;\n      remoteOrigin: string | null;\n      sha: string | null;\n      timestamp: number | null;\n      metadata: unknown | null;\n    },\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeploysentinel%2Fcypress-quarantine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeploysentinel%2Fcypress-quarantine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeploysentinel%2Fcypress-quarantine/lists"}