Skip to content

Test/e2e tests #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Test/e2e tests #6

wants to merge 7 commits into from

Conversation

Gennon
Copy link
Contributor

@Gennon Gennon commented Feb 9, 2023

Added some end to end tests using Playwright.

It requires that you are running the api locally on localhost:4000 and the React Intro application on localhost:3000.

This is meant to be part of the course so that the students can have a look at how it is possible to do e2e tests.

It is not optimal, but it will highlight some useful methods in testing.

@Gennon Gennon requested review from anhtin and susansem February 9, 2023 08:27
@@ -37,34 +37,35 @@ fastify.get("/colleagues/:id", (req, res) => {
});

fastify.post("/colleagues", (req, res) => {
const colleague = JSON.parse(req.body);
const colleague = req.body;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note, req.body defaults to a string if the request does not specify Content-Type: application/json. Might want to add if-statements checking the header and manually deserialize the body or return 415 Unsupported Media Type when content type is something else. Some of the previous participants were confused when seemingly correct requests didn't go through as they weren't aware that the header is neccessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants