Globals

In addition to the at object, scripts in Atrahasis have a small handful of globals available. The exact set depends on where the script runs — most places expose the full set, but load test step scripts run in a more restricted environment.

console

A console with four methods for writing to the script output strip at the bottom of the editor:

  • console.log(...args) — plain message, no prefix.
  • console.info(...args) — prefixed with [INFO].
  • console.warn(...args) — prefixed with [WARN].
  • console.error(...args) — prefixed with [ERROR].

In main-engine scripts (standalone, project, flow, and lifecycle), objects are pretty-printed via JSON.stringifywith two-space indentation. In load test step scripts (Boa engine), each argument is stringified with JavaScript's default toString, so a plain object shows up as [object Object] — call JSON.stringify yourself if you need the full value. As noted in the chapter intro, the total console output of a single script run is capped at 1000 characters; past that, further calls are silently dropped (main-engine scripts also append a single "Log limit reached" notice at the cap).

fetch

The fetch(url, options) global is a drop-in replacement for the browser's Fetch API — same signature, same Response shape returned as a Promise, same .json()/ .text() methods. The important difference is that Atrahasis's fetchroutes through the app's own HTTP backend rather than the browser. Practical consequences:

  • CORS does not apply. You can call any HTTPS endpoint — an internal service, a webhook, a Slack bot — without the browser-level cross-origin restrictions.
  • Same settings as the rest of the app. DNS resolution, TLS handling, proxies, and certificate trust follow the same configuration the main HTTP request tab uses.
  • Binary and text bodies are both supported. Pass a string, an ArrayBuffer, a typed array, or any object that is serializable to JSON.

setTimeout

The native setTimeout(fn, ms)is exposed unchanged. Useful for small delays inside a script — for example, waiting a few hundred milliseconds between two fetches in a Before All script. Remember that the whole script still has a 30-second budget, so long delays will push you into a timeout.

Top-Level await

Every script body is wrapped in an async function before it runs, so you can write await fetch(...)or await at.export.pdf()directly at the top level — no need to define your own async wrapper.

Standard JavaScript and WebView Globals

Main-engine scripts run inside the app's WebView, so every standard JavaScript built-in and most browser-surfaced globals are available without extra plumbing:

  • Language built-ins: Math, Date, JSON, Promise, RegExp, Map, Set, Error, and all the usual string / array / number helpers.
  • URL helpers: URL and URLSearchParams.
  • Web Crypto: crypto.randomUUID(), crypto.getRandomValues(), and crypto.subtle for hashing, HMAC, signing, etc.
  • Text encoding: TextEncoder and TextDecoder.
  • Base64: atob and btoa.

Load test step scripts are the exception — they run in a Boa-based runtime that exposes only the JavaScript language built-ins and console + at. WebView-sourced globals like crypto, URL, or TextEncoder are notavailable inside a load test step script. See Load Test Step Limits for the full list.

Load Test Step Scripts Are Different

Load test step scripts (Pre-Script and Post-Script on a step inside a load test spec) run in a smaller, sandboxed engine built for running thousands of virtual users in parallel. That engine deliberately exposes only consoleand at:

  • No fetch — you cannot call external services from a load test step script.
  • No setTimeout — artificial delays are not available.
  • No top-level await — the script is executed synchronously.

Load test lifecycle scripts (Before All and After All) are not subject to these limits — they run on the full engine, exactly like flow lifecycle scripts. If a load test step script needs to call an external service, move that code to Before All or After All. See Load Test Step Limits for the complete list.