Closed PTaylour closed 6 years ago
Do you have any ideas as to how to test whether a video frame at a given time is the correct frame?
I have attempted to test this using the following method:
From my testing, there is some slight variability in the pixel data between repetitions of this method on the same video, likely due to the lossless nature of the video's compression.
Yes, pretty much exactly.
I was imagining using something like this https://github.com/HumbleSoftware/js-imagediff
Where you set a tolerance https://github.com/HumbleSoftware/js-imagediff/blob/master/js/imagediff.js#L166
I've yet to test this method, but hopefully that's good enough for some useful regression testing.
Do you think there's an opportunity to do anything better?
Setting a tolerance is definitely one possibility, as long as the video chosen is always sufficiently different at each frame.
I noticed when doing some more testing that not every video displays this same behaviour, sometimes the data matches perfectly when using the method described in my previous comment. This is likely due to those videos being encoded somewhat differently to the ones I tested with previously.
Another possibility would be to use one such video as the test data, but the limitation of this approach is that you are limited to testing videos encoded in a specific manner.
We're still thinking about trying cypressio, but for now it is working well enough to be useful and is merged
Moving forward we need to be able to make changes to the code base with greater confidence.
There are a few unit and integration test, but these do not provide enough coverage or clarity of expected behaviour.
So, we need to be able to describe and test how we expect videocontext to behave on a higher level.
eg
A lot of hype around https://www.cypress.io at the moment. It could be a way to achieve this. Ideally, I don't fancy trying to build anything by hand on top of selenium or even headless chrome etc.
I'll track progress on this issue. If anyone has any thoughts or fancies getting involved, please do comment!