Raathigesh / majestic

⚡ Zero config GUI for Jest
MIT License
7.5k stars 174 forks source link

FR: clicking on a test with a snapshot should open the snapshot for viewing #186

Open gregveres opened 4 years ago

gregveres commented 4 years ago

This is a feature request.

I have started doing unit tests for Vue components and I find that I am opening up the snapshot to see the underlying html that I need to run tests against. This makes it much easier to write the unit tests and to know where to put the "data-test" attributes so that I can use them in my tests.

It would be great if Majestic could recognize that a unit test file has an associated snapshot file and provide a way to show me the snapshot related to a particular test.

It isn't as useful to just display the snapshot file because it could be huge and there could be many snapshots in the file. But each snapshot is prefixed with the unit test that created it. So it would be nice if each unit test that had a snapshot had a little "snapshot" icon beside it's name that was a link to an action that would popup a dialog with the contents of the snapshot.

IPWright83 commented 4 years ago

I used to use WallabyJS quite a bit, one of the really good features that had was an option to open a snapshot in a side-by-side diff (which makes for much easier comparison) and then update the snapshot from the dialog if the new is correct.

gregveres commented 4 years ago

@IPWright83 Yes, that would be a great feature!

gregveres commented 4 years ago

@IPWright83 actually, I am pretty sure it starts flat. When I double checked 2 days ago, I didn't realize that I had overwritten the version I was checking with the unmodified version. I am having trouble building right now, but I will double check that it starts collapsed. The original reason I wanted collapsing in the first place is because i have lots of tests in each file and the list was too long for the screen. I wanted it to start collapsed and only spring up to show errors if there are errors. I am pretty sure I was happy with this type of work flow when I did the PR.

My branch also has a fix for #184. When there is a failed test, clicking on the failed test opens that file in VSCode to the failure. I hadn't submitted that change as a PR because the first PR wasn't accepted and the second PR was built on the first.

gregveres commented 4 years ago

@IPWright83 just in case you are still interested in this, I updated my fork to the latest version from the master fork and then continued enhancing it. It turned out that the tests did default to open, but now on my fork they default to closed. If the maintainer takes the collapse code, then I can create PRs for all the other enhancements that I have done. I think at this point it is pretty close to where I want it. There might be a few more things I will do eventually like a collapse/expand all for the project tree and for the test list.

IPWright83 commented 4 years ago

@gregveres honestly I got a little confused by the expand/collapse discussion with relation to snapshots!