Posts

Showing posts with the label e2e testing

Guide to Setting Up Playwright E2E Testing in NextJS

Image
Introduction Playwright is a powerful automated testing framework developed by Microsoft, allowing for End-to-End (E2E) testing across modern browsers such as Chromium, Firefox, and WebKit. Key advantages include fast execution speed due to its event-driven architecture, auto-wait capabilities that reduce "flaky" errors, default support for parallel execution, and the Codegen tool which helps generate automated test scripts by recording user interactions. Prerequisites This article is a continuation of my previous posts, so I will not provide the test code files again; please review them to have the source code ready before proceeding. Detail First, if your project does not have Playwright yet, you can set it up quickly as follows; this command will install the necessary packages and create a config file along with demo test files: yarn create playwright Or install the following packages manually: yarn add -D @playwright/test yarn playwright install Update playwright.c...

Basic and effective NestJS Testing implementation guide

Image
Introduction Implementing testing in software development not only helps detect bugs early but also ensures system stability when performing upgrades or changing code. Testing helps programmers feel more confident, minimizes logic error risks, and creates a living document of how modules operate. In NestJS, we usually focus on three main concepts: Unit Test helps test each class or function independently End-to-End (e2e) Test tests the entire operation flow from request to response through a real server Test Coverage is an index measuring the percentage of source code that has been tested by test suites. Prerequisites In this article, I will continue to use the code from previous articles to implement tests; you can review those articles to get the source code to continue, or you can write similar tests based on the content according to your needs. Detail Update file package.json, focusing on the jest field { "jest" : { "moduleFileExtensions" : [ "j...