DEV Community

Cover image for Puppetry 3 : test automation without coding
Dmitry Sheiko
Dmitry Sheiko

Posted on

3 2

Puppetry 3 : test automation without coding

Nowadays nobody would argue the importance of automated testing. Yet end-to-end tests are often hard to write and even harder to maintain. There are many solutions to help with it. Puppetry is a test constructor, which allows you building test suites without any coding. QA-engineer can record user scenario in a built-in browser, extend the generated test case with browser commands and assertions, manage the suite structure (like drag’n’drop) and run tests. Puppetry translates Gherkins-styled test specification into a Jest/Puppeteer project, executes it and shows the report. This project can be simply plugged in CI/CD pipeline.

Test case

Test report

You may think of it as an advanced UI over Puppeteer with more than 60 visualized methods and assertions. These are designed to make the test development as easy as possible. For example, with Puppetry you say “I assert that target FOO is currently located above BAR”. It results in the code computing styles of both targets and comparing them.

Asserting element position

It may sound as play-toy, but in reality we can implement with Puppetry quite sophisticated test strategies. For example we can address dynamic content, run performance budgeting, test CSS regression, Chrome extensions, web-components, transactional emails and Google Analytics tracking.

CSS Regression test report

Asserting Google Analytics tracking

Real-world test cases can be hard to debug. Modern web applications are highly dynamic, meaning the pages are changing in response to user actions. So we have to remember when addressing an element that it can be not yet rendered or already destroyed in that particular point in time. Luckily Puppetry let use set breakpoints as well as run test in interactive mode. In both cases the test run pause when reaching the problem point, so you can observe the actual page state and call DevTools to check the DOM tree.

Yeah, Puppetry is where the test automation makes fun. Not persuaded? Just check the video out.

Sentry blog image

How I fixed 20 seconds of lag for every user in just 20 minutes.

Our AI agent was running 10-20 seconds slower than it should, impacting both our own developers and our early adopters. See how I used Sentry Profiling to fix it in record time.

Read more

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →