<?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 Valentin Vago on Medium]]></title>
        <description><![CDATA[Stories by Valentin Vago on Medium]]></description>
        <link>https://medium.com/@valentin_43413?source=rss-2a0834b4a7bc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*CuXqfI6RQAp3cNgb</url>
            <title>Stories by Valentin Vago on Medium</title>
            <link>https://medium.com/@valentin_43413?source=rss-2a0834b4a7bc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 23:25:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@valentin_43413/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[Puppeteer isn’t just for testing! How to generate great docs and ease development]]></title>
            <link>https://medium.com/jobpal-dev/puppeteer-isnt-just-for-testing-how-to-generate-great-docs-and-ease-development-1b18a6c5bb2e?source=rss-2a0834b4a7bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/1b18a6c5bb2e</guid>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[documentation]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[code]]></category>
            <category><![CDATA[puppeteer]]></category>
            <dc:creator><![CDATA[Valentin Vago]]></dc:creator>
            <pubDate>Thu, 05 Dec 2019 09:49:28 GMT</pubDate>
            <atom:updated>2019-12-05T09:49:28.082Z</atom:updated>
            <content:encoded><![CDATA[<p>Ever heard of <a href="https://pptr.dev/">Puppeteer</a>? The tool that allows to control Google Chrome and Chromium based browsers programmatically.</p><p>The two main usages of puppeteer are end-2-end testing and site scraping but you can do so much more with it and this article is about 2 other possible usages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*bDKzc4MBNqhWWHxneBEvNA.jpeg" /></figure><h3>Generating documentation</h3><p>Creating documentation can be tedious work. Usually it requires to take screenshots of the app at very specific steps of its usage, moving those screenshots to a document to which you still need to add some comments.</p><p>And you will have to update all that when something changes in the app.</p><p>The perfect example of a un-satisfying and repetitive grunt work.<br>Bummer!</p><p>Luckily, if you have Puppeteer set up right, you can take screenshots and attach them the right comments in a programmatic fashion.</p><p>One way to achieve that is to create a function in the <a href="https://jestjs.io/">Jest</a> environment file and expose it to your tests.<br>The function will take a screenshot of the page at the precise moment you want, store the path of the image in conjunction with the comments and at the end of the tests (at teardown) will compile all that as an HTML document.</p><p>The Jest environment should look somehow like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4d526946b9aa25d2625b2f64357cce4d/href">https://medium.com/media/4d526946b9aa25d2625b2f64357cce4d/href</a></iframe><p>With a template to render the collected documentation more or less like:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b46fab8be368830e549798954f02a50f/href">https://medium.com/media/b46fab8be368830e549798954f02a50f/href</a></iframe><p>And finally call the “writeDocs” function in your tests…</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5237ff8ca02a1efe2d4b7b86395a44e3/href">https://medium.com/media/5237ff8ca02a1efe2d4b7b86395a44e3/href</a></iframe><p>Once the tests are run, the teardown compiles the screenshots taken with the information you passed to the writeDocs function and produce a neat HTML file (see the teardown method in the code above).</p><h3>Improve your front-end developer experience</h3><p>Progresses in front-end tooling, like live-reloading and later hot-reloading, have eased development by avoiding most (but not all) need for reloading the browser window manually.</p><p>They are still edge-cases for which you might spend several minutes in order to reproduce a situation or state in the app.<br>Again un-satisfying and repetitive grunt work (and prone to mistakes).</p><p>The trick is to actually code those steps in your tests, launch them in a non-headless way (the default behaviour keeps the browser invisible, headless) and keep the browser open instead of closing it at the end of the test.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/603903ed6251a25bcb33e08b504174af/href">https://medium.com/media/603903ed6251a25bcb33e08b504174af/href</a></iframe><p>Additionally you may want to run this against your development environment (opposed to the production build that you should use when doing proper testing) in order to benefit from the hot-reloading once you’re at the state you wanted to reach.<br>So start your development server first (here running on port 3000) npm start (or whatever suits your project) and then run jest TEST_KEEP_BROWSER=1 PORT=3000 npx jest --runInBand .</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1b18a6c5bb2e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/jobpal-dev/puppeteer-isnt-just-for-testing-how-to-generate-great-docs-and-ease-development-1b18a6c5bb2e">Puppeteer isn’t just for testing! How to generate great docs and ease development</a> was originally published in <a href="https://medium.com/jobpal-dev">jobpal has been acquired by SmartRecruiters!</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>