vue-qrcode-reader icon indicating copy to clipboard operation
vue-qrcode-reader copied to clipboard

Write tests

Open gruhn opened this issue 6 years ago • 5 comments

I frequently re-introduce bugs I already fixed when releasing new features. I always do a lot of manual testing to reduce this but that's annoying and time consuming. I should really learn how to write automated tests but I don't know how to approach this with this component. How to simulate a camera in a test environment?

Stuff I'd like to have covered somehow:

  • the component should render correctly
    • the wrapper element should take up all the width available
    • everything inside should occupy space according to the cameras resolution:
      • If more space is available, it should be horizontally centered
      • If there is less space, it should be scaled down
      • It shouldn't collapse but maintain its size even when the stream is cut off or while a new stream is requested
    • when the camera is not actively streaming (due to paused="true", camera="false", ...) the last received frame should be visible.
  • props and events should behave as documented of course
  • document quirks of the different browsers and platforms using tests
    • make sure the width and height property in the default value for camera are not changed (#39).
    • make sure certain CSS rules are not changed (#55)

Eventually I will tackle this myself but if there is someone with experience I'd really appreciate some help :blush:

gruhn avatar Sep 08 '18 19:09 gruhn

chrome has built in fake video capture:

chrome --headless --use-fake-ui-for-media-stream --use-fake-device-for-media-stream --use-file-for-fake-video-capture=/absolute/path/to/onlyThisFormatIsSupported.y4m --remote-debugging-port=9222 https://gruhn.github.io/vue-qrcode-reader/

Then browse localhost:9222. That solves perhaps 10% of the problem.

avishayp avatar Oct 29 '18 20:10 avishayp

@avishayp cool, thanks!

gruhn avatar Oct 29 '18 20:10 gruhn

TODO: write a test for: #193

gruhn avatar Jul 29 '20 06:07 gruhn

Todo: write test for: #126

gruhn avatar Aug 06 '20 07:08 gruhn

Hi, I don't known if you've already heard of this but recently Cypress released Component testing, I think this could be really useful for testing these components!

deraw avatar Jun 07 '21 14:06 deraw

This issue has been marked as stale. If there is no further activity it will be closed.

github-actions[bot] avatar Aug 11 '23 00:08 github-actions[bot]