vue-qrcode-reader
vue-qrcode-reader copied to clipboard
Write tests
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
andheight
property in the default value forcamera
are not changed (#39). - make sure certain CSS rules are not changed (#55)
- make sure the
Eventually I will tackle this myself but if there is someone with experience I'd really appreciate some help :blush:
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 cool, thanks!
TODO: write a test for: #193
Todo: write test for: #126
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!
This issue has been marked as stale. If there is no further activity it will be closed.