jsnes-web icon indicating copy to clipboard operation
jsnes-web copied to clipboard

Add tests for gamepad support

Open bfirsh opened this issue 6 years ago • 10 comments

There should be some basic automated tests for the gamepad support added in #164. I don't have a gamepad, and I imagine most contributors won't, so it'll be very easy to cause regressions. It is also impossible for me or other contributors to refactor/touch that code because we can't test it.

Once there are some tests, there are some refactorings I have noted in #164 that are probably worth doing.

bfirsh avatar Jan 10 '19 18:01 bfirsh

Ok! I will work on that. I will start by writing tests for GamepadController class (mocking gamepad API) . We need tests for react components that were modified too ?

tario avatar Jan 11 '19 00:01 tario

Awesome thank you! Testing the integration of the modal with the controllers is probably a good idea (I don’t think there is any testing for the custom keyboard commands) but a test for the gamepadcontroller would also be useful. :)

bfirsh avatar Jan 11 '19 13:01 bfirsh

I can't see tests on current version of jsnes-web

So, I will follow this guide https://facebook.github.io/create-react-app/docs/running-tests to start adding the tests. It is ok ? (sorry, I am newbie on react)

tario avatar Jan 11 '19 15:01 tario

No worries! There are a couple really simple ones - the files ending in .test.js in src/.

bfirsh avatar Jan 11 '19 19:01 bfirsh

Great, I will follow the actual scheme then

tario avatar Jan 11 '19 22:01 tario

@tario Seems like the gamepad support is breaking non-webkit browsers too. This error is coming from IE: https://sentry.io/share/issue/b0c3a6b734294b30b6414c548d57a410/

bfirsh avatar Jan 14 '19 21:01 bfirsh

I am sorry to hear that, maybe I should fix that in a separated pull-request. What platforms we should cover ? IE? edge too?

tario avatar Jan 15 '19 00:01 tario

Just tested jsnes.org on edge and IE11 and the gamepad seems to be broken at all. Also tested on https://html5gamepad.com/ and again the gamepad doesn't seems to work at all. Gamepad API should be working on these browsers ?

tario avatar Jan 15 '19 00:01 tario

Anyway. I will fix the case where both getGamepads and webkitGetGamepads are not present. I think I have to code more defensively, sorry

tario avatar Jan 15 '19 00:01 tario