dánwòdánwò

Test API

Fixtures

What test bodies receive: the app, the screen and each provider's handle, added with test.extend.

tests/buy-credits.danwo.ts
import { type StripeFixtures, test as base } from "@danwo/sdk"

const test = base.extend<StripeFixtures>()

test("buys credits", async ({ app, screen, stripe }) => {
  await app.open("/")
  // stripe reads what the app did at the Stripe emulator
})

UseOptions

interface

Options test.use applies to every test of its describe block, or of its file at the top level.

MemberDescription
session?: stringThe saved session the block's tests start in.
isolation?: IsolationHow much state the block's tests share, overriding the config's isolation: test starts each from the environment's seeded state, file lets a file's tests build on one another, none never resets.

FixtureSetup

type

(fixtures: F, use: (value: V) => Promise<void>) => Promise<void>

Sets up a fixture for one test: everything before use(value) is setup, everything after it is teardown, run once the test (hooks and invariant included) is done.

FixtureDefinitions

type

{ readonly [K in keyof T]?: FixtureSetup<F & T, T[K]> | T[K] }

test.extend definitions: a setup function per fixture, or a plain value. Omitted keys are typing only.

DanwoFixtures

interface

extends TestFixtures

Fixtures every danwo test gets: the browser session's agent, screen and app, plus expect, secret and mail bound to it.

MemberDescription
expect: Expect
secret: (name: string) => SecretA handle for a configured secret, to fill by name without its value reaching the model.
mail: SessionMailMail the app sent, from the environment's mail sources: codes, links, and opening it.

StripeFixtures

interface

Fixtures a stripeEnvironment() worker environment contributes; type them with test.extend<StripeFixtures>().

MemberDescription
stripe: Emulator
proxy: Proxy
settle: () => Promise<void>Plays pending webhook deliveries and retries to the end.

S3Fixtures

interface

Fixtures an s3Environment() or s3Service() contributes.

MemberDescription
s3: EmulatorThe S3 emulator; read what the app stored with s3Objects(s3).
proxy: Proxy
settle: () => Promise<void>

ResendFixtures

interface

Fixtures a resendEnvironment() or resendService() contributes.

MemberDescription
resend: EmulatorThe Resend emulator; read the mail the app sent with resendInbox(resend).
proxy: Proxy
settle: () => Promise<void>

AwsFixtures

interface

Fixtures an awsEnvironment() or awsService() (MiniStack) contributes.

MemberDescription
aws: AwsFixture
proxy: Proxy
settle: () => Promise<void>

Auth0Fixtures

interface

Fixtures an auth0Environment() or auth0Service() contributes.

MemberDescription
auth0: EmulatorThe Auth0 emulator: read users, logins, live refresh tokens and verification emails with auth0Tenant(auth0), block a user with auth0Tenant(auth0).block(email), and compute an MFA code with auth0OtpAt(secret, time).
proxy: Proxy
settle: () => Promise<void>

GoogleFixtures

interface

Fixtures a googleEnvironment() or googleService() contributes.

MemberDescription
google: EmulatorThe Google emulator: read who signed in with googleSignIns(google), and mail, events and files with gmailMailbox, googleCalendar and googleDrive.
proxy: Proxy
settle: () => Promise<void>

MicrosoftFixtures

interface

Fixtures a microsoftEnvironment() or microsoftService() contributes.

MemberDescription
microsoft: EmulatorThe Microsoft emulator: read who signed in with microsoftSignIns(microsoft), and mail, events, files and subscriptions with outlookMailbox, outlookCalendar, oneDrive and graphSubscriptions.
proxy: Proxy
settle: () => Promise<void>

SlackFixtures

interface

Fixtures a slackEnvironment() or slackService() contributes.

MemberDescription
slack: EmulatorThe Slack emulator: post as users and read what the app sent with slackWorkspace(slack).
proxy: Proxy
settle: () => Promise<void>

GithubFixtures

interface

Fixtures a githubEnvironment() or githubService() contributes.

MemberDescription
github: EmulatorThe GitHub emulator: read issues, comments and check runs with githubRepo(github, "o/r"), who signed in with githubSignIns(github), and an app's key with githubAppKey.
proxy: Proxy
settle: () => Promise<void>

FlutterwaveFixtures

interface

Fixtures a flutterwaveEnvironment() or flutterwaveService() contributes.

MemberDescription
flutterwave: EmulatorThe Flutterwave emulator: read its books with flutterwaveLedger(flutterwave) and pay a virtual account with flutterwaveBank(flutterwave).transferIn(...).
proxy: Proxy
settle: () => Promise<void>

BachsFixtures

interface

Fixtures a bachsEnvironment() or bachsService() contributes.

MemberDescription
bachs: EmulatorThe Bachs emulator: read payments, subscriptions, refunds and payouts with bachsLedger(bachs).
proxy: Proxy
settle: () => Promise<void>

NylasFixtures

interface

Fixtures a nylasEnvironment() or nylasService() contributes.

MemberDescription
nylas: EmulatorThe Nylas emulator: read grants, mail and events and deliver mail with nylasApplication(nylas).
proxy: Proxy
settle: () => Promise<void>

NangoFixtures

interface

Fixtures a nangoEnvironment() or nangoService() contributes.

MemberDescription
nango: EmulatorThe Nango emulator: read connections and proxied calls, and revoke one, with nangoProject(nango).
proxy: Proxy
settle: () => Promise<void>

UnipileFixtures

interface

Fixtures a unipileEnvironment() or unipileService() contributes.

MemberDescription
unipile: EmulatorThe Unipile emulator: read accounts and messages and message the app's users with unipileWorkspace(unipile).
proxy: Proxy
settle: () => Promise<void>

ComposioFixtures

interface

Fixtures a composioEnvironment() or composioService() contributes.

MemberDescription
composio: EmulatorThe Composio emulator: read connected accounts and tool runs and fire triggers with composioProject(composio), and answer tools from the test with composioTools(composio).
proxy: Proxy
settle: () => Promise<void>

PusherFixtures

interface

Fixtures a pusherEnvironment() or pusherService() contributes.

MemberDescription
pusher: EmulatorThe Pusher emulator: read published events and who they reached, list open connections and publish from the test with pusherChannels(pusher); read Beams publishes with pusherBeams(pusher).
proxy: Proxy
settle: () => Promise<void>

NovuFixtures

interface

Fixtures a novuEnvironment() or novuService() contributes.

MemberDescription
novu: EmulatorThe Novu emulator: read workflow runs, messages and Inboxes with novuProject(novu).
proxy: Proxy
settle: () => Promise<void>Waits for workflow runs, then for pending deliveries.

TiptapFixtures

interface

Fixtures a tiptapEnvironment() or tiptapService() contributes.

MemberDescription
tiptap: EmulatorThe Tiptap emulator: read and write documents and see who edits them with tiptapCollab(tiptap).
proxy: Proxy
settle: () => Promise<void>

ClerkFixtures

interface

Fixtures a clerkEnvironment() or clerkService() contributes.

MemberDescription
clerk: EmulatorThe Clerk emulator: read the instance's keys, users, sessions and emailed codes, and revoke a user's sessions mid-test, with clerkInstance(clerk).
proxy: Proxy
settle: () => Promise<void>

LlmFixtures

interface

Fixtures an llmEnvironment() or llmService() contributes.

MemberDescription
llm: EmulatorThe model API emulator: read the app's model calls with llmCalls(llm) and script more replies with llmScripts(llm).add(...).
proxy: Proxy
settle: () => Promise<void>

TwilioFixtures

interface

Fixtures a twilioEnvironment() or twilioService() contributes.

MemberDescription
twilio: EmulatorThe Twilio emulator: read the texts phones got with twilioInbox(twilio) and text the app's numbers with twilioPhone(twilio).send(from, to, body).
proxy: Proxy
settle: () => Promise<void>

PaystackFixtures

interface

Fixtures a paystackEnvironment() or paystackService() contributes.

MemberDescription
paystack: EmulatorThe Paystack emulator: read what was paid with paystackLedger(paystack) and send money to a dedicated account with paystackBank(paystack).transferTo(number, amount).
proxy: Proxy
settle: () => Promise<void>

AwsFixture

interface

What tests get as the aws fixture.

MemberDescription
endpoint: stringThe MiniStack endpoint, for setting up resources or reading state with an AWS SDK client.

SessionFixtures

interface

extends TestFixtures, SessionExtras

What a session's setup and check receive: a fresh browser session's handles.

TestFixtures

interface

What every test body, hook and invariant receives before environment and extended fixtures.

MemberDescription
agent: Agent
screen: Screen
app: App
time: SessionTimeTime travel: await time.travel({ days: 30 }) moves the app's clock, every emulator's clock (renewals, retries and expiries run as they fall due) and the page's clock forward together.
users: UsersOther people's browsers in the same test, for flows more than one person takes part in.
platform: "web" | "android" | "ios"

SessionFixtures

interface

extends TestFixtures, SessionExtras

What a session's setup and check receive: a fresh browser session's handles.

On this page

Run it on every pull request

A GitHub check and one comment per pull request, with the flight records attached.

Set up CI