<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Hendrik Wallbaum on Medium]]></title>
        <description><![CDATA[Stories by Hendrik Wallbaum on Medium]]></description>
        <link>https://medium.com/@hendrikwallbaum?source=rss-8d46280441de------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*7xywxd05ARGqttHX.</url>
            <title>Stories by Hendrik Wallbaum on Medium</title>
            <link>https://medium.com/@hendrikwallbaum?source=rss-8d46280441de------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 07:57:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@hendrikwallbaum/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Trying my hands at Deno 1.0]]></title>
            <link>https://medium.com/@hendrikwallbaum/trying-my-hands-at-deno-1-0-f16c5750dc0b?source=rss-8d46280441de------2</link>
            <guid isPermaLink="false">https://medium.com/p/f16c5750dc0b</guid>
            <category><![CDATA[deno]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Hendrik Wallbaum]]></dc:creator>
            <pubDate>Wed, 27 May 2020 11:13:19 GMT</pubDate>
            <atom:updated>2020-05-27T18:58:09.746Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*uiozgC-blIf6aUrU.png" /></figure><p>Following the release of <a href="https://deno.land/v1">Deno v1.0</a> I got excited to try my hands at it. These are my first experiences writing a simple tool in Deno.</p><p>A super fast introduction to <a href="https://deno.land/">Deno</a>:<br> Deno is the spiritual successor of Node trying to fix <a href="https://www.youtube.com/watch?v=M3BM9TB-8yA">design mistakes</a> that were made early on but recognized only late into the project. Deno supports TypeScript out of the box and relies on web-standards. In Deno you can import ES modules from any URL and use fetch like you would in the browser. To help unify the community on processes and workflows Deno provides a wide array of <a href="https://deno.land/std">stdLibs</a> and has build in solutions for bundling, testing and code formatting. You can read more in the <a href="https://deno.land/v1">Deno v1 release post</a>.</p><p>To try my hands at Deno and collect some experience on how ready it is I decided to implement a simple cli. The goal: read all markdown files in the current directory, parse them to HTML, add a navigation and output them into a new folder. I also decided to use <a href="https://newcss.net/">new.css</a> as a class-less CSS library to style the pages.</p><p>You can go and checkout the <a href="https://github.com/HoverBaum/md_website/tree/v1.0.0">finished repo</a> or an <a href="https://md-website-example-nugz74lgw.now.sh/">example website created</a>.</p><h3>Organizing</h3><p>First things first. A plan on how to implement the described tool. We will tackle it through the following steps:</p><ol><li>Walk through all files in the directory, getting a list of markdown files.</li><li>Iterate over all those files and parse them into HTML.</li><li>Add a navigation and header to each page.</li><li>Output the files.</li></ol><p>While following these steps we will see Denos features in action. Let’s get started.</p><p>If you are a VSCode user I highly recommend the <a href="https://marketplace.visualstudio.com/items?itemName=justjavac.vscode-deno">Deno extension for VSCode</a></p><h3>Getting the files</h3><p>First we need to walk through the files and find all the markdown ones. Lucky for us Denos fs stdLib includes a <a href="https://deno.land/std/fs#walk">walk</a> function that does just that.</p><p>The docs also tell us how to use this correctly:</p><p>But we only want markdown files and maybe set some more options for this.</p><p>After some digging I found the available options in <a href="https://deno.land/std/fs/walk.ts">walks source</a>. Which makes this entire thing feel quite immature. But equipped with that knowledge I arrived at a function to get all markdown files from a directory.</p><p>Feel free to correct my coding here (still new to generator functions).</p><p>On the way though I noticed that the docs were incorrectly not providing a path (e.g: &quot;.&quot;) as the first argument to walk. Quickly opened a <a href="https://github.com/denoland/deno/pull/5668">PR to update the docs</a> so the next person won&#39;t face the same half hour of struggling.</p><p>Outputting the result we have our list of files that we want to work with, Step 1 ✅</p><h3>Parse the markdown files to HTML</h3><p>There are a TON of libraries on NPM that you can use to parse Markdown into HTML. Sadly they do not export ES Modules…</p><p>After spending some time digging through <a href="https://www.pika.dev/">pika.dev</a> which feel like as close as you can currently get to a central place of searching for ES Module dependencies, I was stuck. For some time I tried different libraries, importing them in different ways but usually they were missing some dependency. There is currently an initiative to support Node modules in Deno but it’s still underway. And most NPM packages simply are not ES Modules.</p><p>In the end I found <a href="https://github.com/developit/snarkdown">snarkdown</a> which didn’t have any active development for a year and only supports very basic markdown parsing. It will be good enough for this example project but no where near anything I would want for a real project.</p><p>Bringing it in via pika was a breeze and I also enjoyed playing around with the <a href="https://www.pika.dev/npm/snarkdown/repl">REPL feature on pika</a>.</p><p>It’s not sophisticated, it took waaaaay longer than I would want to find a module to use, but parsing is working. Step 2 ✅</p><h3>Add a navigation</h3><p>This is the part where native TS support becomes awesome. You might have seen in the code above that I created some types for the objects I am handing around. Thanks to that it is just super easy to know what exactly I have available later down the pipe.</p><p>On a side note a painful lesson I learned in an earlier project is that collecting all items is a necessity for supporting features like a navigation in a markdown to static website tool.</p><p>Equipped with that and some String Literals we can easily wrap the created HTML inside a whole HTML page with a nice title, navigation and inclusion of the new.css styles.</p><p>And we have files with a navigation and styling, ready to be saved. A simple step, without dependencies. Greatly aided through TypeScript, Step 3 ✅</p><h3>Saving new files</h3><p>Here I started to get into the thick of things where in the end I searched for help on <a href="https://discord.gg/deno">Denos Discord</a>.</p><p>In theory Deno also has a stdLib to save files. It’s also part of fs and called <a href="https://deno.land/std/fs#writefilestr">writeFileStr</a>. The docs are also straight forward, just import it all from the mod.ts file. That is the current convention to export a module for Deno; create a mod.ts that exports everything.</p><p>Unfortunately just using an import as the docs say gave me an error at runtime. Reading through the <a href="https://deno.land/std/fs#usage">docs</a> I realized that:</p><blockquote><em>All the following modules are exposed in mod.ts This feature is currently unstable. To enable it use deno run — unstable</em></blockquote><p>Okay so I have to use --unstable, that&#39;s gonna make my little tool look trustworthy to users. But, let&#39;s give it a go.</p><p>After trying that I ran into the next error….</p><p>This time, even though I am importing all the modules from master there seems to currently be an incompatibility. Luckily the stdLibs come versioned and the version can be added to the URL to fix all dependencies to the same. There is an <a href="https://github.com/denoland/deno/issues/5175">issue about this</a>, if you want to dive deeper into the topic.</p><p>Long story short: after some friendly discussions on and great help from Denos Discord server I opted to fix the versions of my dependencies and import them from the sub modules to not force my users to use --unstable.</p><p>It was an adventure that taught me a lot about Denos state and internals but finally, Step 4 ✅</p><p>And we can move onwards to using the tool.</p><h3>Using it</h3><p>With Deno installed you can try the tool right now.</p><pre>deno run --allow-read --allow-write <a href="https://raw.githubusercontent.com/HoverBaum/md_website/v1.0.0/index.ts">https://raw.githubusercontent.com/HoverBaum/md_website/v1.0.0/index.ts</a></pre><p>Deno can simply run scripts from URLs which feels refreshingly easy to get started with. The above uses a version to make sure it keeps being the tool this post talks about.</p><p>You can also install the script and make it generally available on your machine using the following commands.</p><pre>deno install --allow-read --allow-write --force --name mdw <a href="https://raw.githubusercontent.com/HoverBaum/md_website/v1.0.0/index.ts">https://raw.githubusercontent.com/HoverBaum/md_website/v1.0.0/index.ts</a></pre><p>This will install version 1.0.0. It also sets permissions that the tool needs to run. We need read and write access to read the Markdown files and write the parsed HTML. --force makes sure to replace previous installations and --name mdw aliases the cli to mdw in your terminal.</p><h3>Conclusion</h3><p>On this journey I go to explore many aspects of Deno, learn a lot and build a fun little tool. All in all I enjoyed working with Deno. But let’s take a closer look at where things are at.</p><h4>Standardisation and Modules</h4><p>Deno is just starting out with v1.0 being about a week old at time of writing this. And Deno opted to not use a central repository but instead distributed hosting. We will need to see whether federations of Module repositories arise that can leverage the potential of this distributed architecture or if Pika (or similar) will rise to be the NPM for Deno.</p><p>The bigger issue I found in my small project was the unavailability of ES Modules to support my usecase. That might have been something specific for me though. Generally I am a huge fan of going with Webstandards as they are here to stay and I think this issue will continue to grow smaller, as everyone races to build the “awesome X for Deno” Module.</p><h4>Community</h4><p>Denos community is currently hyper-active, as everyone is racing to build the cool things and new standards for X in Deno. I experienced the GitHub issues to be active and the Discord server to be a welcoming place.</p><p>There are a couple of discussion points that have potential to split the community, like distributed dependencies but all in all I feel Denos community is a great and growing one.</p><h4>Last words</h4><p>Developing my first little tool in Deno was fun. The entire ecosystem does not yet feel production ready, even though it reached v1.0. But Deno is surely a technology you want to keep on your radar and evaluate.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/160/1*wK6VjaewmVEie7MfTzf_mA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f16c5750dc0b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Trying my hands at Deno 1.0]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@hendrikwallbaum/trying-my-hands-at-deno-1-0-b8b717b25a51?source=rss-8d46280441de------2"><img src="https://cdn-images-1.medium.com/max/1000/0*6KyQa6gkmNNF2tSd.png" width="1000"></a></p><p class="medium-feed-snippet">Following the release of Deno v1.0 I got excited to try my hands at it. These are my first experiences writing a simple tool in Deno.</p><p class="medium-feed-link"><a href="https://medium.com/@hendrikwallbaum/trying-my-hands-at-deno-1-0-b8b717b25a51?source=rss-8d46280441de------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@hendrikwallbaum/trying-my-hands-at-deno-1-0-b8b717b25a51?source=rss-8d46280441de------2</link>
            <guid isPermaLink="false">https://medium.com/p/b8b717b25a51</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[deno]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Hendrik Wallbaum]]></dc:creator>
            <pubDate>Wed, 27 May 2020 11:13:19 GMT</pubDate>
            <atom:updated>2020-05-27T19:01:08.395Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Words of magic]]></title>
            <link>https://makeitnew.io/words-of-magic-41aed00e71f9?source=rss-8d46280441de------2</link>
            <guid isPermaLink="false">https://medium.com/p/41aed00e71f9</guid>
            <category><![CDATA[organisation]]></category>
            <category><![CDATA[writing]]></category>
            <category><![CDATA[organisational-culture]]></category>
            <category><![CDATA[lightnet]]></category>
            <dc:creator><![CDATA[Hendrik Wallbaum]]></dc:creator>
            <pubDate>Sun, 12 Jan 2020 11:45:17 GMT</pubDate>
            <atom:updated>2020-01-12T11:45:17.758Z</atom:updated>
            <content:encoded><![CDATA[<p>Words. They carry a kind of magic. A good story will always have us clinging to the teller’s lips. The right word will rally a movement. The wrong one will get us into deep trouble. Three simple words can change our life.</p><p>Words shape us, they form who we are and what we will become. Throughout fictional literature and myth we find characters who, with the simple utter of a word, make it rain fire from the heavens, heal the wounded, or summon allies. And a famous saying knows:</p><blockquote>Watch your thoughts, they become words;<br>watch your words, they become actions;<br>watch your actions, they become habits;<br>watch your habits, they become character;<br>watch your character, for it becomes your destiny.</blockquote><p>For, when our thoughts are spoken they spread, can never be taken from the world again. Once spoken we, as well as others, will derive actions from them. And slowly the actions we have taken shape us into who we are; and will be. Our destiny in a way starts with a single thought, turned words.</p><p>We all experience the way words shape us from an early age when parents tell us not to curse and to say please. We then experience how it frees us to finally use those forbidden words and how that, in turn, changes us. I remember once taking part in a workshop to cut through knots in our lives. The entire process was aimed at creating a personal mantra, a few magic words, that we would be able to repeat to ourselves over and over again. I left that day with the phrase “I am my own role model”. And repeating that over and over took a heavy load of my heart; it had me smiling for weeks. And to this day the piece of paper which got created back then hangs on my wall and gives me the confidence to find my way.</p><p>Some words even go beyond shaping a single individual. Everyone associates a feeling with the pointedly spoken “I have a dream!”. These words in fact were powerful enough to propel a gigantic movement, one might even dare say to change a generation.</p><p>Words carry magic to shape the world. And it is therefore that we need to select them with care.</p><h3>Magic for birds</h3><figure><img alt="Netlights Boids illustration." src="https://cdn-images-1.medium.com/max/1024/1*tAM0JakYS7rsLsldAVWrXQ.png" /><figcaption>Netlights Boids finding their way.</figcaption></figure><p>At Netlight we call ourselves “Boids”. We do so after a term used to describe entities in a bird flock simulation. Because that is how we see ourselves. We are a flock of birds. There is no leader, there is no dictated course. One Boid makes a turn, some follow, more follow, and soon Netlight is heading in a new direction.</p><p>And through all of this magic words guide us. They keep the flock together, they give it a rough direction and a sense of community. In our everyday work we call these words our “annual theme”. They might be a single word per year like “Impact” or a short phrase such as “be a Mensch”. They always connect us.</p><p>And this connection is meaningful to all of us, every day. I, as a consultant, spend five days a week at my projects client. Helping them grow and achieve their dreams by utilising my network at Netlight. The network consists of over 1300 Netlighters throughout Europe that I want to stay connected to. Our yearly theme is a great help in keeping these connections.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5-fynCRDNPYvH_k_6FJ2Gw.png" /></figure><p>As you might expect at this point, the theme is not a simple spell you say out loud once to cause a grand effect. It is rather a continued baseline throughout the year, capturing perfectly how Netlight feels. You will find all of Netlight ecstatic about it. We keep talking about those words on and on throughout the year. Often not because it is the official theme of the year but because they fit who we are.</p><p>Magically Netlight finds a theme that is in line with where the flock is going. Throughout the year of Impact all of Netlight was focused on the impact we have in our project and as a whole. Not because the theme said we should focus on that, but because it captured where we all were at.</p><p>Netlight takes astounding care in picking our theme. For we know that words carry the magic to shape us, to change us, to decide who we are; and will be.</p><p>As we set out into a new 20, our next theme appears on the horizon and I can’t wait for it to work it’s magic.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=41aed00e71f9" width="1" height="1" alt=""><hr><p><a href="https://makeitnew.io/words-of-magic-41aed00e71f9">Words of magic</a> was originally published in <a href="https://makeitnew.io/">Make It New</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Log to Elasticsearch using curl]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://makeitnew.io/log-to-elasticsearch-using-curl-db8bf8ef2785?source=rss-8d46280441de------2"><img src="https://cdn-images-1.medium.com/max/1000/0*_yA9QjrRF6FznJrW" width="1000"></a></p><p class="medium-feed-snippet">Once you get a centralized logging solution like Elasticsearch setup you open up an incredible amount of possibilities. That is if you&#x2026;</p><p class="medium-feed-link"><a href="https://makeitnew.io/log-to-elasticsearch-using-curl-db8bf8ef2785?source=rss-8d46280441de------2">Continue reading on Make It New »</a></p></div>]]></description>
            <link>https://makeitnew.io/log-to-elasticsearch-using-curl-db8bf8ef2785?source=rss-8d46280441de------2</link>
            <guid isPermaLink="false">https://medium.com/p/db8bf8ef2785</guid>
            <category><![CDATA[elasticsearch]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[automation]]></category>
            <dc:creator><![CDATA[Hendrik Wallbaum]]></dc:creator>
            <pubDate>Thu, 16 May 2019 10:11:02 GMT</pubDate>
            <atom:updated>2019-05-16T10:11:02.214Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Log to Elasticsearch using curl]]></title>
            <link>https://medium.com/@hendrikwallbaum/log-to-elasticsearch-using-curl-fb64d908c1a8?source=rss-8d46280441de------2</link>
            <guid isPermaLink="false">https://medium.com/p/fb64d908c1a8</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[terminal]]></category>
            <category><![CDATA[logging]]></category>
            <category><![CDATA[ci]]></category>
            <category><![CDATA[elasticsearch]]></category>
            <dc:creator><![CDATA[Hendrik Wallbaum]]></dc:creator>
            <pubDate>Tue, 14 May 2019 13:57:49 GMT</pubDate>
            <atom:updated>2019-05-14T13:57:49.231Z</atom:updated>
            <content:encoded><![CDATA[<p>Once you get a centralized logging solution like Elasticsearch setup you open up an incredible amount of possibilities. That is if you actually send logs to your central place. On a recent project, we wanted to</p><blockquote>“just log our deploys from the Jenkins Server”.</blockquote><p>Thus we set out to find the “easiest” way to log to our Elasticsearch. We finally reached curl as our solution and today I will walk you through how to do that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*_yA9QjrRF6FznJrW" /><figcaption>It’s all about writing things down.</figcaption></figure><p>This post uses Elasticsearch version 7. We also focus on Mac and Linux terminals for commands. Some of them might work differently on Windows, I suggest using <a href="https://gitforwindows.org/">Git Bash</a> to get around those issues.</p><h3>Console basics</h3><p>If like me, you find the command line highly fascinating for it’s myriad of tools and how simple tools can be composed into bigger workflows, much like good software is, BUT you have no idea what you are actually doing (also like me), follow along as we dive into some tools we will use today. Should you be a firm terminal hero, feel free to jump this section.</p><p><a href="https://curl.haxx.se/">curl</a> is a free and open source command line tool to transfer data over the internet. As such you can use it to make GET requests or send POST requests to servers. Let’s look at a simple example you can try out:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/684fae1e121f96fd75017aa5103cdaea/href">https://medium.com/media/684fae1e121f96fd75017aa5103cdaea/href</a></iframe><p>This will fire a simple get request towards the <a href="https://jsonplaceholder.typicode.com/">JSON placeholder API</a> and return the post with index 1. curl will log the result to the console for you. Through this logging, to the console, you can also chain curl with other commands, like grep the title of the post. But a deeper dive into chaining is a topic for another day.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/066178120dd515626ccfe2a110112a8e/href">https://medium.com/media/066178120dd515626ccfe2a110112a8e/href</a></iframe><p>Let us instead focus on understanding curl and relevant options better. First, we will need to specify the method (POST) we want to use. For that we can use the -X (pay attention to the capital X) option and pass in the method we would like to use. Our placeholder API from before also allows us to post to it, so let us try:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/801ec0d91437f4e75542c59c59706c1d/href">https://medium.com/media/801ec0d91437f4e75542c59c59706c1d/href</a></iframe><p>Now we will want to send some data along. For this curl has -d to pass data along as well as -H to set a header. We want to set a header for the <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type">Content-Type</a> so that we can tell receivers that we are sending JSON. Try the code below and also try it without the -H option to get a feeling for what we get by using it. You will notice that the placeholder API interprets out entire data as a key with no value specified. Setting the right Content-Type helps us to pass the data along in a way that the server can handle. You might run into an <a href="https://stackoverflow.com/a/22883631/2156675">issue with &#39; on Windows</a>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7bfbeec0046917b766747148b426af32/href">https://medium.com/media/7bfbeec0046917b766747148b426af32/href</a></iframe><p>Read more about the used options in the curl manual <a href="https://curl.haxx.se/docs/manpage.html#-X">-X</a>, <a href="https://curl.haxx.se/docs/manpage.html#-H">-H</a> and <a href="https://curl.haxx.se/docs/manpage.html#-d">-d</a></p><p>One thing that we wanted to add to all our logs are timestamps. Luckily our terminal comes with date which can print the current date in many formats. You can refer to the <a href="https://manpages.ubuntu.com/manpages/bionic/en/man1/date.1.html">Ubuntu docs on date</a> for documentation on date and this <a href="https://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/">article on formatting dates</a> for some inspiration. Generally, you call date with a single parameter that passes in what you want. date +%s for example gives you the seconds since Epoch.</p><p>For Elasticsearch however, we need <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/date.html">date fields</a> in milliseconds since Epoch. And our timestamp will be a field of type date so that we can filter by it. To achieve that we will add nanoseconds and then divide by 1000000. Because date behaves a bit differently on different System the command below will simply fill up the specificity between seconds and milliseconds with zeros on systems that do not support milliseconds on the date command (looking at you MacOS - <a href="https://apple.stackexchange.com/a/135743">Stackoverflow credit</a>).</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/994a023ccdb6c10ffbadedd4440a2fa9/href">https://medium.com/media/994a023ccdb6c10ffbadedd4440a2fa9/href</a></iframe><p>A quick foray on $(): This Syntax allows us to use the return value of previous commands as input for the next one. Check out the example command line inputs below to get a feeling for what that means.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a19234613e146156c984e601a56727f7/href">https://medium.com/media/a19234613e146156c984e601a56727f7/href</a></iframe><p>In our concrete example the nested blocks return the following:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a3baf634702d1bb7a15ccac0277aee57/href">https://medium.com/media/a3baf634702d1bb7a15ccac0277aee57/href</a></iframe><p>Now that we have our timestamp we want to use it in our POST request to the server. For that, we will save it in an environment variable and reference that in our request.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4ca9d1c84fd815df0469249e01ec8635/href">https://medium.com/media/4ca9d1c84fd815df0469249e01ec8635/href</a></iframe><p>Let me unpack that for you: first, we assign the timestamp to an environment variable called <em>NOW</em> than we tell our shell to execute another command without losing context through &amp;&amp; here we make our POST request. The &amp;&amp; approach is not necessary on all platforms but we use it here to keep the command compatible with Linux and Mac. You would usually expect to now see ${NOW} wherever you want to insert the environment variables value. But to get our shell to properly escape here we need to wrap our value into wrapped single quotes.</p><p>A word on Operation System compatibility and escaping JSON values. Windows does not support single quotes &#39; in the command so you will have to instead use something like: &quot;{\&quot;title\&quot;: \&quot;My awesome title\&quot;}&quot;. you can also use that Syntax on Macs and Linux machines but I found the single quote approach nicer to read, even though it imposes the escaping for environment variables. Up to you.</p><h3>Elasticsearch APIs</h3><p>Elasticsearch provides great documentation on how to <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/getting-started.html">get started</a> with understanding, creating and searching data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XK_fI07o-h2UUubS" /><figcaption>Taking a look at the inner workings.</figcaption></figure><p>First, let’s recap how Elasticsearch organizes data. The basic element in Elasticsearch is called a <em>Document</em>. You can think of it as a single event being logged, processed and organized through Elasticsearch. They are still organized in Types which are grouped in Indexes. <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/getting-started-concepts.html#_type">Types, however, have been deprecated</a> in Elasticsearch 6 (at the time of writing version 7 is current) which currently results in each Index only being allowed a single Type. Indexes, on the other hand, is a collection of similar documents where you can have as many Indexes as you want. You will need those to insert and query documents.</p><p>If you want to follow along examples from here run an Elasticsearch locally using Docker or replace the localhost domain with the one running your Elasticsearch. Run the command below for a Docker container with Elasticsearch and check out the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html">Elasticsearch Docker documentation</a> if you run into trouble.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/97af7d0f7b417b76aafcecfa2bc11466/href">https://medium.com/media/97af7d0f7b417b76aafcecfa2bc11466/href</a></iframe><p>All following examples now refer to localhost as Elasticsearches domain so you can copy and paste them to try things out. Remember to update this if you want to use snippets in your environments.</p><p>You can post to any /index/type to add a new Document to the specific Type of an Index. If you want to get a pretty response, add ?pretty to the URL.</p><p>Say for example you wanted to have an Index that groups Documents related to deployments of your application. The object you initially want to log might contain the hash of your code being deployed and thus look like:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dd0b05192acf9151ee11b816ba9424d3/href">https://medium.com/media/dd0b05192acf9151ee11b816ba9424d3/href</a></iframe><p>To now add this Document to the <em>deploys</em> Index using <em>_doc</em> as the standard Type (remember <a href="https://www.elastic.co/guide/en/elasticsearch/reference/7.0/getting-started-concepts.html#_type">deprecated but still needed</a>) you can simply call the /deploys/_doc endpoint with your data.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/49bf58c7abb256c226316d12e2c93414/href">https://medium.com/media/49bf58c7abb256c226316d12e2c93414/href</a></iframe><p>If you are not running Elasticsearch locally but on a remote server replace localhost:9200 above with your domain.</p><p>Now we can also get the document we just added by querying the /index/_search endpoint.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2e60a56b4799b98f179f706dcd7f2673/href">https://medium.com/media/2e60a56b4799b98f179f706dcd7f2673/href</a></iframe><p>This will return us all documents within the Index. Check out the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/getting-started-search-API.html">search API</a> for more options.</p><p>We briefly touched on Mappings before when we noted that Elasticsearch expects timestamps (or date in general) to be in milliseconds since Epoch. Through Mappings, we can add fields to an Index. With this, we can control the <em>type</em> that a field will get. While all fields default to “text” it is especially important for our timestamp that we set the field to be of type “date” before adding the first document to our Index. By doing so we ensure that we can later properly filter on our timestamp in Kibana.</p><p>Sadly this means we now need to delete our Index again (and any Kibana indexes we might have created to explore our documents before the Elasticsearch Indexes).</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/74c2da83f4b75ccf060450ee73fb3e2d/href">https://medium.com/media/74c2da83f4b75ccf060450ee73fb3e2d/href</a></iframe><p>Now we can add the Index back with the right mapping for our timestamp using:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/95ee879a87a0daef73a27b1f445ccae8/href">https://medium.com/media/95ee879a87a0daef73a27b1f445ccae8/href</a></iframe><p>You can refer to the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/7.0/date.html">docs on date datatypes</a> for more information.</p><h3>Logging using curl</h3><p>Now that we have the fundamentals of curl and date down, as well as an understanding of Elasticsearches API, it is finally time to get logging.</p><p>We already locked at sending a message containing a timestamp via a POST request. With our knowledge of the Elasticsearch API, we can now log an event with a timestamp.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/155021f6bccd0b2edb7ecc2e295d3eef/href">https://medium.com/media/155021f6bccd0b2edb7ecc2e295d3eef/href</a></iframe><p>With the above, you should have a solid understanding of what is happening here. Below we will dive into a more complex example with once more an explanation of what is going on.</p><p>Above I used an example of logging something containing a git hash related to a deployment. That, in fact, was my use case to dive into this. Let me present to you my solution to log the currently deployed git hash from our CI Server to Elasticsearch. The following command needs to be run from within a git repository.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c781f94531f6225f9b4ff228443754c9/href">https://medium.com/media/c781f94531f6225f9b4ff228443754c9/href</a></iframe><p>You can probably figure out what’s going on here. Let me just go through it to make sure we are on the same page. First, we have three commands in total, let’s examine them one at a time.</p><p>HASH=$(git rev-parse --short HEAD) assigns the short hash (first 7 symbols) of the git repository we are currently into an environment variables named <em>HASH</em>.</p><p>NOW=$(($(date +&#39;%s * 1000 + %-N / 1000000&#39;))) should look familiar, it gets the current timestamp in milliseconds and assigns it to a variable named <em>NOW</em>.</p><p>Finally, we bring it all together in one big curl command. Let me just go over the options for this one.</p><p>-H &quot;Content-Type: application/json&quot; sets a &quot;Content-Type&quot; header with &quot;application/json&quot; so that our Elasticsearch knows that it gets valid json.</p><p>-X POST &quot;http://your.domain:9200/deploys/deploy&quot; tells curl to fire a POST request and which endpoint to use.</p><p>-d &#39;{ &quot;gitHash&quot; : &quot;&#39;&quot;${HASH}&quot;&#39;&quot;, &quot;timestamp&quot;: &quot;&#39;&quot;${NOW}&quot;&#39;&quot;, &quot;info&quot;: &quot;some infos&quot;, &quot;environment&quot;: &quot;test&quot;}&#39; finally defines the JSON data we are going to send along with our request. Here we use the variables we created to fill in the git hash as well as a timestamp. Note that once again we use &quot;&#39;&quot; for proper escaping.</p><h3>Conclusion</h3><p>Today we learned a lot about curl, date, and Elasticsearch. We not only took a look at how these tools can be used in isolation but also how to use them together to “just quickly log something”.</p><p>I hope this sets you up to do great things and achieve quick wins empowered by your existing systems.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/120/0*U82qmEBESCycNsNZ" /></figure><p><em>Originally published on </em><a href="https://hoverbaum.net/2019/05/13/Log-to-Elasticsearch-using-curl/"><em>hoverbaum.net</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fb64d908c1a8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Utilize ESLint rules to format JavaScript in VS Code]]></title>
            <link>https://makeitnew.io/utilize-eslint-rules-to-format-javascript-in-vs-code-37660def1745?source=rss-8d46280441de------2</link>
            <guid isPermaLink="false">https://medium.com/p/37660def1745</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[vscode]]></category>
            <category><![CDATA[eslint]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Hendrik Wallbaum]]></dc:creator>
            <pubDate>Thu, 28 Feb 2019 11:21:00 GMT</pubDate>
            <atom:updated>2019-03-05T08:20:21.908Z</atom:updated>
            <content:encoded><![CDATA[<p>Want to streamline your codestyle? Let’s take a dive into how you can configure VS Code to automatically format your code according to your ESLint rules every time you save a file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*97NpZ1fn-wJjEOLSgkBTxg.jpeg" /><figcaption>Let’s add some style to our code, like color to a canvas, just easier.</figcaption></figure><p>This assumes that you already have some ESLint rules in place. If not the <a href="https://github.com/airbnb/javascript">airbnb rules</a> are a good place to get you started.</p><p>Once you have rules setup and are hacking away in VS Code, the editor will start to complain every time you forget that “you should indent x” or whatever extraordinary rule your company might use. Especially if you are regularly engaged with different companies using different styles this becomes quite cumbersome. Luckily there are two plugins that can help us get around this.</p><p>Go ahead and install <a href="https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint">ES Lint</a> and <a href="https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint">Prettier</a>. The first is a plugin you probably have installed already to help you see errors in your code-style. The later is a tool generally used to format code.</p><p>With prettier you can achieve great things, even <a href="https://prettier.io/docs/en/precommit.html">format your code on commit</a> which can greatly help to streamline coding-style across the team. For today we will only use it every time we save a file in our editor. To achieve this we simply add two lines to our VS Codes settings.json.</p><pre>&quot;editor.formatOnSave&quot;: true,<br>&quot;prettier.eslintIntegration&quot;: true</pre><p>You can find your settings.json by using Preferences: Open User Settings from your Command Palette (⇧+⌘+P | ⇧+CTRL+P).</p><p>And now every time you save a file Prettier will format it according to your ES Lint configuration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/160/0*m9darmySR0fld8fK.png" /></figure><p>Originally published on <a href="https://hoverbaum.net/2019/02/22/Utilizing-ESLint-rules-to-format-JavaScript-in-VS-Code/">HoverBaum.net</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=37660def1745" width="1" height="1" alt=""><hr><p><a href="https://makeitnew.io/utilize-eslint-rules-to-format-javascript-in-vs-code-37660def1745">Utilize ESLint rules to format JavaScript in VS Code</a> was originally published in <a href="https://makeitnew.io/">Make It New</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Utilize ESLint rules to format code in VS Code]]></title>
            <link>https://medium.com/@hendrikwallbaum/utilize-eslint-rules-to-format-code-in-vs-code-c6fa193815f3?source=rss-8d46280441de------2</link>
            <guid isPermaLink="false">https://medium.com/p/c6fa193815f3</guid>
            <category><![CDATA[vscode]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[code-style]]></category>
            <category><![CDATA[eslint]]></category>
            <dc:creator><![CDATA[Hendrik Wallbaum]]></dc:creator>
            <pubDate>Tue, 26 Feb 2019 11:41:02 GMT</pubDate>
            <atom:updated>2019-03-05T08:20:00.793Z</atom:updated>
            <content:encoded><![CDATA[<h3>Utilize ESLint rules to format JavaScript in VS Code</h3><p>Today we will take a quick look at how to configure VS Code to automatically format your code according to your ESLint rules every time you save a file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*97NpZ1fn-wJjEOLSgkBTxg.jpeg" /><figcaption>Let’s add some style to our code, like color to a canvas, just easier.</figcaption></figure><p>This assumes that you already have some ESLint rules in place. If not the <a href="https://github.com/airbnb/javascript">airbnb rules</a> are a good place to get you started.</p><p>Once you have rules setup and are hacking away in VS Code, the editor will start to complain every time you forget that “you should indent x” or whatever extraordinary rule your company might use. Especially if you are regularly engaged with different companies using different styles this becomes quite cumbersome. Luckily there are two plugins that can help us get around this.</p><p>Go ahead and install <a href="https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint">ES Lint</a> and <a href="https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint">Prettier</a>. The first is a plugin you probably have installed already to help you see errors in your code-style. The later is a tool generally used to format code.</p><p>With prettier you can achieve great things, even <a href="https://prettier.io/docs/en/precommit.html">format your code on commit</a> which can greatly help to streamline coding-style across the team. For today we will only use it every time we save a file in our editor. To achieve this we simply add two lines to our settings.json.</p><pre>&quot;editor.formatOnSave&quot;: true,<br>&quot;prettier.eslintIntegration&quot;: true</pre><p>You can find your settings.json by using Preferences: Open User Settings from your Command Palette (⇧+⌘+P | ⇧+CTRL+P).</p><p>And now every time you save a file Prettier will format it according to your ES Lint configuration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/160/0*m9darmySR0fld8fK.png" /></figure><p>Originally published on <a href="https://hoverbaum.net/2019/02/22/Utilizing-ESLint-rules-to-format-JavaScript-in-VS-Code/">HoverBaum.net</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c6fa193815f3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automate click through testing with Puppeteer]]></title>
            <link>https://itnext.io/automate-click-through-testing-with-puppeteer-2e80bc3391dc?source=rss-8d46280441de------2</link>
            <guid isPermaLink="false">https://medium.com/p/2e80bc3391dc</guid>
            <category><![CDATA[webdev]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[automation]]></category>
            <dc:creator><![CDATA[Hendrik Wallbaum]]></dc:creator>
            <pubDate>Wed, 06 Feb 2019 10:46:39 GMT</pubDate>
            <atom:updated>2019-02-06T10:46:39.050Z</atom:updated>
            <content:encoded><![CDATA[<p>Testing is one of the essential steps in software development. Yet, testing and especially manual testing that clicks through the application is a tedious job that we often shy away from. But it doesn’t have to be. With great tooling coming out over the past couple of years we now have what it takes to automate click-through testing in our build process. In this post, we will look at why manual or click-through tests are important and how to turn this tedious and bothersome task into a fun one that drives our development forward.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*hZyNfoF5AEkeFvMp.png" /></figure><p>Restless readers can jump straight into the <a href="https://github.com/HoverBaum/jest-puppeteer-website-testing">repo accompanying this post</a>.</p><h3>Why we need manual QA</h3><p>From a developer point of view; testing and QA, especially manual QA can seem like an unreasonable burden placed on us to hamper our development velocity. While the developer community as a whole, as well as most of the management community, are slowly coming to their senses and seeing that writing well-tested and working code that forms a great product for users is way more valuable than squeezing in one more feature, we still frown on manual QA as a roadblock.</p><blockquote><em>Manual test runs often turn into roadblocks.</em></blockquote><p>But manual QA really isn’t the issue we face. It is the way we use it. Originally manual QA comes from the realization that someone really should click through the finished website to make sure that it really works, before shipping it to customers. You can unit test the hell out of your product, users and the real world can always break it. Thus we try our best to emulate real-world scenarios and users using manual QA.</p><p>Somewhere in the DevOps movement we realized that shipping small pieces of code and doing so often highly reduces the number of bugs we ship, makes our companies more able to react to user needs and market requirements as well as creates a good working environment for ourselves. Too often a big pain point in achieving a high release velocity is manual QA. Because for whatever reason our organizations require a full manual QA run for each release. This tempts us to stock up on features so that QA can process as much as possible at once (if you read the Phoenix Project, this is our heat treat often). We totally ignore that this is exactly what makes it hard to track down which of the dozens of commits introduced a bug and that by doing so we usually block development for a few days just to make a single release happen. We invent complicated procedures like a week of code freeze to create a “stable testing environment” that in reality it often turns out to be anything but stable.</p><blockquote><em>Programming needs QA as much as any other industry does.</em></blockquote><p>Still, we need manual QA just like any other industry does. But it is time to shift the focus. When we look at other disciplines we will always see manual QA, it is simply reassuring to have a human control that everything is going right. They are more flexible and more like the real world users than machines will be for a long while. But do you see quality assurance happen on every single, finished piece leaving traditional production chains? Of course not, that would be such a waste of time! When we build cars we don’t need to check every single one. We take out one every so often to ensure the process runs smoothly and trust that the rest work just the same.</p><p>That is the mode of operation we want to achieve in software development as well. we make a release and we make dozens of them (maybe even per day). Every once in a while someone manually verifies a release and with that, we trust that the rest work just as well as this one did because we have trust in our processes.</p><h3>Building trust</h3><p>But we don’t currently have that trust. Often enough companies are scared by experiences of deployments gone horribly wrong. And as a sad result, they introduce cumbersome procedures meant to catch errors before they happen when in reality these processes cause the opposite and slow the company down. It is on us to rebuild this trust and to alleviate manual QA of the burden they currently carry. We can achieve this by automating the process QA manually goes through.</p><blockquote><em>To go from where we are to where we want to be, which is not blocked by manual QA runs and releasing multiple times a day, we need to invest into automated testing as well as into building trust within the organization that our code does what it’s supposed to.</em></blockquote><p>Today we will take a great step forward on this road by automating a click-through test for a website.</p><h3>A simple web application</h3><p>For today’s test run, we will look at the website below which is a simple counter application. We will be able to hit a button “Increment” to increase the count by one. Furthermore, we will provide a button to display a message that was not previously seen, just to add more dynamic behavior for us to test.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/231/0*jAudZeFy0kca5ef-.png" /></figure><p>And here is the code for the website:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9f96563b533fe8fc211678a6667275c3/href">https://medium.com/media/9f96563b533fe8fc211678a6667275c3/href</a></iframe><p>As you can see we have HTML that displays the count along with some buttons. Then we added some in-line JavaScript at the bottom to implement the logic. We expect the page to:</p><ol><li>Display when we visit it.</li><li>Increase the count displayed when we click the “Increment” button.</li><li>Display a message dialog when pressing the “Display Message” button.</li></ol><p>Traditionally we would now manually click through this. We would host the website somewhere or locally run a web server to take a look. Then we would check that it opens and go through the requirements one by one. Let us make a computer do that for us.</p><h3>The tools</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*hZyNfoF5AEkeFvMp.png" /></figure><p>We are going to use <a href="https://jestjs.io/">Jest</a>, a framework for “Delightful JavaScript testing” as our testing framework. But you might as well use anything else that provides assertions. While we are going to use Jest here we will discuss things in a way so that we can also apply them to other tools.</p><p><a href="https://pptr.dev/">Puppeteer</a> will be our tool to automate the browser and interactions with it. Written by the Chromium Team Puppeteer provides an interface to the <a href="https://chromedevtools.github.io/devtools-protocol/">DevTools Protocol</a> and can be used in combination with any browser supporting it. We will be using Puppeteer with the Chromium version that comes bundled with it.</p><p>For this post Jest was used in version <em>23.6.0</em> together with Puppeteer <em>1.11.0</em>.</p><p>Apart from these, we will use <a href="https://github.com/tapio/live-server/">live-server</a> as a local web server. Using a local web server makes us independent of frameworks used. We will be able to test any website using this approach because no matter how you develop your site, be it React, Angular, Vue or some other flavor of the year framework, in the end, you will get a plain old website. And using this approach we can test them all.</p><p>I also decided that I would like ES6 module syntax in my code and included Babel to use import.</p><p>To get all of that into your project npm i --save jest puppeteer live-server.</p><h3>Test environment Setup</h3><p>Now that we have our toolbelt ready, it’s time to dive into testing.</p><p>Earlier we said that before doing a manual test run we would host the website somewhere or run a local web server, we better do that in our test-suite before running our tests as well.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/993f553c0d8a17358eb974a124f544bc/href">https://medium.com/media/993f553c0d8a17358eb974a124f544bc/href</a></iframe><p>Here we remember the Puppeteer managed browser as well as a system process running our web server for all our tests by defining them as top-level variables. For now, we are telling Puppeteer to launch a browser that we can watch the tests being run in. We also slow this browser down using slowMo, later we will make this optional but it&#39;s always nice to see things happening when first trying them out.</p><p>Sadly we could not find a good web server solution that could be managed programmatically and live-server has an open issue about shutting down programmatically (see <a href="https://github.com/tapio/live-server/issues/196">issue 196</a>), thus we need to run it as a child process. It’s basically like running the command live-server --port=8282 --no-browser in another terminal before doing your tests. We keep a reference so that we can later close the server.</p><p>beforeAll is a block that will execute once before any tests run. Thus it is the perfect place for our general setup. Here we use Puppeteer to launch a browser and wait for that to be done before using it to run our tests.</p><p>Of cause, we can’t forget to shut all of this down once all our tests are done. For that Jest provides afterAll which will run once, after all, tests have finished. It is the perfect place to close our browser and web server.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/386f6f50e9756f9c9b678ba06f36be24/href">https://medium.com/media/386f6f50e9756f9c9b678ba06f36be24/href</a></iframe><p>While we start and stop the browser and web server for all tests we want to start with a clean, new tab for each individual test. We can achieve this using beforeEach and clean up in afterEach. We will also add a let page where we remember the browser as well so that our tests can access it.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/542c9f0902c8a00adb308764678f318a/href">https://medium.com/media/542c9f0902c8a00adb308764678f318a/href</a></iframe><p>This will now open a new page for each test and store is always in the same variable named page that our tests have access to. Not that for your test-suite in your project you might or might not want to do it this way. For our website, it&#39;s nice to always start clean and we can achieve that by simply opening a new page for each test.</p><p>You might have noticed the extensive use of await within the code. We will continue to see that as the nature of all operations communicating with the browser are asynchronous. If you are unfamiliar with this Syntax, Mozilla has great docs on <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function">async</a> and <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await">await</a>.</p><h3>Testing the site</h3><p>Now it’s finally time to write our first test!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/64/0*OR5u96lCraZNav1m.png" /></figure><p>We will wrap all our test for which we will use it blocks with the convention of &quot;it should...&quot; inside a describe block. As a quick recap: the idea behind this is to describe the part of an application tested and what it should do. With this we aim to get descriptive tests that precisely tell us what is broken, should they ever fail.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b0b72d41f045b0692256e80a5a7e3ab7/href">https://medium.com/media/b0b72d41f045b0692256e80a5a7e3ab7/href</a></iframe><p>As we would do in a manual test we will first make sure that we see the website. For that, we will check that a headline is present. We could also check to see if a specific text was in the headline but for us just having any headline will be good enough.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1f17ca5a8a6a45e3951cf7c95d8b4019/href">https://medium.com/media/1f17ca5a8a6a45e3951cf7c95d8b4019/href</a></iframe><p>This test navigates to the page that we want to test, finds all &lt;h1&gt; elements on it and expects to find exactly one h1 element on the page. We also decided to take a screenshot here. This can make it easier to check for what went wrong during a test or to debug your tests.</p><p>Congratulations, with your first test in place, it is time to run it. For that, we will follow nodes conventions and add a test script to our package.json. &quot;test&quot;: &quot;jest&quot; will do the trick for us. Now you can run npm test and a browser will open and take a screenshot. Just make sure that you have a folder named screens that screenshots can be saved into.</p><h3>Selecting Elements</h3><p>The above verifies number <em>0</em> from the three things we want to check during our test. Next up is the counter itself and the displayed message.</p><ol><li>✅ Display when we visit it.</li><li>Increase the count displayed when we click the “Increment” button.</li><li>Display a message dialog when pressing the “Display Message” button.</li></ol><p>For the counter, we will want to check that it starts with 0 and then that it is incremented after we click a button. Checking the initial value is a simple matter of getting the contents of the &lt;span&gt; element that displays the count.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/0*8MmJLYX1mvhIryAE.png" /></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9e6c29b41876bda33cfbb0d714478f1d/href">https://medium.com/media/9e6c29b41876bda33cfbb0d714478f1d/href</a></iframe><p>Once again we visit the page and take a screenshot, but this time we also extract the initial value of the counter. Puppeteer provides many methods to interact with pages. Here we use $eval which takes an element selector that is used for a querySelect run on the page and as a second argument a function that gets the found element as it&#39;s input. The function passed to $eval is evaluated in the context of the page and its result becomes $evals return value. You can look up the full API in the <a href="https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md">official documentation</a>.</p><p>Here we find an element identified by [data-test=&quot;count-output&quot;] and then turn it&#39;s .innerHTML into an integer which we return. This exposes one crucial part of automated click-through testing. Our tests need to find the elements to interact with and run tests on. You could also solve this by searching for a certain text on the website but for sites with frequently changing text as well as for outputs we need a different way to select them.</p><p>A great approach is custom data-* attributes. Custom data attributes don&#39;t interfere with the rest of how web development works. They are here for exactly the case of an element needing some specific information that otherwise can&#39;t be provided.</p><p>The two alternatives would be classes and ids. While classes are meant to not be unique and thus are unusable to select exactly one thing, ids are meant for something else already. They are probably already used and are something you don’t want to couple to your testing procedures, as it would block you from fully utilizing them for application development. Thus we use data attributes here to identify elements of interest for testing.</p><h3>Interacting with Element</h3><p>Once we can find elements on the page, we can also interact with them and for example, click a button to increment our counter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/230/0*J5cMDKFFlLExlf-C.gif" /></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dd2c931f86c523da263390c58a5a1100/href">https://medium.com/media/dd2c931f86c523da263390c58a5a1100/href</a></iframe><p>Here we get the initial count value and validate our expectation that clicking the “increment” button will increment the value by one. Using page.$ we can get an <a href="https://pptr.dev/#?product=Puppeteer&amp;version=v1.11.0&amp;show=api-class-elementhandle">ElementHandle</a> which provides us with certain convenience functions to interact with the selected element, like .click() to click it.</p><p>Within the <a href="https://github.com/HoverBaum/jest-puppeteer-website-testing">repo for this blog post</a> you can find another test for the counter that increments multiple times.</p><p>With that, we can check off another item from our testing list.</p><ol><li>✅ Display when we visit it.</li><li>✅ Increase the count displayed when we click the “Increment” button.</li><li>Display a message dialog when pressing the “Display Message” button.</li></ol><h3>Dynamic DOM content</h3><p>All we have left now, are elements that dynamically get added to the page and we can test those too, like the message in our example website. To do so we simply execute the action that will cause the element to be added to the page and then look for it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/228/0*Cj2q4I_53iziYmo-.gif" /></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/60f6f7ebf417170bcabfc720a05ed27a/href">https://medium.com/media/60f6f7ebf417170bcabfc720a05ed27a/href</a></iframe><p>This time we don’t use Puppeteers build in support for click events but a piece of JavaScript evaluated in the context of our page to click the button e =&gt; e.click(). In the same way, you can pass any code to be evaluated in the context of the page.</p><p>That already gets us pretty far in testing websites. Don’t forget that when testing your actual site you can probably take a lot of shortcuts by sending requests to your backend directly instead of doing everything all the time through your UI. Take a moment to reflect on what you want to test before you do so and do your best to de-couple tests from one another. One test failing shouldn’t make all others fail as well. Ideally, you want one test to fail on its own to ease finding the issue. Following this, it’s often good to setup (or seed) data and state for a test that could come from a backend by making calls to it directly (or using a mock backend). That way you can verify displaying a list even while creating items for it is currently failing its tests.</p><ol><li>✅ Display when we visit it.</li><li>✅ Increase the count displayed when we click the “Increment” button.</li><li>✅ Display a message dialog when pressing the “Display Message” button.</li></ol><p>Congratulations, all tests are green!</p><h3>Making visualization optional</h3><p>Earlier we hardcoded displaying a browser with a delay to watch our tests happen. Since we don’t always want to do that, let’s change it up to depend on an environment variable SHOW_BROWSER. Cases were we might not want to get the visual especially include pipelines for build and deploy of out application which usually runs on systems where we don&#39;t care about visualization but speed.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/93e089caa3f4ccb0e5ec14f14deaa2b4/href">https://medium.com/media/93e089caa3f4ccb0e5ec14f14deaa2b4/href</a></iframe><p>We will simply check whether or not the environment contains a variable named SHOW_BROWSERand depending on that show the browser or not. To now see the browser you could run env SHOW_BROWSER=t npm test to run tests with a browser. You can replace t with anything you want, as long as SHOW_BROWSER has any value at all. You could even turn this into an npm script &quot;test:visual&quot;: &quot;env SHOW_BROWSER=t npm test and run npm run test:visual to use it.</p><h3>Limitations and good tests</h3><p>As with every approach, this automated click-through testing isn’t omnipotent, it comes with some limitations. For instance that Puppeteer basically only runs with Chrome. But as we discussed earlier automated click-through testing shouldn’t replace manual QA runs but help them. Once we achieve fast development iterations which will give us fewer bugs, testing in one browser for each build will be just fine, as long as we do periodic checks in all browsers. Always assuming that developers check their code in multiple browsers anyways 😉</p><p>You might find it helpful to introduce timeouts in your tests. You will notice when to use them, as tests will fail when the default timeout isn’t long enough simply hand your desired timeout as a second argument to it().</p><h3>Wrapping up</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*puZb4kurLsjjmjrp.png" /></figure><p>Our goal is reached, we started testing a website using Jest and Puppeteer. We took a look at where automated click-through testing fits within the greater context of software development and then went on to write our first test cases. Check out the <a href="https://github.com/HoverBaum/jest-puppeteer-website-testing">repo with our finished code</a>.</p><p>Now go out and automate all your tests 🚀</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/120/0*AV1gxUgR-JhxieOm.png" /></figure><p>Next episode: Automated testing using Cypress to visually debug automated tests (coming soon)</p><p>Further reading:</p><ul><li><a href="https://github.com/HoverBaum/jest-puppeteer-website-testing">https://github.com/HoverBaum/jest-puppeteer-website-testing</a></li><li><a href="https://jestjs.io/">https://jestjs.io/</a></li><li><a href="https://pptr.dev/">https://pptr.dev/</a></li></ul><p>Originally published on: <a href="https://hoverbaum.net/2019/01/29/Automate-click-through-testing-with-Puppeteer/">hoverbaum.net</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2e80bc3391dc" width="1" height="1" alt=""><hr><p><a href="https://itnext.io/automate-click-through-testing-with-puppeteer-2e80bc3391dc">Automate click through testing with Puppeteer</a> was originally published in <a href="https://itnext.io/">ITNEXT</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automate click through testing with Puppeteer]]></title>
            <link>https://medium.com/@hendrikwallbaum/automate-click-through-testing-with-puppeteer-fa0f70765d18?source=rss-8d46280441de------2</link>
            <guid isPermaLink="false">https://medium.com/p/fa0f70765d18</guid>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[puppeteer]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[webdev]]></category>
            <category><![CDATA[automation]]></category>
            <dc:creator><![CDATA[Hendrik Wallbaum]]></dc:creator>
            <pubDate>Tue, 05 Feb 2019 12:21:01 GMT</pubDate>
            <atom:updated>2019-02-05T12:21:01.165Z</atom:updated>
            <content:encoded><![CDATA[<p>Testing is one of the essential steps in software development. Yet, testing and especially manual testing that clicks through the application is a tedious job that we often shy away from. But it doesn’t have to be. With great tooling coming out over the past couple of years we now have what it takes to automate click-through testing in our build process. In this post, we will look at why manual or click-through tests are important and how to turn this tedious and bothersome task into a fun one that drives our development forward.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*hZyNfoF5AEkeFvMp.png" /></figure><p>Restless readers can jump straight into the <a href="https://github.com/HoverBaum/jest-puppeteer-website-testing">repo accompanying this post</a>.</p><h3>Why we need manual QA</h3><p>From a developer point of view; testing and QA, especially manual QA can seem like an unreasonable burden placed on us to hamper our development velocity. While the developer community as a whole, as well as most of the management community, are slowly coming to their senses and seeing that writing well-tested and working code that forms a great product for users is way more valuable than squeezing in one more feature, we still frown on manual QA as a roadblock.</p><blockquote><em>Manual test runs often turn into roadblocks.</em></blockquote><p>But manual QA really isn’t the issue we face. It is the way we use it. Originally manual QA comes from the realization that someone really should click through the finished website to make sure that it really works, before shipping it to customers. You can unit test the hell out of your product, users and the real world can always break it. Thus we try our best to emulate real-world scenarios and users using manual QA.</p><p>Somewhere in the DevOps movement we realized that shipping small pieces of code and doing so often highly reduces the number of bugs we ship, makes our companies more able to react to user needs and market requirements as well as creates a good working environment for ourselves. Too often a big pain point in achieving a high release velocity is manual QA. Because for whatever reason our organizations require a full manual QA run for each release. This tempts us to stock up on features so that QA can process as much as possible at once (if you read the Phoenix Project, this is our heat treat often). We totally ignore that this is exactly what makes it hard to track down which of the dozens of commits introduced a bug and that by doing so we usually block development for a few days just to make a single release happen. We invent complicated procedures like a week of code freeze to create a “stable testing environment” that in reality it often turns out to be anything but stable.</p><blockquote><em>Programming needs QA as much as any other industry does.</em></blockquote><p>Still, we need manual QA just like any other industry does. But it is time to shift the focus. When we look at other disciplines we will always see manual QA, it is simply reassuring to have a human control that everything is going right. They are more flexible and more like the real world users than machines will be for a long while. But do you see quality assurance happen on every single, finished piece leaving traditional production chains? Of course not, that would be such a waste of time! When we build cars we don’t need to check every single one. We take out one every so often to ensure the process runs smoothly and trust that the rest work just the same.</p><p>That is the mode of operation we want to achieve in software development as well. we make a release and we make dozens of them (maybe even per day). Every once in a while someone manually verifies a release and with that, we trust that the rest work just as well as this one did because we have trust in our processes.</p><h3>Building trust</h3><p>But we don’t currently have that trust. Often enough companies are scared by experiences of deployments gone horribly wrong. And as a sad result, they introduce cumbersome procedures meant to catch errors before they happen when in reality these processes cause the opposite and slow the company down. It is on us to rebuild this trust and to alleviate manual QA of the burden they currently carry. We can achieve this by automating the process QA manually goes through.</p><blockquote><em>To go from where we are to where we want to be, which is not blocked by manual QA runs and releasing multiple times a day, we need to invest into automated testing as well as into building trust within the organization that our code does what it’s supposed to.</em></blockquote><p>Today we will take a great step forward on this road by automating a click-through test for a website.</p><h3>A simple web application</h3><p>For today’s test run, we will look at the website below which is a simple counter application. We will be able to hit a button “Increment” to increase the count by one. Furthermore, we will provide a button to display a message that was not previously seen, just to add more dynamic behavior for us to test.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/231/0*jAudZeFy0kca5ef-.png" /></figure><p>And here is the code for the website:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9f96563b533fe8fc211678a6667275c3/href">https://medium.com/media/9f96563b533fe8fc211678a6667275c3/href</a></iframe><p>As you can see we have HTML that displays the count along with some buttons. Then we added some in-line JavaScript at the bottom to implement the logic. We expect the page to:</p><ol><li>Display when we visit it.</li><li>Increase the count displayed when we click the “Increment” button.</li><li>Display a message dialog when pressing the “Display Message” button.</li></ol><p>Traditionally we would now manually click through this. We would host the website somewhere or locally run a web server to take a look. Then we would check that it opens and go through the requirements one by one. Let us make a computer do that for us.</p><h3>The tools</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*hZyNfoF5AEkeFvMp.png" /></figure><p>We are going to use <a href="https://jestjs.io/">Jest</a>, a framework for “Delightful JavaScript testing” as our testing framework. But you might as well use anything else that provides assertions. While we are going to use Jest here we will discuss things in a way so that we can also apply them to other tools.</p><p><a href="https://pptr.dev/">Puppeteer</a> will be our tool to automate the browser and interactions with it. Written by the Chromium Team Puppeteer provides an interface to the <a href="https://chromedevtools.github.io/devtools-protocol/">DevTools Protocol</a> and can be used in combination with any browser supporting it. We will be using Puppeteer with the Chromium version that comes bundled with it.</p><p>For this post Jest was used in version <em>23.6.0</em> together with Puppeteer <em>1.11.0</em>.</p><p>Apart from these, we will use <a href="https://github.com/tapio/live-server/">live-server</a> as a local web server. Using a local web server makes us independent of frameworks used. We will be able to test any website using this approach because no matter how you develop your site, be it React, Angular, Vue or some other flavor of the year framework, in the end, you will get a plain old website. And using this approach we can test them all.</p><p>I also decided that I would like ES6 module syntax in my code and included Babel to use import.</p><p>To get all of that into your project npm i --save jest puppeteer live-server.</p><h3>Test environment Setup</h3><p>Now that we have our toolbelt ready, it’s time to dive into testing.</p><p>Earlier we said that before doing a manual test run we would host the website somewhere or run a local web server, we better do that in our test-suite before running our tests as well.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/993f553c0d8a17358eb974a124f544bc/href">https://medium.com/media/993f553c0d8a17358eb974a124f544bc/href</a></iframe><p>Here we remember the Puppeteer managed browser as well as a system process running our web server for all our tests by defining them as top-level variables. For now, we are telling Puppeteer to launch a browser that we can watch the tests being run in. We also slow this browser down using slowMo, later we will make this optional but it&#39;s always nice to see things happening when first trying them out.</p><p>Sadly we could not find a good web server solution that could be managed programmatically and live-server has an open issue about shutting down programmatically (see <a href="https://github.com/tapio/live-server/issues/196">issue 196</a>), thus we need to run it as a child process. It’s basically like running the command live-server --port=8282 --no-browser in another terminal before doing your tests. We keep a reference so that we can later close the server.</p><p>beforeAll is a block that will execute once before any tests run. Thus it is the perfect place for our general setup. Here we use Puppeteer to launch a browser and wait for that to be done before using it to run our tests.</p><p>Of cause, we can’t forget to shut all of this down once all our tests are done. For that Jest provides afterAll which will run once, after all, tests have finished. It is the perfect place to close our browser and web server.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/386f6f50e9756f9c9b678ba06f36be24/href">https://medium.com/media/386f6f50e9756f9c9b678ba06f36be24/href</a></iframe><p>While we start and stop the browser and web server for all tests we want to start with a clean, new tab for each individual test. We can achieve this using beforeEach and clean up in afterEach. We will also add a let page where we remember the browser as well so that our tests can access it.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/542c9f0902c8a00adb308764678f318a/href">https://medium.com/media/542c9f0902c8a00adb308764678f318a/href</a></iframe><p>This will now open a new page for each test and store is always in the same variable named page that our tests have access to. Not that for your test-suite in your project you might or might not want to do it this way. For our website, it&#39;s nice to always start clean and we can achieve that by simply opening a new page for each test.</p><p>You might have noticed the extensive use of await within the code. We will continue to see that as the nature of all operations communicating with the browser are asynchronous. If you are unfamiliar with this Syntax, Mozilla has great docs on <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function">async</a> and <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await">await</a>.</p><h3>Testing the site</h3><p>Now it’s finally time to write our first test!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/64/0*OR5u96lCraZNav1m.png" /></figure><p>We will wrap all our test for which we will use it blocks with the convention of &quot;it should...&quot; inside a describe block. As a quick recap: the idea behind this is to describe the part of an application tested and what it should do. With this we aim to get descriptive tests that precisely tell us what is broken, should they ever fail.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b0b72d41f045b0692256e80a5a7e3ab7/href">https://medium.com/media/b0b72d41f045b0692256e80a5a7e3ab7/href</a></iframe><p>As we would do in a manual test we will first make sure that we see the website. For that, we will check that a headline is present. We could also check to see if a specific text was in the headline but for us just having any headline will be good enough.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1f17ca5a8a6a45e3951cf7c95d8b4019/href">https://medium.com/media/1f17ca5a8a6a45e3951cf7c95d8b4019/href</a></iframe><p>This test navigates to the page that we want to test, finds all &lt;h1&gt; elements on it and expects to find exactly one h1 element on the page. We also decided to take a screenshot here. This can make it easier to check for what went wrong during a test or to debug your tests.</p><p>Congratulations, with your first test in place, it is time to run it. For that, we will follow nodes conventions and add a test script to our package.json. &quot;test&quot;: &quot;jest&quot; will do the trick for us. Now you can run npm test and a browser will open and take a screenshot. Just make sure that you have a folder named screens that screenshots can be saved into.</p><h3>Selecting Elements</h3><p>The above verifies number <em>0</em> from the three things we want to check during our test. Next up is the counter itself and the displayed message.</p><ol><li>✅ Display when we visit it.</li><li>Increase the count displayed when we click the “Increment” button.</li><li>Display a message dialog when pressing the “Display Message” button.</li></ol><p>For the counter, we will want to check that it starts with 0 and then that it is incremented after we click a button. Checking the initial value is a simple matter of getting the contents of the &lt;span&gt; element that displays the count.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/0*8MmJLYX1mvhIryAE.png" /></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9e6c29b41876bda33cfbb0d714478f1d/href">https://medium.com/media/9e6c29b41876bda33cfbb0d714478f1d/href</a></iframe><p>Once again we visit the page and take a screenshot, but this time we also extract the initial value of the counter. Puppeteer provides many methods to interact with pages. Here we use $eval which takes an element selector that is used for a querySelect run on the page and as a second argument a function that gets the found element as it&#39;s input. The function passed to $eval is evaluated in the context of the page and its result becomes $evals return value. You can look up the full API in the <a href="https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md">official documentation</a>.</p><p>Here we find an element identified by [data-test=&quot;count-output&quot;] and then turn it&#39;s .innerHTML into an integer which we return. This exposes one crucial part of automated click-through testing. Our tests need to find the elements to interact with and run tests on. You could also solve this by searching for a certain text on the website but for sites with frequently changing text as well as for outputs we need a different way to select them.</p><p>A great approach is custom data-* attributes. Custom data attributes don&#39;t interfere with the rest of how web development works. They are here for exactly the case of an element needing some specific information that otherwise can&#39;t be provided.</p><p>The two alternatives would be classes and ids. While classes are meant to not be unique and thus are unusable to select exactly one thing, ids are meant for something else already. They are probably already used and are something you don’t want to couple to your testing procedures, as it would block you from fully utilizing them for application development. Thus we use data attributes here to identify elements of interest for testing.</p><h3>Interacting with Element</h3><p>Once we can find elements on the page, we can also interact with them and for example, click a button to increment our counter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/230/0*J5cMDKFFlLExlf-C.gif" /></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dd2c931f86c523da263390c58a5a1100/href">https://medium.com/media/dd2c931f86c523da263390c58a5a1100/href</a></iframe><p>Here we get the initial count value and validate our expectation that clicking the “increment” button will increment the value by one. Using page.$ we can get an <a href="https://pptr.dev/#?product=Puppeteer&amp;version=v1.11.0&amp;show=api-class-elementhandle">ElementHandle</a> which provides us with certain convenience functions to interact with the selected element, like .click() to click it.</p><p>Within the <a href="https://github.com/HoverBaum/jest-puppeteer-website-testing">repo for this blog post</a> you can find another test for the counter that increments multiple times.</p><p>With that, we can check off another item from our testing list.</p><ol><li>✅ Display when we visit it.</li><li>✅ Increase the count displayed when we click the “Increment” button.</li><li>Display a message dialog when pressing the “Display Message” button.</li></ol><h3>Dynamic DOM content</h3><p>All we have left now, are elements that dynamically get added to the page and we can test those too, like the message in our example website. To do so we simply execute the action that will cause the element to be added to the page and then look for it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/228/0*Cj2q4I_53iziYmo-.gif" /></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/60f6f7ebf417170bcabfc720a05ed27a/href">https://medium.com/media/60f6f7ebf417170bcabfc720a05ed27a/href</a></iframe><p>This time we don’t use Puppeteers build in support for click events but a piece of JavaScript evaluated in the context of our page to click the button e =&gt; e.click(). In the same way, you can pass any code to be evaluated in the context of the page.</p><p>That already gets us pretty far in testing websites. Don’t forget that when testing your actual site you can probably take a lot of shortcuts by sending requests to your backend directly instead of doing everything all the time through your UI. Take a moment to reflect on what you want to test before you do so and do your best to de-couple tests from one another. One test failing shouldn’t make all others fail as well. Ideally, you want one test to fail on its own to ease finding the issue. Following this, it’s often good to setup (or seed) data and state for a test that could come from a backend by making calls to it directly (or using a mock backend). That way you can verify displaying a list even while creating items for it is currently failing its tests.</p><ol><li>✅ Display when we visit it.</li><li>✅ Increase the count displayed when we click the “Increment” button.</li><li>✅ Display a message dialog when pressing the “Display Message” button.</li></ol><p>Congratulations, all tests are green!</p><h3>Making visualization optional</h3><p>Earlier we hardcoded displaying a browser with a delay to watch our tests happen. Since we don’t always want to do that, let’s change it up to depend on an environment variable SHOW_BROWSER. Cases were we might not want to get the visual especially include pipelines for build and deploy of out application which usually runs on systems where we don&#39;t care about visualization but speed.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/93e089caa3f4ccb0e5ec14f14deaa2b4/href">https://medium.com/media/93e089caa3f4ccb0e5ec14f14deaa2b4/href</a></iframe><p>We will simply check whether or not the environment contains a variable named SHOW_BROWSERand depending on that show the browser or not. To now see the browser you could run env SHOW_BROWSER=t npm test to run tests with a browser. You can replace t with anything you want, as long as SHOW_BROWSER has any value at all. You could even turn this into an npm script &quot;test:visual&quot;: &quot;env SHOW_BROWSER=t npm test and run npm run test:visual to use it.</p><h3>Limitations and good tests</h3><p>As with every approach, this automated click-through testing isn’t omnipotent, it comes with some limitations. For instance that Puppeteer basically only runs with Chrome. But as we discussed earlier automated click-through testing shouldn’t replace manual QA runs but help them. Once we achieve fast development iterations which will give us fewer bugs, testing in one browser for each build will be just fine, as long as we do periodic checks in all browsers. Always assuming that developers check their code in multiple browsers anyways 😉</p><p>You might find it helpful to introduce timeouts in your tests. You will notice when to use them, as tests will fail when the default timeout isn’t long enough simply hand your desired timeout as a second argument to it().</p><h3>Wrapping up</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*puZb4kurLsjjmjrp.png" /></figure><p>Our goal is reached, we started testing a website using Jest and Puppeteer. We took a look at where automated click-through testing fits within the greater context of software development and then went on to write our first test cases. Check out the <a href="https://github.com/HoverBaum/jest-puppeteer-website-testing">repo with our finished code</a>.</p><p>Now go out and automate all your tests 🚀</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/120/0*AV1gxUgR-JhxieOm.png" /></figure><p>Next episode: Automated testing using Cypress to visually debug automated tests (coming soon)</p><p>Further reading:</p><ul><li><a href="https://github.com/HoverBaum/jest-puppeteer-website-testing">https://github.com/HoverBaum/jest-puppeteer-website-testing</a></li><li><a href="https://jestjs.io/">https://jestjs.io/</a></li><li><a href="https://pptr.dev/">https://pptr.dev/</a></li></ul><p>Originally published on: <a href="https://hoverbaum.net/2019/01/29/Automate-click-through-testing-with-Puppeteer/">hoverbaum.net</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fa0f70765d18" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automate click through testing with Puppeteer]]></title>
            <link>https://makeitnew.io/automate-click-through-testing-with-puppeteer-736d2e64a7ce?source=rss-8d46280441de------2</link>
            <guid isPermaLink="false">https://medium.com/p/736d2e64a7ce</guid>
            <category><![CDATA[puppeteer]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[webdev]]></category>
            <category><![CDATA[automation]]></category>
            <dc:creator><![CDATA[Hendrik Wallbaum]]></dc:creator>
            <pubDate>Thu, 31 Jan 2019 11:06:00 GMT</pubDate>
            <atom:updated>2019-01-31T11:06:00.880Z</atom:updated>
            <content:encoded><![CDATA[<p>Testing is one of the essential steps in software development. Yet, testing and especially manual testing that clicks through the application is a tedious job that we often shy away from. But it doesn’t have to be. With great tooling coming out over the past couple of years we now have what it takes to automate click-through testing in our build process. In this post, we will look at why manual or click-through tests are important and how to turn this tedious and bothersome task into a fun one that drives our development forward.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*hZyNfoF5AEkeFvMp.png" /></figure><p>Restless readers can jump straight into the <a href="https://github.com/HoverBaum/jest-puppeteer-website-testing">repo accompanying this post</a>.</p><h3>Why we need manual QA</h3><p>From a developer point of view; testing and QA, especially manual QA can seem like an unreasonable burden placed on us to hamper our development velocity. While the developer community as a whole, as well as most of the management community, are slowly coming to their senses and seeing that writing well-tested and working code that forms a great product for users is way more valuable than squeezing in one more feature, we still frown on manual QA as a roadblock.</p><blockquote><em>Manual test runs often turn into roadblocks.</em></blockquote><p>But manual QA really isn’t the issue we face. It is the way we use it. Originally manual QA comes from the realization that someone really should click through the finished website to make sure that it really works, before shipping it to customers. You can unit test the hell out of your product, users and the real world can always break it. Thus we try our best to emulate real-world scenarios and users using manual QA.</p><p>Somewhere in the DevOps movement we realized that shipping small pieces of code and doing so often highly reduces the number of bugs we ship, makes our companies more able to react to user needs and market requirements as well as creates a good working environment for ourselves. Too often a big pain point in achieving a high release velocity is manual QA. Because for whatever reason our organizations require a full manual QA run for each release. This tempts us to stock up on features so that QA can process as much as possible at once (if you read the Phoenix Project, this is our heat treat often). We totally ignore that this is exactly what makes it hard to track down which of the dozens of commits introduced a bug and that by doing so we usually block development for a few days just to make a single release happen. We invent complicated procedures like a week of code freeze to create a “stable testing environment” that in reality it often turns out to be anything but stable.</p><blockquote><em>Programming needs QA as much as any other industry does.</em></blockquote><p>Still, we need manual QA just like any other industry does. But it is time to shift the focus. When we look at other disciplines we will always see manual QA, it is simply reassuring to have a human control that everything is going right. They are more flexible and more like the real world users than machines will be for a long while. But do you see quality assurance happen on every single, finished piece leaving traditional production chains? Of course not, that would be such a waste of time! When we build cars we don’t need to check every single one. We take out one every so often to ensure the process runs smoothly and trust that the rest work just the same.</p><p>That is the mode of operation we want to achieve in software development as well. we make a release and we make dozens of them (maybe even per day). Every once in a while someone manually verifies a release and with that, we trust that the rest work just as well as this one did because we have trust in our processes.</p><h3>Building trust</h3><p>But we don’t currently have that trust. Often enough companies are scared by experiences of deployments gone horribly wrong. And as a sad result, they introduce cumbersome procedures meant to catch errors before they happen when in reality these processes cause the opposite and slow the company down. It is on us to rebuild this trust and to alleviate manual QA of the burden they currently carry. We can achieve this by automating the process QA manually goes through.</p><blockquote><em>To go from where we are to where we want to be, which is not blocked by manual QA runs and releasing multiple times a day, we need to invest into automated testing as well as into building trust within the organization that our code does what it’s supposed to.</em></blockquote><p>Today we will take a great step forward on this road by automating a click-through test for a website.</p><h3>A simple web application</h3><p>For today’s test run, we will look at the website below which is a simple counter application. We will be able to hit a button “Increment” to increase the count by one. Furthermore, we will provide a button to display a message that was not previously seen, just to add more dynamic behavior for us to test.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/231/0*jAudZeFy0kca5ef-.png" /></figure><p>And here is the code for the website:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9f96563b533fe8fc211678a6667275c3/href">https://medium.com/media/9f96563b533fe8fc211678a6667275c3/href</a></iframe><p>As you can see we have HTML that displays the count along with some buttons. Then we added some in-line JavaScript at the bottom to implement the logic. We expect the page to:</p><ol><li>Display when we visit it.</li><li>Increase the count displayed when we click the “Increment” button.</li><li>Display a message dialog when pressing the “Display Message” button.</li></ol><p>Traditionally we would now manually click through this. We would host the website somewhere or locally run a web server to take a look. Then we would check that it opens and go through the requirements one by one. Let us make a computer do that for us.</p><h3>The tools</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*hZyNfoF5AEkeFvMp.png" /></figure><p>We are going to use <a href="https://jestjs.io/">Jest</a>, a framework for “Delightful JavaScript testing” as our testing framework. But you might as well use anything else that provides assertions. While we are going to use Jest here we will discuss things in a way so that we can also apply them to other tools.</p><p><a href="https://pptr.dev/">Puppeteer</a> will be our tool to automate the browser and interactions with it. Written by the Chromium Team Puppeteer provides an interface to the <a href="https://chromedevtools.github.io/devtools-protocol/">DevTools Protocol</a> and can be used in combination with any browser supporting it. We will be using Puppeteer with the Chromium version that comes bundled with it.</p><p>For this post Jest was used in version <em>23.6.0</em> together with Puppeteer <em>1.11.0</em>.</p><p>Apart from these, we will use <a href="https://github.com/tapio/live-server/">live-server</a> as a local web server. Using a local web server makes us independent of frameworks used. We will be able to test any website using this approach because no matter how you develop your site, be it React, Angular, Vue or some other flavor of the year framework, in the end, you will get a plain old website. And using this approach we can test them all.</p><p>I also decided that I would like ES6 module syntax in my code and included Babel to use import.</p><p>To get all of that into your project npm i --save jest puppeteer live-server.</p><h3>Test environment Setup</h3><p>Now that we have our toolbelt ready, it’s time to dive into testing.</p><p>Earlier we said that before doing a manual test run we would host the website somewhere or run a local web server, we better do that in our test-suite before running our tests as well.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/993f553c0d8a17358eb974a124f544bc/href">https://medium.com/media/993f553c0d8a17358eb974a124f544bc/href</a></iframe><p>Here we remember the Puppeteer managed browser as well as a system process running our web server for all our tests by defining them as top-level variables. For now, we are telling Puppeteer to launch a browser that we can watch the tests being run in. We also slow this browser down using slowMo, later we will make this optional but it&#39;s always nice to see things happening when first trying them out.</p><p>Sadly we could not find a good web server solution that could be managed programmatically and live-server has an open issue about shutting down programmatically (see <a href="https://github.com/tapio/live-server/issues/196">issue 196</a>), thus we need to run it as a child process. It’s basically like running the command live-server --port=8282 --no-browser in another terminal before doing your tests. We keep a reference so that we can later close the server.</p><p>beforeAll is a block that will execute once before any tests run. Thus it is the perfect place for our general setup. Here we use Puppeteer to launch a browser and wait for that to be done before using it to run our tests.</p><p>Of cause, we can’t forget to shut all of this down once all our tests are done. For that Jest provides afterAll which will run once, after all, tests have finished. It is the perfect place to close our browser and web server.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/386f6f50e9756f9c9b678ba06f36be24/href">https://medium.com/media/386f6f50e9756f9c9b678ba06f36be24/href</a></iframe><p>While we start and stop the browser and web server for all tests we want to start with a clean, new tab for each individual test. We can achieve this using beforeEach and clean up in afterEach. We will also add a let page where we remember the browser as well so that our tests can access it.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/542c9f0902c8a00adb308764678f318a/href">https://medium.com/media/542c9f0902c8a00adb308764678f318a/href</a></iframe><p>This will now open a new page for each test and store is always in the same variable named page that our tests have access to. Not that for your test-suite in your project you might or might not want to do it this way. For our website, it&#39;s nice to always start clean and we can achieve that by simply opening a new page for each test.</p><p>You might have noticed the extensive use of await within the code. We will continue to see that as the nature of all operations communicating with the browser are asynchronous. If you are unfamiliar with this Syntax, Mozilla has great docs on <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function">async</a> and <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await">await</a>.</p><h3>Testing the site</h3><p>Now it’s finally time to write our first test!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/64/0*OR5u96lCraZNav1m.png" /></figure><p>We will wrap all our test for which we will use it blocks with the convention of &quot;it should...&quot; inside a describe block. As a quick recap: the idea behind this is to describe the part of an application tested and what it should do. With this we aim to get descriptive tests that precisely tell us what is broken, should they ever fail.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b0b72d41f045b0692256e80a5a7e3ab7/href">https://medium.com/media/b0b72d41f045b0692256e80a5a7e3ab7/href</a></iframe><p>As we would do in a manual test we will first make sure that we see the website. For that, we will check that a headline is present. We could also check to see if a specific text was in the headline but for us just having any headline will be good enough.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1f17ca5a8a6a45e3951cf7c95d8b4019/href">https://medium.com/media/1f17ca5a8a6a45e3951cf7c95d8b4019/href</a></iframe><p>This test navigates to the page that we want to test, finds all &lt;h1&gt; elements on it and expects to find exactly one h1 element on the page. We also decided to take a screenshot here. This can make it easier to check for what went wrong during a test or to debug your tests.</p><p>Congratulations, with your first test in place, it is time to run it. For that, we will follow nodes conventions and add a test script to our package.json. &quot;test&quot;: &quot;jest&quot; will do the trick for us. Now you can run npm test and a browser will open and take a screenshot. Just make sure that you have a folder named screens that screenshots can be saved into.</p><h3>Selecting Elements</h3><p>The above verifies number <em>0</em> from the three things we want to check during our test. Next up is the counter itself and the displayed message.</p><ol><li>✅ Display when we visit it.</li><li>Increase the count displayed when we click the “Increment” button.</li><li>Display a message dialog when pressing the “Display Message” button.</li></ol><p>For the counter, we will want to check that it starts with 0 and then that it is incremented after we click a button. Checking the initial value is a simple matter of getting the contents of the &lt;span&gt; element that displays the count.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/0*8MmJLYX1mvhIryAE.png" /></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9e6c29b41876bda33cfbb0d714478f1d/href">https://medium.com/media/9e6c29b41876bda33cfbb0d714478f1d/href</a></iframe><p>Once again we visit the page and take a screenshot, but this time we also extract the initial value of the counter. Puppeteer provides many methods to interact with pages. Here we use $eval which takes an element selector that is used for a querySelect run on the page and as a second argument a function that gets the found element as it&#39;s input. The function passed to $eval is evaluated in the context of the page and its result becomes $evals return value. You can look up the full API in the <a href="https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md">official documentation</a>.</p><p>Here we find an element identified by [data-test=&quot;count-output&quot;] and then turn it&#39;s .innerHTML into an integer which we return. This exposes one crucial part of automated click-through testing. Our tests need to find the elements to interact with and run tests on. You could also solve this by searching for a certain text on the website but for sites with frequently changing text as well as for outputs we need a different way to select them.</p><p>A great approach is custom data-* attributes. Custom data attributes don&#39;t interfere with the rest of how web development works. They are here for exactly the case of an element needing some specific information that otherwise can&#39;t be provided.</p><p>The two alternatives would be classes and ids. While classes are meant to not be unique and thus are unusable to select exactly one thing, ids are meant for something else already. They are probably already used and are something you don’t want to couple to your testing procedures, as it would block you from fully utilizing them for application development. Thus we use data attributes here to identify elements of interest for testing.</p><h3>Interacting with Element</h3><p>Once we can find elements on the page, we can also interact with them and for example, click a button to increment our counter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/230/0*J5cMDKFFlLExlf-C.gif" /></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dd2c931f86c523da263390c58a5a1100/href">https://medium.com/media/dd2c931f86c523da263390c58a5a1100/href</a></iframe><p>Here we get the initial count value and validate our expectation that clicking the “increment” button will increment the value by one. Using page.$ we can get an <a href="https://pptr.dev/#?product=Puppeteer&amp;version=v1.11.0&amp;show=api-class-elementhandle">ElementHandle</a> which provides us with certain convenience functions to interact with the selected element, like .click() to click it.</p><p>Within the <a href="https://github.com/HoverBaum/jest-puppeteer-website-testing">repo for this blog post</a> you can find another test for the counter that increments multiple times.</p><p>With that, we can check off another item from our testing list.</p><ol><li>✅ Display when we visit it.</li><li>✅ Increase the count displayed when we click the “Increment” button.</li><li>Display a message dialog when pressing the “Display Message” button.</li></ol><h3>Dynamic DOM content</h3><p>All we have left now, are elements that dynamically get added to the page and we can test those too, like the message in our example website. To do so we simply execute the action that will cause the element to be added to the page and then look for it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/228/0*Cj2q4I_53iziYmo-.gif" /></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/60f6f7ebf417170bcabfc720a05ed27a/href">https://medium.com/media/60f6f7ebf417170bcabfc720a05ed27a/href</a></iframe><p>This time we don’t use Puppeteers build in support for click events but a piece of JavaScript evaluated in the context of our page to click the button e =&gt; e.click(). In the same way, you can pass any code to be evaluated in the context of the page.</p><p>That already gets us pretty far in testing websites. Don’t forget that when testing your actual site you can probably take a lot of shortcuts by sending requests to your backend directly instead of doing everything all the time through your UI. Take a moment to reflect on what you want to test before you do so and do your best to de-couple tests from one another. One test failing shouldn’t make all others fail as well. Ideally, you want one test to fail on its own to ease finding the issue. Following this, it’s often good to setup (or seed) data and state for a test that could come from a backend by making calls to it directly (or using a mock backend). That way you can verify displaying a list even while creating items for it is currently failing its tests.</p><ol><li>✅ Display when we visit it.</li><li>✅ Increase the count displayed when we click the “Increment” button.</li><li>✅ Display a message dialog when pressing the “Display Message” button.</li></ol><p>Congratulations, all tests are green!</p><h3>Making visualization optional</h3><p>Earlier we hardcoded displaying a browser with a delay to watch our tests happen. Since we don’t always want to do that, let’s change it up to depend on an environment variable SHOW_BROWSER. Cases were we might not want to get the visual especially include pipelines for build and deploy of out application which usually runs on systems where we don&#39;t care about visualization but speed.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/93e089caa3f4ccb0e5ec14f14deaa2b4/href">https://medium.com/media/93e089caa3f4ccb0e5ec14f14deaa2b4/href</a></iframe><p>We will simply check whether or not the environment contains a variable named SHOW_BROWSERand depending on that show the browser or not. To now see the browser you could run env SHOW_BROWSER=t npm test to run tests with a browser. You can replace t with anything you want, as long as SHOW_BROWSER has any value at all. You could even turn this into an npm script &quot;test:visual&quot;: &quot;env SHOW_BROWSER=t npm test and run npm run test:visual to use it.</p><h3>Limitations and good tests</h3><p>As with every approach, this automated click-through testing isn’t omnipotent, it comes with some limitations. For instance that Puppeteer basically only runs with Chrome. But as we discussed earlier automated click-through testing shouldn’t replace manual QA runs but help them. Once we achieve fast development iterations which will give us fewer bugs, testing in one browser for each build will be just fine, as long as we do periodic checks in all browsers. Always assuming that developers check their code in multiple browsers anyways 😉</p><p>You might find it helpful to introduce timeouts in your tests. You will notice when to use them, as tests will fail when the default timeout isn’t long enough simply hand your desired timeout as a second argument to it().</p><h3>Wrapping up</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*puZb4kurLsjjmjrp.png" /></figure><p>Our goal is reached, we started testing a website using Jest and Puppeteer. We took a look at where automated click-through testing fits within the greater context of software development and then went on to write our first test cases. Check out the <a href="https://github.com/HoverBaum/jest-puppeteer-website-testing">repo with our finished code</a>.</p><p>Now go out and automate all your tests 🚀</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/120/0*AV1gxUgR-JhxieOm.png" /></figure><p>Next episode: Automated testing using Cypress to visually debug automated tests (coming soon)</p><p>Further reading:</p><ul><li><a href="https://github.com/HoverBaum/jest-puppeteer-website-testing">https://github.com/HoverBaum/jest-puppeteer-website-testing</a></li><li><a href="https://jestjs.io/">https://jestjs.io/</a></li><li><a href="https://pptr.dev/">https://pptr.dev/</a></li></ul><p>Originally published on: <a href="https://hoverbaum.net/2019/01/29/Automate-click-through-testing-with-Puppeteer/">hoverbaum.net</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=736d2e64a7ce" width="1" height="1" alt=""><hr><p><a href="https://makeitnew.io/automate-click-through-testing-with-puppeteer-736d2e64a7ce">Automate click through testing with Puppeteer</a> was originally published in <a href="https://makeitnew.io/">Make It New</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>