Skip to content
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

NextJs Unit Testing and End-to-End Testing with Vitest, React Testing Library, and Playwright #1355

Open
1 task done
ArafatAbdussalam opened this issue Apr 16, 2024 · 18 comments
Assignees
Labels
In progress Tutorial being created Intermediate Expertise

Comments

@ArafatAbdussalam
Copy link

ArafatAbdussalam commented Apr 16, 2024

Content Brief:

What is your article idea?

This article entails the implementation of unit testing in React vite web applications. It discusses the meaning of unit testing, and how to write unit tests with Jest and React Testing Library. It explains how to use matchers and queries, test user interactions, asynchronous operations, and react-router web applications.

What are the objectives of your article?

Target audience: Web application developers, individuals involved in testing react web applications

Keywords: web development, unit testing, react, react-router, spa

Content objective:

This tutorial aims to teach web application developers how to write unit tests in their React Vite web applications. It further explains how to test user interactions, asynchronous functions and, react-router single-page applications.

Content Outline:

  • Introduction
    • What is unit testing?
    • The importance of unit testing
    • Unit testing libraries
  • Prerequisites
  • Overview of Jest and React Testing Library
  • Setting up React vite, Jest, and React Testing Library
  • Matchers and Queries
  • Testing Asynchronous Operations
  • Testing User Interactions
  • Testing React Router
  • Conclusion
  • Resources

What is your expertise as a developer or writer?

Intermediate

What type of post is this?

Tutorial

Terms & Conditions

  • I have read the Write for the Community program guidelines.
@ArafatAbdussalam
Copy link
Author

Hello @Theodore-Kelechukwu-Onyejiaku I would be glad if you could check this proposed article.

@Theodore-Kelechukwu-Onyejiaku
Copy link
Collaborator

Hi @ArafatAbdussalam,

Thank you for your outline. It appears that this article will primarily cover plain React. Nonetheless, we would prefer if it could be about NextJs. Kindly share your thoughts on this.

@ArafatAbdussalam
Copy link
Author

ArafatAbdussalam commented Apr 17, 2024

Alright. That is cool. I will proceed with the content online on Unit Testing in NextJs (JavaScript) with Jest and React Testing Library.

@ArafatAbdussalam
Copy link
Author

ArafatAbdussalam commented Apr 17, 2024

  • Overview of NextJs
  • Overview of Unit Testing
  • Comparison of Unit Testing with other Testing Methods
  • Prerequisites
  • Overview of Jest and React Testing Library
  • Installation and Setup
  • Understanding matchers and queries
  • Understanding Mocking
  • Writing Tests
  • Conclusion

Here it is @Theodore-Kelechukwu-Onyejiaku

@Theodore-Kelechukwu-Onyejiaku
Copy link
Collaborator

Hi @ArafatAbdussalam ,

Thanks for the updated outline. It seems you are missing the vite part of the topic. Can you also include Vitest, along with Jest for Unit Testing and perhaps a little on E2E tests, since Vitest can't run async components (server components) but synchronous server components.

I would also suggest building a project and implementing the testing using the different testing tools. This might be an intermediate tutorial depending on the outcome of your draft.

Please let me know what you think.

@ArafatAbdussalam
Copy link
Author

ArafatAbdussalam commented Apr 18, 2024

Unit Testing and End-to-End Testing in NextJs (JavaScript) with Vitest, Jest, and React Testing Library

  • Introduction
  • Overview of Unit Testing
  • Overview of End-to-End Testing
  • Comparison of Unit Testing and End-to-End Testing
  • Prerequisites
  • Overview of NextJs
  • Overview of Jest, Vitest, and React Testing Library
  • Overview of the project to be tested
  • Project Setup and Installation
  • Testing Synchronous Components
    • Brief Overview of Synchronous Components
    • Writing unit tests for synchronous components with Jest and React Testing Library
  • Testing Asynchronous Components
    • Brief Overview of Asynchronous Components
    • Writing End-to-End Tests for asynchronous components with Vitest and React Testing Library
  • Avoiding common pitfalls when writing unit tests and end-to-end tests
  • Conclusion

@ArafatAbdussalam
Copy link
Author

Hi @Theodore-Kelechukwu-Onyejiaku The content outline has been updated

@Theodore-Kelechukwu-Onyejiaku
Copy link
Collaborator

Hi @ArafatAbdussalam ,

Please go ahead. Thank you!

@ArafatAbdussalam
Copy link
Author

Alright.

@Theodore-Kelechukwu-Onyejiaku
Copy link
Collaborator

Hi @ArafatAbdussalam ,

Please what is the status of this work?

@Theodore-Kelechukwu-Onyejiaku
Copy link
Collaborator

Hi @ArafatAbdussalam ,

I hope you are doing fine. Please, what is the status of this draft?

@ArafatAbdussalam
Copy link
Author

Hi @Theodore-Kelechukwu-Onyejiaku I am doing well and fine. This is the article I talked about as regards the glitch I was experiencing.

I will commence working on it now.

@Theodore-Kelechukwu-Onyejiaku
Copy link
Collaborator

Hi @ArafatAbdussalam ,

Thanks for your contribution. Please may I know the status of this article?

@ArafatAbdussalam
Copy link
Author

Hi @Theodore-Kelechukwu-Onyejiaku I have already started working on it. I switched to using Vitest, React Testing Library and playwright. Vitest is faster than Jest and can be integrated easily with other Testing framework.

@Theodore-Kelechukwu-Onyejiaku
Copy link
Collaborator

Hi @ArafatAbdussalam, I hope all is well! Could you please share an update on when this will be ready? Do you anticipate it being completed this week, or should we look to next week? It’s been pending for a while now and would be great to wrap it up.

Thanks so much for your help!

@DevvEmeka
Copy link

Hi @ArafatAbdussalam, I hope all is well! Could you please share an update on when this will be ready? Do you anticipate it being completed this week, or should we look to next week? It’s been pending for a while now and would be great to wrap it up.

Thanks so much for your help!

@Theodore-Kelechukwu-Onyejiaku Please can I work on this article? I have written similar articles and have the expertise and knowledge in NextJS to get the article ready as at when needed. I will be waiting for your response. Thank you.

@ArafatAbdussalam
Copy link
Author

ArafatAbdussalam commented Dec 10, 2024

@ArafatAbdussalam
Copy link
Author

Hi @ArafatAbdussalam, I hope all is well! Could you please share an update on when this will be ready? Do you anticipate it being completed this week, or should we look to next week? It’s been pending for a while now and would be great to wrap it up.
Thanks so much for your help!

@Theodore-Kelechukwu-Onyejiaku Please can I work on this article? I have written similar articles and have the expertise and knowledge in NextJS to get the article ready as at when needed. I will be waiting for your response. Thank you.

No @DevvEmeka You cannot work on this article. I've completed it. Thanks.

@ArafatAbdussalam ArafatAbdussalam changed the title Unit Testing in React vite web applications with Jest and React Testing Library Unit Testing and End-to-End Testing with Vitest, React Testing Library, and Playwright Dec 10, 2024
@ArafatAbdussalam ArafatAbdussalam changed the title Unit Testing and End-to-End Testing with Vitest, React Testing Library, and Playwright NextJs Unit Testing and End-to-End Testing with Vitest, React Testing Library, and Playwright Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
In progress Tutorial being created Intermediate Expertise
Projects
None yet
Development

No branches or pull requests

3 participants