KeziahMoselle / tempus

⏳ A simple yet featureful pomodoro in the tray/menubar
https://tempus.keziahmoselle.fr/
MIT License
124 stars 14 forks source link

Add unit tests #76

Open KeziahMoselle opened 4 years ago

KeziahMoselle commented 4 years ago

https://electronjs.org/spectron https://github.com/testing-library/react-testing-library

Tests that needs to be written : Test cases

ghost commented 4 years ago

I've forked, cloned and ran the application (nice work By the way!) and will implement some react unit tests for you.

KeziahMoselle commented 4 years ago

I'm glad you like it ! Thank you ! If you have any question don't hesitate to ask them :D

ghost commented 4 years ago

Hi there! After getting everything setup, and calling a render() function from a test, I am getting an error regarding the electron API:

TypeError: Cannot read property 'on' of undefined

  36 | 
  37 |     // Listeners from the Tray menu
> 38 |     window.ipcRenderer.on('start', () => {
     |                        ^
  39 |       if (this.state.state === '') {
  40 |         this.start()
  41 |       } else {

I've tried importing the ipcRenderer into the react files and I can't seem to find any other supporting documentation on using the react-testing-library w/ electron. Do you know of other projects that have used the two frameworks together? I'm going to give it another investigation in a little bit, but thought I'd check with you as well.

KeziahMoselle commented 4 years ago

Maybe we can use this : Spectron ? Also there is a complete boilerplate that uses Jest and React Testing Library, maybe we can get some inspiration from there https://github.com/react-boilerplate/react-boilerplate

ghost commented 4 years ago

Oh sweet! It looks like that will solve our problem! I can boot up the app with spectron and it looks like I can even use selenium within that (which is what I use at work). I could probably do quite a bit of testing for you too since I have experience with selenium. I'll send a PR with the basic framework and then continue building it out after that. thanks!

KeziahMoselle commented 4 years ago

Nice ! Thank you so much :smile:

KeziahMoselle commented 4 years ago

Managed to make it work ! preview

This is being worked on #79

ghost commented 4 years ago

Dude! Nice work! If i can i'll try to get it running on my machine again. I have become very busy at work though, so no guarantees! But well done again!!

KeziahMoselle commented 4 years ago

Thank's ! I don't have access to the Electron module for the tests in src so it's only to test the logic of the app and in public it have access to the modules but it still needs some configuration !