Skip to content

Quick Start

Terminal window
npm install spana-test
# or
bun add spana-test

spana works with Node.js 20+ and Bun.

Create spana.config.ts at the root of your project:

import { defineConfig } from "spana-test";
export default defineConfig({
apps: {
web: { url: "http://localhost:3000" },
android: { packageName: "com.example.app" },
ios: { bundleId: "com.example.app" },
},
platforms: ["web"],
});

Start with platforms: ["web"] while getting familiar with the framework, then add "android" and "ios" once your device targets are set up.

Create flows/login.ts:

import { flow } from "spana-test";
export default flow("user can log in", async ({ app, expect }) => {
await app.tap({ testID: "email-input" });
await app.inputText("user@example.com");
await app.tap({ testID: "password-input" });
await app.inputText("secret");
await app.tap({ testID: "login-button" });
await expect({ testID: "home-screen" }).toBeVisible();
});

The testID selector maps to data-testid on web, accessibilityIdentifier on iOS, and resource-id on Android. It is the preferred selector type.

Terminal window
spana test

This discovers all *.ts files under ./flows (or the flowDir in your config) and runs them against the configured platforms.

Terminal window
spana test flows/login.ts
Terminal window
spana test --platform android
Terminal window
spana test --tag smoke

By default, results print to the console. To get structured JSON output:

Terminal window
spana test --reporter json

On failure, spana captures a screenshot and UI hierarchy dump under .spana/artifacts/ (configurable via artifacts.outputDir).