πŸ§ͺ OptiTest

Stable automation identity for every Flutter widget.
One wrapper Β· deterministic keys Β· native semantics β€” Appium-ready out of the box.

Pub Zero deps License

OptiCore OptiKit

Buy Me A Coffee


πŸ”₯ Why OptiTest?

Appium suites shatter the moment keys are ad-hoc or layouts shift. OptiTest gives every widget one deterministic, namespaced tag β€” readable by Flutter tests and native drivers on iOS, Android, and web.

Testable(
  testId: TestKey.button('login_submit'),
  child: SubmitButton(),
)
// Appium locator β†’ btn_login_submit
⚑ Feature
βœ… 30 element types β€” button, input, listItem, bottomSheet, qrCode, …
βœ… State suffixes β€” disabled, loading, error, selected
βœ… Native semantics β€” same tag on Android, iOS, web β€” no extra wiring
βœ… Zero dependencies β€” pure Flutter, no codegen, no reflection
βœ… 40-char safe β€” auto-truncated to stay inside Appium limits

πŸš€ Install

flutter pub add optitest

⚑ One-Minute Example

import 'package:optitest/optitest.dart';

Column(
  children: [
    Testable(
      testId: TestKey.input('login_email'),
      child: TextField(decoration: InputDecoration(labelText: 'Email')),
    ),
    Testable(
      testId: TestKey.button('login_submit', state: ElementState.loading),
      child: FilledButton(onPressed: null, child: Text('Loading…')),
    ),
  ],
)
// β†’ inp_login_email
// β†’ btn_login_submit_loading

Full working sample in example/.


πŸ“– Documentation

Guide What's inside
πŸ“˜ Usage Guide Every pattern β€” inputs, lists, state variants, anti-patterns
πŸ”‘ Key Reference All 30 element types, prefixes, state suffixes
πŸ€– Appium Integration Locators for iOS, Android, WebdriverIO, Flutter Driver
βœ… Testing Best Practices Tag by intent, namespace per screen, index lists

🧩 Part of the opti* Toolkit

Package Purpose
πŸ— OptiCore BLoC micro-framework
⚑ OptiKit CLI Scaffolding & builds
πŸ§ͺ OptiTest Automation identity (this package)

πŸ› Issues & Contributions

Found a bug or want a new element type? Open an issue on GitHub β€” PRs welcome.


πŸ‘€ Author

Built with ❀️ by Mahmoud El Shenawy

LinkedIn GitHub Medium


πŸ“œ License

MIT β€” free for personal and commercial use.

Libraries

optitest
OptiTest β€” stable automation keys and testable widget wrappers for Flutter apps targeted by Appium, Flutter Driver, or integration tests.