Page Object Model (POM) is a design pattern, popularly used in test automation that creates Object Repository for web UI elements. The advantage of the model is that it reduces code duplication and improves test maintenance.
This story is a tutorial on what use Puppeteer, TypeScript, and Jest to write a simple end-to-end test (E2E). The tutorial will write some tests to cover some simple test cases. The tutorial also uses Page object modal pattern to complete these test cases.
We will use a demo e-commerce website — https://www.saucedemo.com/.
With this website, we can write completed examples for the Login…
Sometimes, we have to implement face recognition or face landmark. With face-api.js, we can do this with just a few lines of code.
In the face-api.js repository, we can find examples for both browser and Node.js environments. They look simple enough for us. Let’s see what you can do with them.
In this story, we will try to implement a complete example that uses face-api.js and face landmark model to “Glassify” faces in an image.
$ mkdir ts-faceapi-glassify
$ code ts-faceapi-glassify…
PM2 is a production process manager for Node.js applications with a built-in load balancer. It allows you to keep applications alive forever, to reload them without downtime and to facilitate common system admin tasks.
With PM2 CLI, you can manage your Node.js processes on your local server. If you have an online server (public with internet), you can use keymetrics service to manage your processes everywhere.
Maybe these features are enough for “normal” cases. But sometimes, your project requires a simple web interface to manage all Node.js in a local server. Or the project requires a processes manager module as…
Asynchronism may be a complicated thing. But it is definitely worth spending your time learning about, that is, if you want to build a backend system that is scalable. And create a frontend that facilitates good user experiences.
A notification system is a good example. When you want to send a notification to all users, maybe that task will take a lot of time. You don’t need to wait until the task is completed and you want to do something else at that time. A system that can handle the task asynchronously will solve your problem.
node_modulesfolder with all related packages.
layer. Almost the same as the second way. But now,
node_modulesis not a part of the function code. The function will run on the layer.
In the article, we will not deep drive to explain this topic. Just…
In this article, we will talk about starting a project with Serverless and TypeScript. The article requires basic knowledge about AWS serverless architecture, the Serverless framework, and TypeScript.
We will use the latest stable version of Serverless (2.35.0) to build a “simple” serverless project — A REST API with AWS Lambda function and API gateway.
$ mkdir ts-jest-serverless
$ cd ts-jest-serverless
$ npm install serverless --no-save
Install the serverless package with
--no-save option to avoid creating
package.json file. In the next part, we will use a template to initiate the project.
This is an easy way…
Follow this example code, we are going to build a web service that includes an API. …
This is just my recommendation. I started working with Typescript in 2017, then I become a TypeScript lover. My team members love it too.
The primary benefits of using TypeScript are to catch more errors before they go into production and make it easier to work with your codebase.
As you know, jwt tokens are born as a stateless entity. By itself, we can validate a jwt token just by a secret token and its expire time.
However, sometimes our service requires a token to become stateful, which means we can make a jwt token to be invalid in our service.
A particular case is when your service user login to the service, the service will generate a jwt token for the user, and the user can use this token to authenticate for other requests. A user can use their credential (username/password) to get a new jwt token every…
This is a simple project — Writing an API service running on Nodejs. The service is a URL shortening service. The service also is an example of TDD style using Typescript, Jest, Express, and Mongoose.
This project will be base on TDD with Typescript and Jest: Starter project.
Just clone the starter project from Github:
$ git clone https://github.com/hoangsetup/ts-jest-tdd-starter.git url-shortener
$ cd url-shortener
$ npm ci
url-shortener is the name of this project. You also can update the project name in
First of all, let’s install some…
Just A Cat Lover