capacitor-testing

Implements unit, integration, E2E, and native tests for Capacitor mobile applications.

2|1|Updated Aug 14, 2026
One-click install
npx skills add https://github.com/gaomingzhao666/capacitor-native-navigation-bar --skill capacitor-testing-gaomingzhao666
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: capacitor-testing
Source: https://github.com/gaomingzhao666/capacitor-native-navigation-bar/tree/main/.claude/skills/capacitor-testing
Command: npx skills add https://github.com/gaomingzhao666/capacitor-native-navigation-bar --skill capacitor-testing-gaomingzhao666

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Testing Capacitor apps requires coordinating multiple frameworks across web and native layers, and mocking native plugins correctly is a common source of broken or flaky tests. This Skill provides complete, working configurations and test patterns for every layer of the testing pyramid. ## Core Features & Use Cases - Unit Testing with Vitest: Set up Vitest with jsdom, mock Capacitor core and plugins like NativeBiometric, and write platform-specific test utilities. - Component and E2E Testing: Test React and Vue components with Testing Library, run Playwright tests against mobile device profiles, and drive real devices with Appium or Detox. - Native Testing: Write XCTest cases for iOS plugins and JUnit/instrumented tests for Android, plus CI workflows for GitHub Actions covering unit, E2E, iOS, and Android jobs. - Use Case: You are adding biometric login to a Capacitor 7 app and need to verify it works. Use this Skill to mock NativeBiometric in Vitest unit tests, test the login button component, and run an Appium test that simulates Touch ID on a real simulator. ## Quick Start Set up Vitest unit tests with mocked Capacitor plugins for my app's authentication service.

Frequently Asked Questions about capacitor-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I mock Capacitor plugins in Vitest unit tests?▼

Mock Capacitor plugins using vi.mock in a setup file, replacing plugin methods with vi.fn() stubs. For example, mock NativeBiometric's isAvailable and verifyIdentity methods to return resolved promises, then control behavior per-test with mockResolvedValueOnce.

What testing framework should I use for Capacitor E2E tests?▼

Use Playwright for web-layer E2E tests with mobile device emulation profiles like iPhone 14 and Pixel 7. For testing on real native apps, use Appium with WebdriverIO for XCUITest on iOS and UiAutomator2 on Android.

Can I test biometric authentication in Capacitor unit tests?▼

Yes, biometric authentication is testable by mocking the NativeBiometric plugin's verifyIdentity, isAvailable, and credential methods. You can simulate success, unavailability, and user cancellation by controlling the mocked promise resolutions.

How do I test platform-specific code for iOS and Android?▼

Create test utilities that mock Capacitor.getPlatform and isNativePlatform to return 'ios', 'android', or 'web'. Call these helpers inside each test to exercise platform-conditional branches without needing real devices.

Does Playwright testing cover native Capacitor plugin behavior?▼

No, Playwright only tests the web layer in a browser and cannot exercise native plugin code. Use Appium or Detox to run tests against compiled iOS and Android app binaries where native plugins actually execute.