# Mobilewright

[Mobilewright](https://mobilewright.dev) is a TypeScript/JavaScript automation framework for iOS and Android, inspired by Playwright's architecture and API. Full documentation is at [mobilewright.dev/docs](https://mobilewright.dev/docs).

This page covers how to connect Mobilewright to **Mobile Next Cloud** to run your scripts and tests against real cloud devices instead of local simulators.

## Connect to Mobile Next Cloud[​](#connect-to-mobile-next-cloud "Direct link to Connect to Mobile Next Cloud")

Mobilewright uses a `driver` config option to target cloud devices. When `MOBILENEXT_API_KEY` is set, add a `driver` block to your `mobilewright.config.ts`:

```
import { defineConfig, type MobilewrightConfig } from 'mobilewright';



const config: MobilewrightConfig = {

  platform: 'ios',

  bundleId: 'com.example.myapp',

  // ...rest of your config

};



if (process.env['MOBILENEXT_API_KEY']) {

  config.driver = {

    type: 'mobilenext',

    apiKey: process.env['MOBILENEXT_API_KEY'],

  };

}



export default defineConfig(config);
```

When `MOBILENEXT_API_KEY` is not set, Mobilewright falls back to a local device via mobilecli. This lets you run the same config locally and in CI without any code changes.

## Test result metadata[​](#test-result-metadata "Direct link to Test result metadata")

The driver config accepts an optional `testResult` block to label runs in the Mobile Next Cloud dashboard:

```
config.driver = {

  type: 'mobilenext',

  apiKey: process.env['MOBILENEXT_API_KEY'],

  testResult: {

    name: 'Smoke suite',

    tags: ['nightly'],

    environment: 'production',

  },

};
```

## Get an API key[​](#get-an-api-key "Direct link to Get an API key")

Get your API key at [app.mobilenext.ai](https://app.mobilenext.ai). See [Mobile Next Cloud](https://mobilenext.ai/docs/docs/cloud/overview.md) for device allocation and account setup.
