DEV Community

CDPhu
CDPhu

Posted on

Release 0.3-External

For release 0.3, we had a few parts that we needed to accomplish in the assignment. This blog post will discuss my experience with contributing to an external repository. The repository of choice was front.

front is the repository for the frontend to the website of the BVPK e.V. In simple terms, it's a static website with some forms for new members and donation functionality. The front- and backend of the application run on Next.js. The project is deployed with docker-compose on a Debian server.

Issue

Issue #3
Part 1:
The author wanted testing for his repository so I tried it out with jest. I wasn't sure what they wanted as they only specified tests. Though I wasn't sure about the tests so I was using the tests to see if they would match the snapshot when being run. I did this for multiple pages. Though I was trying a new method. Instead of just testing the file out right, I had the test file create a snapshot of what was the expected output. It would then compare what it was receiving and compare it with the snapshot. If it did not match then the test would fail.to run the code the user has to use npm run test.

Part 2:
I also decided to also implement end to end tests using playwright. Though this kind of testing was completely new to me. So I had to read the documentation on how playwright is implemented, and how to test e2e. It took a bit of time to understand but, eventually I understood.

So I created basic tests for routing within the home page. So I fired up the server locally using npm run start and looked through some of the routes used on the home page. I've written the test in a way that it would only work once localhost:3001 is being used, otherwise it would fail. to run the code the user has to use npm run test:e2e.

Thoughts

The author never really conveyed how the code should be tested so I had to make due with what I did know how to do. Though straying out of my comfort zone when it came to creating these tests. Using snapshots was completely new to me, had to do a lot of reading using this link. Learning playwright was also an interesting experience, though a welcome one. I now have some experience using a different kind of testing tool.

Top comments (0)