Mobile Testing Examples
Real-world Appium/WebdriverIO test examples using @testrelic/appium-analytics — Android native, iOS native, and mobile web testing.
Example projects
Android iOS or mobile web
Reporter outputs
Write Appium tests with an AI assistant
Copy any prompt below and paste it into your AI coding assistant to generate ready-to-run tests.
Android native app test
Write a WebdriverIO/Appium test file for Android using @wdio/globals.
The test should:
1. Verify the home screen loads and a title element (~AppTitle) is visible
2. Add a new task by clicking ~AddTaskButton, filling an input, saving, and verifying it appears in the list
3. Mark a task as complete by clicking its checkbox
Use describe/it blocks with mocha syntax.
Use async/await throughout.iOS native app test
Write a WebdriverIO/Appium test file for iOS using @wdio/globals.
The test should:
1. Verify a Calculator app display (~Display) is visible on launch
2. Perform a basic addition: 2 + 3 = 5, verify the display shows '5'
3. Clear the display with the ~AC button and verify it shows '0'
Use describe/it blocks with mocha syntax.
Use async/await throughout.Mobile web test
Write a WebdriverIO test file for testing a mobile web app at https://example-shop.com/products.
The test should:
1. Verify the product grid ([data-testid="product-grid"]) is displayed
2. Click the first product card and verify the product title and add-to-cart button are visible
3. Verify the mobile hamburger menu button is visible and opens the nav when clicked
Use describe/it blocks. Use async/await throughout.Cross-platform WDIO config
Create a wdio.conf.ts that runs tests on both Android and iOS simultaneously using maxInstances: 2.
Include:
- Android capability: UiAutomator2, emulator-5554, an APK at apps/MyApp.apk
- iOS capability: XCUITest, iPhone 15, platformVersion 17.0, a .app at apps/MyApp.app
- TestRelicService with screenshotOnEvery: 'failure'
- TestRelicReporter writing to ./test-results/cross-platform-timeline.json
- onComplete hook calling TestRelicReporter.finalize()
Show me the complete config.Was this page helpful?