Skip to content

Init

The spana init command generates a starter config file and example flow through an interactive wizard.

Terminal window
spana init
FlagDescription
--forceOverwrite existing spana.config.ts if present

The wizard asks:

  1. Which platforms to test — web (Playwright), Android (UiAutomator2), iOS (WebDriverAgent)
  2. App details per platform:
    • Web: app URL (default http://localhost:3000)
    • Android: package name (default com.example.myapp)
    • iOS: bundle ID (default com.example.myapp)

Then it creates:

FileDescription
spana.config.tsConfig file with your platform and app settings
flows/example.flow.tsStarter flow with a smoke test you can customize
spana.config.ts
import { defineConfig } from "spana-test";
export default defineConfig({
apps: {
web: { url: "http://localhost:3000" },
android: { packageName: "com.example.myapp" },
},
platforms: ["web", "android"],
flowDir: "./flows",
reporters: ["console"],
defaults: {
waitTimeout: 5_000,
},
});
flows/example.flow.ts
import { flow } from "spana-test";
export default flow(
"Example - app loads successfully",
{ tags: ["smoke"], platforms: ["web", "android"] },
async ({ app, expect }) => {
await expect({ text: "Hello" }).toBeVisible();
},
);

After running spana init:

  1. Install spana: npm install -D spana-test
  2. Add spana-output to your .gitignore
  3. Edit flows/example.flow.ts with selectors from your app
  4. Discover selectors: spana selectors
  5. Run tests: spana test