{"_id":"@cond/cypress-autorecord","_rev":"2-61137bd93b9c7694a9410712e315fc7c","name":"@cond/cypress-autorecord","dist-tags":{"latest":"0.0.3"},"versions":{"0.0.1":{"name":"@cond/cypress-autorecord","version":"0.0.1","description":"It simplifies mocking by auto-recording/stubbing HTTP interactions and automate the process of updating/deleting recordings.","main":"index.js","types":"index.d.ts","scripts":{"test":"cypress run --headless","test:watch":"cypress open"},"author":{"name":"Ahmet Şimşek"},"keywords":["Cypress","http","https","record","playback","mock","vcr"],"repository":{"type":"git","url":"git+https://github.com/indatawetrust/cypress-autorecord.git"},"license":"MIT","devDependencies":{"cypress":"^10.7.0"},"gitHead":"b073c748bc8c6572c45211b8266b1c44207b3ad2","bugs":{"url":"https://github.com/indatawetrust/cypress-autorecord/issues"},"homepage":"https://github.com/indatawetrust/cypress-autorecord#readme","_id":"@cond/cypress-autorecord@0.0.1","_nodeVersion":"14.17.3","_npmVersion":"6.14.13","dist":{"integrity":"sha512-JqL+1qfODVBy6MuAkNcTYqMrIc0wCfWgDTzluJGz07+z9XFDvVkl1UcXPGlr7Znay8GWySMYBt0JZZNsxmxhVg==","shasum":"44632f446a12ac477a85736ef1d288f545083ddd","tarball":"https://registry.npmjs.org/@cond/cypress-autorecord/-/cypress-autorecord-0.0.1.tgz","fileCount":14,"unpackedSize":25896,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHVha3Rn5PoAbk3bttzY2tfHYEpDpJQgzvAipYe0ozUvAiAgvk1GookxcXHZirWHTTAtUc21V3G4rup9hc01/eIilg=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjGfosACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoL1w//ScFFK/O/xt4tlDWM7p4MRU9dVY1RUybv5zj1IYVSLpHsrCDU\r\nJVOcPrU4CPOsKwI7swHAtqh/Bhf/TgCkebs/LDNrtowEPa6aMv/ei2rg3hIb\r\nVB2Bk4Bm3fS6chHaId5vhnAUJouSywkg5tsAS4HOzwqlrJBjQTTFtDJ9aIw2\r\nGJnQvBn9J5oRnECvAY77MRCyOBNmStBgVdOydV+NiAkckSdonDdzuwKEsaP1\r\nmOslenSVZioT3OW6rlp5LAlHKu0ejiDzByi8g/Ur5cBmkphTgsXDFv7KJ+/0\r\nXUodiW2cs0GyYGRvFpihfg82DOYLNrwdp9vxkH2InsgIuxXu42qqafY2t9Ws\r\na6WXK/EAS2HEYaL92OlDWE5OEWg/Fo9qBsIT4MAaSXz0/C9A9YFb1SQtiGks\r\naa2BB5mrPWbctkhUmg899Vo9ZNNMBC3UhcyrqljhMS+C2YGCLoKCKKZTNUG+\r\nCyxdS876Y92l5U7/c+YcTLpON7MlKdc5QV8z1xd9s7BH5XSz9+N1xPgAXFUC\r\nGlra0XHCC8uzq+fGr7FiNzwRfnaiL6y2Bsokp+7BnmKgz0q+ODdOjkAtl94n\r\nRIFNtRTU2r8TrxYlt9d84kGa7EEp+TKhcRIvarLJbKbcS/IwNuYqA6alE4ce\r\ng8hQhSJGEhuKH3N8/wG9OxLm5zySQb1SsLQ=\r\n=A4Ev\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"cond","email":"iamaroott@gmail.com"},"directories":{},"maintainers":[{"name":"cond","email":"iamaroott@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/cypress-autorecord_0.0.1_1662646828626_0.35975024847558457"},"_hasShrinkwrap":false},"0.0.2":{"name":"@cond/cypress-autorecord","version":"0.0.2","description":"It simplifies mocking by auto-recording/stubbing HTTP interactions and automate the process of updating/deleting recordings.","main":"index.js","types":"index.d.ts","scripts":{"test":"cypress run --headless","test:watch":"cypress open"},"author":{"name":"Ahmet Şimşek"},"keywords":["Cypress","http","https","record","playback","mock","vcr"],"repository":{"type":"git","url":"git+https://github.com/indatawetrust/cypress-autorecord.git"},"license":"MIT","devDependencies":{"cypress":"^10.7.0"},"gitHead":"858b573db0b6b2949fe968d168f57e9a82dc6bd3","bugs":{"url":"https://github.com/indatawetrust/cypress-autorecord/issues"},"homepage":"https://github.com/indatawetrust/cypress-autorecord#readme","_id":"@cond/cypress-autorecord@0.0.2","_nodeVersion":"14.17.3","_npmVersion":"6.14.13","dist":{"integrity":"sha512-PXu+i2o9XTh5v5S97eI7K3O5G82UhnI9a4senN5Sg8+NMZ5XeTe8mTxALPZULgX7uHwcmbPTXcNveN/AWDfx9g==","shasum":"7749fe6b3d2015f0a8be595098c035296a5bf492","tarball":"https://registry.npmjs.org/@cond/cypress-autorecord/-/cypress-autorecord-0.0.2.tgz","fileCount":14,"unpackedSize":25880,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCAhiyS0jH6kSZqI1V09nXI7Ja5ABeAY+HAqDXlNer5sgIgO1QQ+oITewalX882exg4eNvEo/almh1xzqEueGLEpd8="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjGh5xACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmosSw//fAk7El1XrXKbnPPseNjvm+eP1gUFze36LLBWZvlIetxRlpWp\r\nwEkZhS+RDK/CwNSugXbjYif5SO2n8gAg0bC7Ywf8mouPQw4OcHGq3O67ACcD\r\nj6VQy2XaU2/egql6FX3L6VCNco/jc3zsFQ0Gs4K5VnNz8lnCqCEIhpF2gYgI\r\nXD4M1AwG2iUYOu0M/7vv3eChgslUmc0GT7TmrZ2473qabGWsYhPplZhtqe6i\r\n00XIWgzJy3YrDbfEOAHoJfdj4gZ//bOux04AK/gf5+9uu8S/APVqQ/m3FsXO\r\n8oGQWURQtAlwX6XgLVgvbikADBBVre2ljF1AfM8XMPY/JwNQE2n/18HtTO7T\r\n7XlhTkVOh9el6j7nc8kEtkcSrA9nxoY12G1IxOXMCoO1cNNUEfmauQlwc4zj\r\n7VD9skfqotMcEH20WDNF1NhYjRvhMTyX4lOO8X50a0fIqA5M7B9KMwJ7E+a+\r\n4eo7s9oCO/MsGXbrE3G1EFz8nKUzjGxy2PtCT5UCt6/1EbJD3EDxcbqhJCzQ\r\nwzg1/1In2CErd4OWhE0cnz0Td5Q6093Xhq/TTszVneiiq8Z2ay3nlnXh5vdb\r\nTUD9lFLHkVxTB3rMHfN6ahZMWoZCEOecAcs41kRT7uPjgLN0+RI+gfqBWaxa\r\nk8YKtKLhOORBn1cWqljwmyksP4TGJfMGStI=\r\n=NKCB\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"cond","email":"iamaroott@gmail.com"},"directories":{},"maintainers":[{"name":"cond","email":"iamaroott@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/cypress-autorecord_0.0.2_1662656113351_0.06681813187512264"},"_hasShrinkwrap":false},"0.0.3":{"name":"@cond/cypress-autorecord","version":"0.0.3","description":"It simplifies mocking by auto-recording/stubbing HTTP interactions and automate the process of updating/deleting recordings.","main":"index.js","types":"index.d.ts","scripts":{"test":"cypress run --headless","test:watch":"cypress open"},"author":{"name":"Ahmet Şimşek"},"keywords":["Cypress","http","https","record","playback","mock","vcr"],"repository":{"type":"git","url":"git+https://github.com/indatawetrust/cypress-autorecord.git"},"license":"MIT","devDependencies":{"cypress":"^10.7.0"},"gitHead":"a0750c34ac764fa03b0a12b0ec02cacd845dfa4a","bugs":{"url":"https://github.com/indatawetrust/cypress-autorecord/issues"},"homepage":"https://github.com/indatawetrust/cypress-autorecord#readme","_id":"@cond/cypress-autorecord@0.0.3","_nodeVersion":"14.17.3","_npmVersion":"6.14.13","dist":{"integrity":"sha512-34tb4LENvcOKvkpGSQCeHOmORI7Ma8gZA3FSEaGsIApjvIBsH6/ARkHcda816uTFmpUa1sVKxZ7YD/nXyzmSEg==","shasum":"8875413654bc6618fce652b7ff6cf55021ffc8a4","tarball":"https://registry.npmjs.org/@cond/cypress-autorecord/-/cypress-autorecord-0.0.3.tgz","fileCount":14,"unpackedSize":25595,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHBk+zZYKAgQR/3Ys+SitBSiaweA74pU5EvpfhOVWqO4AiEAnbZ/KtvbkE3crtX8k0ynWGYNcDEJGH+qf6e1tR5vl5E="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjP/R5ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrdEBAAh02GDFp176PgsYE2DfButLEqN3IBAcQ59BtcPdqoyqN5TbnK\r\n1YAIByf3Tsw7SA9UWFrombT01VnVYKoGSejzjcw9LpqS6vdRJu02DzsYSagi\r\nc5grFNCdStjInV2WIS8TCVf7tAPqKGVL+zKx+38e8pPGbjAgJq342vfNOiVi\r\n6VJMh1XzZfmM0H0j6GJwblNuyFV9p972tZ7zwtQJZWjqHX8UpElQ7uAQcU9q\r\nu3E9r18b0Y6HyeQLn1MAuQEBtaqFqVTDB/wos8iHRyvNaYFNWIQsbFEWdAVZ\r\nV7u9QEhBvkp7zjQ2bMAm94HiSt2Liai1UqkY3POkY0+PGwlkJP8ub+HLXsfK\r\nulZwdFK806xxybo3VpZNo4J/dIa2tJPWHr02g2ZiLp4JhDtinD7kia76cJtu\r\naSZuFvVkw/IzPGNu5sv/DjVu6u+522oJF9EG35teIsTfIatdM3dIwapoYkvl\r\nZO5woVHvjJSmzaeSklN15j2OdhT14mOtKT0V5SwKX6ECzj6t559E0w9FI3AZ\r\nIYvA5waANjaoF+4FTzDo1TdLIxJecSyJfkzF5TduV0P66d5J+6OxFVNNwnoO\r\nSJl2xY+5WTTCZv7k+nGpgK4P0Rzpyz3XJHYcPcU18XHZFpdiNtQz5zmqT9ZY\r\n6FlxtMEj7YJodrStq9f/vPmq/2rtIM6V8OM=\r\n=So2n\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"cond","email":"iamaroott@gmail.com"},"directories":{},"maintainers":[{"name":"cond","email":"iamaroott@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/cypress-autorecord_0.0.3_1665135737699_0.5927129055459603"},"_hasShrinkwrap":false}},"time":{"created":"2022-09-08T14:20:28.578Z","0.0.1":"2022-09-08T14:20:28.785Z","modified":"2022-10-07T09:42:17.987Z","0.0.2":"2022-09-08T16:55:13.605Z","0.0.3":"2022-10-07T09:42:17.906Z"},"maintainers":[{"name":"cond","email":"iamaroott@gmail.com"}],"description":"It simplifies mocking by auto-recording/stubbing HTTP interactions and automate the process of updating/deleting recordings.","homepage":"https://github.com/indatawetrust/cypress-autorecord#readme","keywords":["Cypress","http","https","record","playback","mock","vcr"],"repository":{"type":"git","url":"git+https://github.com/indatawetrust/cypress-autorecord.git"},"author":{"name":"Ahmet Şimşek"},"bugs":{"url":"https://github.com/indatawetrust/cypress-autorecord/issues"},"license":"MIT","readme":"> :warning: This project has been modified to run on cypress 10 and above. May not work correctly for versions before cypress 10. For older versions you can try using the main package from which this package was cloned. https://github.com/Nanciee/cypress-autorecord\n\n[![CircleCI](https://dl.circleci.com/status-badge/img/gh/indatawetrust/cypress-autorecord/tree/master.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/indatawetrust/cypress-autorecord/tree/master)\n\n# Cypress Autorecord\n\nCypress Autorecord is a plugin built to be used with Cypress.io. It simplifies mocking by auto-recording/stubbing HTTP interactions and automating the process of updating/deleting recordings. Spend more time writing integration tests instead of managing your mock data. Refer to the [changelog](https://github.com/indatawetrust/cypress-autorecord/blob/master/CHANGELOG.md) for more details on all the changes.\n\n## Getting Started\n\nInstall from npm\n\n```\nnpm install --save-dev @cond/cypress-autorecord\n```\n\nAdd the plugin to the main configuration as follows\n\n```js\nconst { defineConfig } = require('cypress');\nconst fs = require('fs');\nconst autoRecord = require('@cond/cypress-autorecord/plugin');\n\nmodule.exports = defineConfig({\n  e2e: {\n    specPattern: '**/*spec.{js,jsx,ts,tsx}',\n    async setupNodeEvents(on, config) {\n      autoRecord(on, config, fs);\n  \n      return config;\n    },\n  },\n});\n\n```\nTo allow for auto-recording and stubbing to work, require cypress-autorecord in each of your test file and call the function at the beginning of your parent `describe` block.\n\n```js\nconst autoRecord = require('@cond/cypress-autorecord'); // Require the autorecord function\n  \ndescribe('Home Page', () => {\n  autoRecord(); // Call the autoRecord function at the beginning of your describe block\n  \n  // Your hooks (beforeEach, afterEach, etc) goes here\n  \n  it('...', () => {\n    // Your test goes here\n  });\n});\n```\n\nThat is it! Now, just run your tests and the auto-record will take care of the rest!\n\n## Updating Mocks\n\nIn the case you need to update your mocks for a particular test:\n```js\nconst autoRecord = require('@cond/cypress-autorecord');\n  \ndescribe('Home Page', () => {\n  autoRecord();\n  \n  it('[r] my awesome test', () => { // Insert [r] at the beginning of your test name\n    // ...\n  });\n});\n```\nThis will force the test to record over your existent mocks for **ONLY** this test on your next run.\n\nThis can also be done through the configurations by adding the test name in the file `cypress.config.js`:\n\n```json\n  \"autorecord\": {\n    \"recordTests\": [\"my awesome test\"]\n  }\n```\n\nAlternatively, you can update recordings for all tests by setting `forceRecord` to `true` before rerunning your tests:\n\n```json\n  \"autorecord\": {\n    \"forceRecord\": true\n  }\n```\n\n## Removing Stale Mocks\n\nStale mocks that are no longer being used can be automatically removed when you run your tests by setting `cleanMocks` to `true` in the file `cypress.config.js`:\n\n```json\n  \"autorecord\": {\n    \"cleanMocks\": true\n  }\n```\n\n**_NOTE: Only mocks that are used during the run are considered \"active\". Make sure to only set `cleanMocks` to `true` when you are running ALL your tests. Remove any unintentional `.only` or `.skip`._**\n\n## Set Recording Pattern For Cypress Intercept\n\nBy default autorecorder is recording all outgoing requests but if you want to record only specific calls based on pattern(Ex. just record api calls on backend), you can set `interceptPattern` in `cypress.config.js`. it can be string, regex or glob\n\n```json\n  \"autorecord\": {\n    \"interceptPattern\": \"http://localhost:3000/api/*\"\n  }\n```\n\n## How It Works\n\n### How does the recording and stubbing work?\nCypress Autorecord uses Cypress' built-in `cy.intercept` to hook into every request, including GET, POST, DELETE and PUT. If mocks doesn't exist for a test, the http calls (requests and responses) are captured and automatically written to a local file. If mocks exist for a test, each http call will be stubbed in the `beforeEach` hook.\n\n### Where are the mocks saved?\nThe mocks will be automatically generated and saved in the `/cypress/mocks/` folder. Mocks are grouped by test name and test file name. You will find mock files matching the name of your test files. Within your mock files, mocks are organized by test names in the order that they were called. Changing the test file name or test name will result to a disconnection to the mocks and trigger a recording on your next run.\n\n### Can I manually update the mocks?\nMocks are saved as a simple json object and can be updated manually. This is **not** recommended since any manual change you make will be overwritten when you automatically update the mocks. Leave the data management to cypress-autorecord. Make any modifications to the http calls inside your test so that it will be consistent across recordings.\n\n```js\nit('should display an error message when send message fails', () => {\n  cy.intercept({\n    url: '/message',\n    method: 'POST',\n    statusCode: 404,\n    body: { error: 'It did not work' },\n  });\n\n  cy.get('[data-cy=\"msgInput\"]').type('Hello World!');\n  cy.get('[data-cy=\"msgSend\"]').click();\n  cy.get('[data-cy=\"errorMessage\"]').should('contain', 'Looks like we ran into a problem. Please try again.');\n});\n```\n\n## Known Issues\n\n#### Only XMLHttpRequests will be recorded and stubbed\nCypress-autorecord leverages Cypress' built in `cy.route` to handle stubbing, which means that it inherits some limitations as well. This is the disclaimer on the `cy.route` documentation page with some potential workarounds:\n>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 [#95](https://github.com/cypress-io/cypress/issues/95) for more details and temporary workarounds.\n\n## Contributions\nI would really appreciate any help with bug fixes or any new features you think might be relevant! Feel free to submit a PR!\n","readmeFilename":"README.md"}