{"_id":"cypress-time","_rev":"1-1eb4b2d5719987db3b1112785bb9a087","name":"cypress-time","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"cypress-time","version":"1.0.0","description":"Record timings in Cypress","main":"index.js","types":"index.d.ts","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/NicholasBoll/cypress-time.git"},"keywords":["cypress","time","timings","performance"],"author":{"name":"Nicholas Boll"},"license":"MIT","bugs":{"url":"https://github.com/NicholasBoll/cypress-time/issues"},"homepage":"https://github.com/NicholasBoll/cypress-time#readme","devDependencies":{"cypress":"^4.0.1"},"gitHead":"17af3f9285aa6845be2400fff78f0b5ea835efeb","_id":"cypress-time@1.0.0","_nodeVersion":"10.16.3","_npmVersion":"6.9.0","_npmUser":{"name":"nicholasboll","email":"nicholas.boll@gmail.com"},"dist":{"integrity":"sha512-xLZXeuQprOfSfT6gVN1ShUt2aMtjK/tv+len6Kubb9n1Luh7yzKLxt6R4hH7dfivqXAT/0kTFNUPUulx/Sp/hg==","shasum":"f5273c7e7aba5d90a98156863eecc093891ea3ea","tarball":"https://registry.npmjs.org/cypress-time/-/cypress-time-1.0.0.tgz","fileCount":12,"unpackedSize":294392,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeRxdFCRA9TVsSAnZWagAAxRwP+gL3X9GOJfL9lvGKv5A8\nY19H7QrsQtVm/erhr6AbajmHvq7tGMetojbSw6Y3l8tlQPIq9rpSohoRqb6h\nHI9vWS2LQltwmLWAv929AvFbWKWX/jl+yBmHFdmBpxrIk0RT6wf47hYZY3AU\n9iBinYi7U5UXFvaA9IduEBraPDPYEhiGm+qIAbmCNJ4x0mfPA5qMy9cCl3l0\na5Ozs/KH2vCquFbsE6GqiGLwudrMRCKPtcmq76+thtIpzVsxWBaHIkb+OINM\nrWOiQqyHtJMSa2gJxzhzdUbRe/Z2xLlQzewiwWVCuiiCH9icUzYGQnLn990u\nEkESRVHwexrkULoJqQHFgUjsExYFvpHHdQRlOkb5ysnkP2z2B5dDDaOHDBHp\nl1AQvBaGqZ38+LGVlTlZsjzlQnCgGW4rskVEHs897RhykiAyanaLOPwQieEn\nLBbQz3V1rj/KAn0wMdt6CwJidbgzN9/CMGVT0DCSNZ2y/VEQ2ANtrNGdH5eO\nCP5tZEuFTIsfeaCnIb2syGydaW4kumFXvFZ80PyQ60y8JbEuvrzc6V/aFb9r\n8yPk3bNtSskxkWDjNJg6JeUYRA0mgZHVEnFP8hUovm3/jr9crmfpgmRfKduL\nqn9Xm0f+dbmzRxbIsMuUlWdYaDBlUQvMIF4W1ziRGfSbXiAg/8UInpUnpVxv\n2i6L\r\n=QxZI\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBXiTV5XcQnQRtSXTeIH3a3zQ/MHjWHmx+TH1JsISK1pAiEAoh0khuzlZBmXwminRfRU8IEJOD184wylnZOpIC4ZINQ="}]},"maintainers":[{"name":"nicholasboll","email":"nicholas.boll@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/cypress-time_1.0.0_1581717316687_0.3879729546980233"},"_hasShrinkwrap":false}},"time":{"created":"2020-02-14T21:55:16.687Z","1.0.0":"2020-02-14T21:55:16.890Z","modified":"2022-04-28T02:40:51.843Z"},"maintainers":[{"name":"nicholasboll","email":"nicholas.boll@gmail.com"}],"description":"Record timings in Cypress","homepage":"https://github.com/NicholasBoll/cypress-time#readme","keywords":["cypress","time","timings","performance"],"repository":{"type":"git","url":"git+https://github.com/NicholasBoll/cypress-time.git"},"author":{"name":"Nicholas Boll"},"bugs":{"url":"https://github.com/NicholasBoll/cypress-time/issues"},"license":"MIT","readme":"## cypress-time\nRecord timings in Cypress\n\n## Why?\nSometimes you want to record how long a series of tasks/actions take. When developing, you might use browser-based time spans to give you feedback. This Cypress plugin will give you a nice way to do timings right in your test! This library uses the [User Timings API](https://developer.mozilla.org/en-US/docs/Web/API/User_Timing_API), so the time span will show up if you run a performance profile while the test is active (can only be done using `cypress open` which is dev mode).\n\n## Installation\nTo install the module:\n```\nnpm install cypress-time --save-dev\n```\n\nTo get the plugin working with Cypress:\n```js\n// cypress/support/index.js or cypress/support/index.ts\nimport 'cypress-time'\n```\n\n## Use\nIn your spec files, `cy.time(label)` will start a time span while `cy.timeEnd(label)` will end a time span. `cy.timeEnd` will return a [PerformanceEntry](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEntry).\n\n```js\n// start the 'test' time span\ncy.time('test')\n\ncy.contains('button', 'Submit').click()\n\n// wait until submit is complete - assume a backend is involved\ncy.get('Loading').should('not.exist')\n\n// ends the 'test' time span, printing the duration\ncy.timeEnd('test')\n```\n\nIf you want to do something with the time output, the [PerformanceEntry](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEntry) is returned. You can save this to a file, send it off to a service, or whatever you'd like. `startTime` and `duration` may be of the most interest.\n\n```js\ncy.time('test')\n\n// do something\n\ncy.timeEnd('test').then(entry => {\n  console.log(entry.startTime) // start in ms elapsed since page loaded\n  console.log(entry.duration) // duration between `time` and `timeEnd`\n})\n```\n\n**Here's a screenshot of what the command log will look like:**\n![Cypress Command Log](./time-span-command-log.png)\n\n**Here's a screenshot of the Performance tools with the 'test' time span:**\n![Performance Tab of Time Span](./time-span-performance.png)\n\n## Typescript support\nThis plugin comes with its own type definitions. If you're using Typescript already and your support index file is a Typescript file and your tsconfig.json is configured to include *.ts files in the support directory, nothing more needs to be done. If you don't have your project set up this way, add the following to your tsconfig (ideally in `cypress/tsconfig.json`):\n\n```json\n{\n  \"types\": [\"cypress\", \"cypress-time\"]\n}\n```\n","readmeFilename":"README.md"}