Tutorial

End-to-end testing field guide

Gustav Sundin
This is a beginner’s guide to getting started with end-to-end (E2E) testing. It is intended to be read as a high level overview of best practices, as there are already plenty of great and detailed tutorials on various frameworks “out there” on the Internet. This guide uses Cypress as the example testing framework (just because it’s the one I use the most), but the same methodology as described here can be applied using any framework.

Building a custom dialog in Flutter

Flutter’s built in Dialog widgets (also known as popup or modal) such as the AlertDialog are pretty nice, but sometimes you want to build something custom to fit in with your app’s look and feel. In this blog post I will show you how! What we will build Here’s how my custom dialog looks like (screenshot taken from my RPG app Sound Realms: Mace & Magic). You can see that it differs quite a bit from the standard dialog.

Robust end-to-end testing with Docker Compose

Gustav Sundin
End-to-end (E2E) testing is a powerful tool for automated quality assurance. Ideally you want to be able to catch potential errors and bugs already on the unit testing level, but doing so can sometimes be both time-consuming and difficult. Unit testing also relies heavily on mocking out dependencies by nature, so we cannot necessarily guarantee the same behaviour as in our live application. E2E tests are on the other hand often very straightforward to set up and write, and enables us to construct very realistic testing scenarios.

How to use HTTPS on localhost

Gustav Sundin
Sometimes you want to have your application running on HTTPS even when testing it out locally. One common approach is to use a self-signed certificate, but this method has some pitfalls - most notably that any browser will frown upon your certificate and start shouting that it is insecure. A more robust approach is to use a certificate generated by a Certificate Authority (CA). How? Enter mkcert, which lets you act as your own CA.

Token-based authorization in .NET Core 6.0

Gustav Sundin
This blog post describes how to implement token-based authentication and authorization using .NET Core 6.0. The way this works is that when the user is authenticated, a token containing various claims will be stored in the user’s browser. This cookie will be used in subsequent requests, and the claims can be checked on different endpoints in order to provide authorization. Now let’s get coding! Inside Startup.cs, add the following to the ConfigureServices(IServiceCollection services) method:

Setup Raspberry Pi to act as your own web server

Gustav Sundin
In this blog post I will describe how I set up my own web server using just a single Raspberry Pi at home. This is a cheap and fun solution to hosting your own applications, in my case using Docker. Setting up the Raspberry Pi Install the Raspbian OS on your Raspberry Pi’s SD card. In order to connect wirelessly to the Raspberry without having it connect to a monitor, you need to set up headless SSH.

Runtime environment variables in the browser

Gustav Sundin
A limitation to all web development frameworks is that environment variables has to be injected during build time in order to made be available in the browser. If we have packaged our web application using Docker, that means that we would need to build a different container image for each different environment where we will want to host our application. This is a waste of resources and also introduces a risk of us ending up with a different codebase in our production environment than what we tried out in our QA or test environment.

How to build a reverse proxy

Gustav Sundin
In this blog post I will describe how you can deploy services on the same server. The server will be fronted by an NGINX instance acting as a reverse proxy responsible for forwarding incoming traffic to the right service. I will use an EC2 instance on AWS since it has a low monthly cost and I don’t have to worry about hardware maintenance at all, but you can use the same approach for any kind of server.

A short Kubernetes tutorial

Gustav Sundin
Currently I’m learning Kubernetes and Flux. Two of my top three favourite methods for learning something is to write about it and to teach it to someone else. This time I combined the two into a short tutorial on what I have learnt so far. If you are interested, you will find my Kubernetes tutorial on Github!

DNS record types

Gustav Sundin
In this blog post I will briefly explain some of the most common DNS record types. A (address) record: always points to a static IP address. AAAA record: the same as the A type record, but for IPv6 IP addresses. CNAME (canonical name) record: alias to another name (=domain), which can be an A record or another CNAME record. The only exception is that you cannot create a CNAME record in the zone apex (the root of your domain).