deinstapel / cursive-tabs

Tabs for gyscos/cursive views 🖥️
BSD 3-Clause "New" or "Revised" License
24 stars 8 forks source link

tests with puppet backend #3

Closed njskalski closed 4 years ago

njskalski commented 4 years ago

Hi! Some time ago I commited a puppet backend to Cursive to facilitate automated tests. There are some examples in njskalski/sly-editor . Have you considered trying this way of testing? It's 100% Rust.

jwuensche commented 4 years ago

Hi Andrzej, thanks for opening an issue about this feature in cursive. :+1: No we haven't considered testing with puppet::Backend yet; in the beginning we wanted to check if everything is actually rendered correctly as we expected on a chosen backend (termion, ncurses etc). Using the cursive built-in test backend would certainly be better (no need to clear tmux sessions and being able to test mouse events properly) and would remove our dependency on things such as jest and tmux in the tests :sweat_smile:. I'm checking right now which options we have to translate our snapshot tests to snapshot like tests with puppet::Backend. But it seems that spawning and sending events are quite more ergonomic than at the moment.

jwuensche commented 4 years ago

So I reimplemented the tests to use the puppet backend. And it works really well :tada: I used your implementation and added the Display trait to ObservedScreens which allows us to use quite easily insta for our snapshot tests. The PR in cursive has already been merged, as soon as a new version is released the tests will be used on the master branch.

Thank you for adding this feature to cursive :+1:

The new tests can be found in the feature/puppet-backend-tests branch :balloon: