A Flutter e‑commerce demo with a full test pyramid: unit, widget, integration, and E2E (Appium/WebdriverIO). Covers permission-heavy onboarding, catalog/search/cart, and CI options (Slack, Firebase Test Lab, BrowserStack).
- Onboarding with location, camera, notification, and optional ATT steps; test toggles (
skipPermissionRequests,includeATTStepForTesting) keep integration runs deterministic without real permission dialogs. - Provider-based state with services/models for categories, products, and cart; unit tests use mocks.
- Semantics on search, product cards, and cart so widget and E2E can share the same element lookup.
- Layered automation: Dart unit/widget in
test/, device flows inintegration_test/, Appium (WebdriverIO) ine2e/.
| Layer | Focus |
|---|---|
| Unit | Providers, services, models |
| Widget | Screens, components, semantics |
| Integration | Full app flows on device |
| E2E | Real APK/IPA via Appium |
Coverage is measured with flutter test --coverage (unit + widget only). Aim for high coverage on critical lib/ code; integration and E2E stay small and focused on critical flows.
- Flutter 3.9+, Android Studio / Xcode.
flutter pub getthenflutter run.
For E2E: Node.js 16+, Appium Server, Android/iOS drivers — see e2e/README.md.
Unit & widget
flutter test test/unit
flutter test test/widgetIntegration (Flutter)
Uses test flags so permission dialogs are skipped; flows stay deterministic.
flutter test integration_testE2E (Appium + WebdriverIO)
cd e2e && npm install
npm test
npm run test:android
npm run test:shoppingUse APP_PATH, PLATFORM and other env vars; see e2e/driver.config.js.
./run_tests.sh— pub get, format, analyze, unit + widget tests, LCOV/HTML../run_coverage.sh/coverage.sh— coverage output (unit + widget).
GitHub Actions workflows:
| Workflow | Trigger | Purpose |
|---|---|---|
test.yml |
workflow_dispatch |
E2E on Android emulator; screenshots, recordings, artifacts; optional Slack. Secrets: SLACK_WEBHOOK_URL (failure notification), SLACK_BOT_TOKEN, SLACK_CHANNEL_ID (per-test results + uploads). |
test-firebase.yml |
workflow_dispatch |
APK to Firebase Test Lab; Robo test on real device. Secrets: GCP_SA_KEY, GCP_PROJECT_ID. |
test-browserstack.yml |
workflow_dispatch |
Same E2E suite on BrowserStack App Automate. Secrets: BROWSERSTACK_USERNAME, BROWSERSTACK_ACCESS_KEY. Optional input: apk_url to skip build. |
| Path | Contents |
|---|---|
lib/ |
App: splash, onboarding, catalog, product detail, cart, checkout, search, widgets |
test/unit |
Provider/service tests (Mockito) |
test/widget |
Screen and widget tests, semantics |
integration_test/ |
Onboarding, cart, search, app launch flows |
e2e/ |
WebdriverIO config, helpers, suites (onboarding, cart, shopping) |
analysis_options.yaml |
flutter_lints and project rules |
Related: Flutter Test Pyramid: Layers, Coverage, and E2E with Appium