To access Snippets use the navigation header. In general, Snippets allow you to define custom code which gets executed during a test step. You can use Snippets in any test.


Create snippet

Each snippet requires a name and code, which should contain a synchronous or asynchronous function to be called within the test run. Optionally one can enable the Puppeteer API or define custom arguments to be passed into the function.


Example without Puppeteer API

In this example, a custom snippet should hide a dom element.

async () => {
    document.getElementById('#marketing-news').style.opacity = 0;

Example with Puppeteer API

This snippet hides a dom element which always has different content to prevent it from being included in the visual test validation.

async page => {
  const frames = page.frames();
  await Promise.all( frame => {
      await frame.waitFor(() => !document.querySelector(".my-app"));