{"id":20292939,"url":"https://github.com/gemini-testing/testplane-mocks","last_synced_at":"2026-01-06T03:47:48.589Z","repository":{"id":62631674,"uuid":"560840181","full_name":"gemini-testing/testplane-mocks","owner":"gemini-testing","description":"Testplane plugin that allows you to mock HTTP requests. Works only with browsers that support the CDP protocol","archived":false,"fork":false,"pushed_at":"2024-09-24T10:48:45.000Z","size":657,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-10-21T19:59:09.923Z","etag":null,"topics":["testplane-plugin"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gemini-testing.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2022-11-02T11:42:04.000Z","updated_at":"2025-04-15T15:04:27.000Z","dependencies_parsed_at":"2024-08-09T03:54:32.908Z","dependency_job_id":"d10a44d5-3c22-4409-a971-7bc2e9282d9a","html_url":"https://github.com/gemini-testing/testplane-mocks","commit_stats":null,"previous_names":["gemini-testing/hermione-mocks"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/gemini-testing/testplane-mocks","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gemini-testing%2Ftestplane-mocks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gemini-testing%2Ftestplane-mocks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gemini-testing%2Ftestplane-mocks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gemini-testing%2Ftestplane-mocks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gemini-testing","download_url":"https://codeload.github.com/gemini-testing/testplane-mocks/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gemini-testing%2Ftestplane-mocks/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28221415,"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","status":"online","status_checked_at":"2026-01-06T02:00:07.049Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["testplane-plugin"],"created_at":"2024-11-14T15:20:06.815Z","updated_at":"2026-01-06T03:47:48.570Z","avatar_url":"https://github.com/gemini-testing.png","language":"TypeScript","readme":"# @testplane/mocks\n\nA [testplane](https://github.com/gemini-testing/testplane) plugin that allows you to save/read data dumps from network requests. \n\nThis can increase the stability of tests, allows testing time-dependent scenarios, and reduces the load on the server.\n\n**Works only with browsers that support the CDP protocol**.\n\n## Installation\n\n```bash\nnpm install @testplane/mocks --save-dev\n```\n\n## Usage\n\n* **enabled** (optional) `Boolean` – enable/disable the plugin. By default plugin is disabled;\n* **patterns** (optional) `{url: string, resources: string[] | \"*\"}[]`:\n  - `url` (`string`) - A url pattern of mocking host. Example - \"https://nodejs.org/*\"\n  - `resources` (`\"*\"` | `string[]`) - An array of resource types to be mocked. Supported resource types: `\"Document\", \"Stylesheet\", \"Image\", \"Media\", \"Script\", \"XHR\", \"Fetch\"`. You can also use \"*\" instead of array, it will work the same way as array of all mentioned resource types\n* **browsers** (optional) `string[]` - array of `browserId` (from Testplane config) to intercept requests for. Each of them should be using chrome-devtools protocol. Default - `[]`\n* **mode** (optional) `\"play\" | \"save\" | \"create\"` - plugin's mode. Default - `\"save\"`. Available modes:\n   - `\"play\"`: Reads dumps from fs (dumps should exist) \n   - `\"save\"`: Writes dumps to fs. **Overwrites** existing dumps\n   - `\"create\"`: Writes dumps to fs. **Doesn't overwrite** existing dumps\n* **dumpsDir** (optional) `string | (test: Test) =\u003e string` -  dumps' directory. Default - `\"testplane-dumps\"`. Available types:\n   - `string`: (ex: `\"testplane-dumps\"`). All your dumps will be located in `testplane-dumps` in the root of the project.\n   - `(test: Test) =\u003e string`: (ex: `path.join(path.dirname(test.file), \"testplane-dumps\")`. `testplane-dumps` directories will be located next to each Testplane test). Saves tests' dumps to directories by path, returned by the function\n* **dumpsKey** (optional) `(requestUrl: string) =\u003e string` - function to create dumps key from request url. Сan be used to remove query parameters that unique every time. If you dont remove unique query params, you will encounter an error `Cache is empty: key=...` on `play` mode.\n* **gzipDumps** (optional) `Boolean` - enable/disable dump compressing. By default dumps are written and read in compressed form\n\nAlso there is ability to override plugin parameters by CLI options or environment variables (see [configparser](https://github.com/gemini-testing/configparser)).\n\nUse `testplane_mocks_` prefix for the environment variables and `--mocks-` for the cli options.\n\n* Add `@testplane/mocks` plugin to your `testplane` config file:\n```js\n// .testplane.conf.js\nmodule.exports = {\n    plugins: {\n        '@testplane/mocks': {\n            enabled: true,\n            patterns: [\n                {\n                    url: \"https://www.npmjs.com/*\",\n                    resources: [\"Document\", \"Stylesheet\", \"Image\", \"Media\", \"Script\", \"XHR\", \"Fetch\"]\n                },\n                {\n                    url: \"https://www.github.com/*\",\n                    resources: \"*\"\n                }\n            ]\n            browsers: [\"chrome\"],\n            mode: \"save\",\n            dumpsDir: \"testplane-dumps\",\n            dumpsKey: (requestUrl) =\u003e {\n                const urlObj = new URL(requestUrl);\n\n                urlObj.searchParams.delete('uniqRequestId');\n\n                return urlObj.toString();\n            },\n            gzipDumps: true\n        },\n\n        // other Testplane plugins...\n    },\n\n    // other Testplane settings...\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgemini-testing%2Ftestplane-mocks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgemini-testing%2Ftestplane-mocks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgemini-testing%2Ftestplane-mocks/lists"}