> ## Documentation Index
> Fetch the complete documentation index at: https://jetify-dependabot-npm-and-yarn-npm-and-yarn-387f502f5a.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Testing iOS Apps with Testpilot

> Run automated tests on iOS devices and simulators. Configure Xcode, set up your iOS simulator, and execute your first iOS test.

## Prerequisites[​](#prerequisites "Direct link to Prerequisites")

Before you can run tests on iOS devices, you'll need to set up Appium and the iOS-specific
dependencies:

1. Install Appium Server and dependencies:

   ```bash theme={null}
   # Install Appium globally
   npm install -g appium

   # Install Appium Doctor for diagnostics
   npm install -g appium-doctor

   # Install the XCUITest driver for iOS testing
   appium driver install xcuitest
   ```

2. Verify your Appium installation:

   ```bash theme={null}
   appium-doctor --ios
   ```

   This command will check your system specifically for iOS testing requirements and highlight any
   issues that need to be fixed.

3. Start the Appium server:

   ```bash theme={null}
   appium --allow-cors
   ```

   You'll need to keep this server running in a separate terminal window while executing your tests.

## Setting Up an iOS Simulator[​](#setting-up-an-ios-simulator "Direct link to Setting Up an iOS Simulator")

Testpilot works with iOS simulators managed through Xcode. Here's how to set one up:

1. Install Xcode from the Mac App Store (requires macOS)

2. Open Xcode and accept any license agreements

3. Open the simulator by going to Xcode → Open Developer Tool → Simulator

4. Create a new simulator device:
   * In Xcode, go to Window → Devices and Simulators
   * Click the "+" button to add a new simulator
   * Choose a device type (iPhone 13 or newer recommended)
   * Select the latest iOS version
   * Give your simulator a descriptive name and click "Create"

## Creating an iOS Test[​](#creating-an-ios-test "Direct link to Creating an iOS Test")

Create a test file (e.g., `ios-test.pilot.yaml`) with the platform\_config specifying your iOS app
bundle identifier:

```yaml theme={null}
name: "iOS App Test"
context:
  - text: "Testing a native iOS application"
cases:
  - id: "ios-basic-001"
    name: "Basic iOS Navigation"
    description: "Test basic navigation in the iOS app"
    platform_config:
      ios_bundle: "com.example.MyApp" # Replace with your app's bundle identifier
    steps:
      - "Verify the app launches successfully"
      - "Tap on the 'Login' button"
      - "Enter username and password"
      - "Tap the Submit button"
      - "Verify successful login"
```

## Running iOS Tests[​](#running-ios-tests "Direct link to Running iOS Tests")

To run a test on an iOS simulator or device, use the following command. You must specify the
`--driver`, `--os`, `--runtime`, `--os-version`, and `--udid` flags to ensure the test runs
correctly on your iOS simulator:

```bash theme={null}
testpilot test ios-test.pilot.yaml --driver appium --os ios --runtime native --udid <device-udid>
```

<Check>
  You can find your device's UDID using

  ```bash theme={null}
  xcrun simctl list
  ```

  To get a list of running sims, use:

  ```bash theme={null}
  xcrun simctl list booted
  ```
</Check>

For testing web content in Safari on an iOS device:

```bash theme={null}
testpilot test web-test.pilot.yaml --driver appium --os ios --runtime safari --os-version 18.5
```

## Test Platform Configuration[​](#test-platform-configuration "Direct link to Test Platform Configuration")

The `platform_config` section of your test file is crucial for iOS testing:

```yaml theme={null}
platform_config:
  url: "https://example.com" # For browser-based tests
  ios_bundle: "com.example.MyApp" # For native app tests
```

* Use `url` for browser-based tests on iOS Safari
* Use `ios_bundle` for native iOS app tests

## iOS-Specific Considerations[​](#ios-specific-considerations "Direct link to iOS-Specific Considerations")

When testing iOS applications, keep in mind:

1. **Permissions**: iOS will prompt for permissions (camera, microphone, etc.). Your test steps
   should account for these permission dialogs.

2. **Security Features**: iOS has stricter security than Android. Your app must be properly signed
   and provisioned for testing.

3. **App Installation**: For simulators, you'll need an .app file; for physical devices, you'll need
   a signed .ipa file.
