Test API
Fixtures
What test bodies receive: the app, the screen and each provider's handle, added with test.extend.
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.
| Member | Description |
|---|---|
session?: string | The saved session the block's tests start in. |
isolation?: Isolation | How 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 TestFixturesFixtures every danwo test gets: the browser session's agent, screen and app, plus expect, secret and mail bound to it.
| Member | Description |
|---|---|
expect: Expect | |
secret: (name: string) => Secret | A handle for a configured secret, to fill by name without its value reaching the model. |
mail: SessionMail | Mail 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>().
| Member | Description |
|---|---|
stripe: Emulator | |
proxy: Proxy | |
settle: () => Promise<void> | Plays pending webhook deliveries and retries to the end. |
S3Fixtures
interface
Fixtures an s3Environment() or s3Service() contributes.
| Member | Description |
|---|---|
s3: Emulator | The S3 emulator; read what the app stored with s3Objects(s3). |
proxy: Proxy | |
settle: () => Promise<void> |
ResendFixtures
interface
Fixtures a resendEnvironment() or resendService() contributes.
| Member | Description |
|---|---|
resend: Emulator | The 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.
| Member | Description |
|---|---|
aws: AwsFixture | |
proxy: Proxy | |
settle: () => Promise<void> |
Auth0Fixtures
interface
Fixtures an auth0Environment() or auth0Service() contributes.
| Member | Description |
|---|---|
auth0: Emulator | The 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.
| Member | Description |
|---|---|
google: Emulator | The 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.
| Member | Description |
|---|---|
microsoft: Emulator | The 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.
| Member | Description |
|---|---|
slack: Emulator | The 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.
| Member | Description |
|---|---|
github: Emulator | The 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.
| Member | Description |
|---|---|
flutterwave: Emulator | The 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.
| Member | Description |
|---|---|
bachs: Emulator | The Bachs emulator: read payments, subscriptions, refunds and payouts with bachsLedger(bachs). |
proxy: Proxy | |
settle: () => Promise<void> |
NylasFixtures
interface
Fixtures a nylasEnvironment() or nylasService() contributes.
| Member | Description |
|---|---|
nylas: Emulator | The 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.
| Member | Description |
|---|---|
nango: Emulator | The 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.
| Member | Description |
|---|---|
unipile: Emulator | The 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.
| Member | Description |
|---|---|
composio: Emulator | The 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.
| Member | Description |
|---|---|
pusher: Emulator | The 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.
| Member | Description |
|---|---|
novu: Emulator | The 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.
| Member | Description |
|---|---|
tiptap: Emulator | The 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.
| Member | Description |
|---|---|
clerk: Emulator | The 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.
| Member | Description |
|---|---|
llm: Emulator | The 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.
| Member | Description |
|---|---|
twilio: Emulator | The 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.
| Member | Description |
|---|---|
paystack: Emulator | The 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.
| Member | Description |
|---|---|
endpoint: string | The MiniStack endpoint, for setting up resources or reading state with an AWS SDK client. |
SessionFixtures
interface
extends TestFixtures, SessionExtrasWhat 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.
| Member | Description |
|---|---|
agent: Agent | |
screen: Screen | |
app: App | |
time: SessionTime | Time 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: Users | Other people's browsers in the same test, for flows more than one person takes part in. |
platform: "web" | "android" | "ios" |
SessionFixtures
interface
extends TestFixtures, SessionExtrasWhat a session's setup and check receive: a fresh browser session's handles.