eoger / tabcenter-redux

Vertical Tabs extension for Firefox
Mozilla Public License 2.0
381 stars 67 forks source link

Investigate testing #318

Open eoger opened 6 years ago

eoger commented 6 years ago

We need to be able to make changes without fear to regress everything, especially since the code is getting refactored thoroughly (e.g. https://github.com/eoger/tabcenter-redux/issues/296 where we refactor the positioning system). For example, I'd like a test that opens/close/drag-and-drops a bunch of tabs and checks against the browser state if we're in sync. It's a bit tricky since we are in a web extension context, but I think it should be doable.

eoger commented 6 years ago

Update: we now have basic tests (https://github.com/eoger/tabcenter-redux/commit/d1ef99fe9945b4b8a97c63be20dd6964ec4a1010). The way they are implemented is terrible, but they still helped me land a pretty risky patch and will catch regressions in the future if we decide to do more scary work.

I still think we should have tests that run out of the browser context, see https://github.com/stoically/webextensions-jsdom which with a little bit work (well, mostly have better mocks for browser.tabs) can work (I'll try to post a POC in the future). I'd be happy to mentor someone to work on this if you're interested.