Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/performance/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,8 @@ Integration tests for MetaMask Connect:
- `legacy-evm-rn-connect.spec.ts` - Legacy EVM connection via the React Native Playground APK

> The RN playground tests require a separate APK built from the
> [`playground/react-native-playground`](https://github.com/MetaMask/connect-monorepo/tree/main/playground/react-native-playground)
> directory of the [connect-monorepo](https://github.com/MetaMask/connect-monorepo).
> [`playground/react-native-playground`](https://github.com/MetaMask/metamask-connect/tree/main/playground/react-native-playground)
> directory of the [metamask-connect](https://github.com/MetaMask/metamask-connect).
> The APK must be installed on the emulator before running.
> See [`tests/performance/mm-connect/README.md`](mm-connect/README.md) for full setup instructions.

Expand Down
28 changes: 14 additions & 14 deletions tests/performance/mm-connect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,22 @@ automatically **uninstalls and reinstalls** it on the emulator every run.
| --------------------------- | ------------------------------------------------------------- |
| Android emulator | Running and reachable via `adb` |
| MetaMask wallet APK | Built or pointed to via `buildPath` in `playwright.config.ts` |
| `connect-monorepo` checkout | Cloned **next to** `metamask-mobile` (same parent directory) |
| `metamask-connect` checkout | Cloned **next to** `metamask-mobile` (same parent directory) |

Expected directory layout:

```
Documents/MetaMask/ # or wherever you keep these repos
├── metamask-mobile/ # this repo
└── connect-monorepo/ # https://github.com/MetaMask/connect-monorepo
└── metamask-connect/ # https://github.com/MetaMask/metamask-connect
└── playground/
└── react-native-playground/
```

### Get the Playground APK

The playground APK is published as a GitHub Release asset with every
connect-monorepo release. You can download it automatically or build locally.
metamask-connect release. You can download it automatically or build locally.

#### Option A — Download from GitHub Releases (recommended)

Expand Down Expand Up @@ -81,15 +81,15 @@ expects a Metro dev server at runtime.
**Step 1 — Install monorepo dependencies:**

```bash
cd /path/to/connect-monorepo
cd /path/to/metamask-connect
yarn install
```

**Step 2 — Build all workspace packages** (so `@metamask/connect-evm`,
`@metamask/playground-ui`, etc. have their `dist/` output):

```bash
cd /path/to/connect-monorepo
cd /path/to/metamask-connect
yarn build
```

Expand All @@ -99,7 +99,7 @@ The playground uses Infura RPC endpoints for blockchain requests. Copy the
example `.env` file and add your key:

```bash
cd /path/to/connect-monorepo/playground/react-native-playground
cd /path/to/metamask-connect/playground/react-native-playground
cp .env.example .env
```

Expand All @@ -116,38 +116,38 @@ EXPO_PUBLIC_INFURA_API_KEY=your_infura_api_key_here
deleting the `android/` directory):

```bash
cd /path/to/connect-monorepo/playground/react-native-playground
cd /path/to/metamask-connect/playground/react-native-playground
npx expo prebuild --platform android
```

**Step 5 — Build the release APK:**

```bash
cd /path/to/connect-monorepo/playground/react-native-playground/android
cd /path/to/metamask-connect/playground/react-native-playground/android
./gradlew assembleRelease
```

The first build takes ~7 minutes. Subsequent builds are incremental and much
faster. The output APK will be at:

```
connect-monorepo/playground/react-native-playground/android/app/build/outputs/apk/release/app-release.apk
metamask-connect/playground/react-native-playground/android/app/build/outputs/apk/release/app-release.apk
```

#### Rebuilding after changes

When you edit the playground source, run the build command again:

```bash
cd /path/to/connect-monorepo/playground/react-native-playground/android
cd /path/to/metamask-connect/playground/react-native-playground/android
./gradlew assembleRelease
```

If you also changed shared workspace packages (e.g. `@metamask/playground-ui`),
rebuild those first:

```bash
cd /path/to/connect-monorepo
cd /path/to/metamask-connect
yarn build
```

Expand All @@ -160,7 +160,7 @@ BrowserStack before test execution. The relevant environment variables are:

| Variable | Description |
| -------------------------------- | ----------------------------------------------- |
| `RN_PLAYGROUND_APK_VERSION` | Pin to a specific connect-monorepo release |
| `RN_PLAYGROUND_APK_VERSION` | Pin to a specific metamask-connect release |
| `RN_PLAYGROUND_APK_PATH` | Override APK path (skips download) |
| `BROWSERSTACK_RN_PLAYGROUND_URL` | BrowserStack `bs://` URL for the playground APK |

Expand Down Expand Up @@ -289,12 +289,12 @@ reinstall (`adb install app/build/outputs/apk/release/app-release.apk`).
**`RPCErr50: 401 on https://mainnet.infura.io/v3/ for method POST`**

The Infura API key is missing or was not inlined during the APK build. Make
sure the `.env` file in `connect-monorepo/playground/react-native-playground/`
sure the `.env` file in `metamask-connect/playground/react-native-playground/`
contains a valid `EXPO_PUBLIC_INFURA_API_KEY`. After updating the key you must
clear the build cache and rebuild:

```bash
cd /path/to/connect-monorepo/playground/react-native-playground
cd /path/to/metamask-connect/playground/react-native-playground
rm -rf android/app/build
cd android && ./gradlew assembleRelease
```
Expand Down
8 changes: 4 additions & 4 deletions tests/performance/mm-connect/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@ export function cleanupAdbReverse(port: number): void {
// Candidate paths for the playground release APK, checked in priority order:
// 1. Explicitly set via RN_PLAYGROUND_APK_PATH env var
// 2. Downloaded by tests/scripts/fetch-rn-playground-apk.sh
// 3. Locally built in sibling connect-monorepo
// 3. Locally built in sibling metamask-connect
const PLAYGROUND_APK_CANDIDATES = [
process.env.RN_PLAYGROUND_APK_PATH,
'./tmp/rn-playground.apk',
'../connect-monorepo/playground/react-native-playground/android/app/build/outputs/apk/release/app-release.apk',
'../metamask-connect/playground/react-native-playground/android/app/build/outputs/apk/release/app-release.apk',
].filter(Boolean) as string[];

/**
Expand All @@ -142,9 +142,9 @@ function resolvePlaygroundApkPath(): string {
).join('\n') +
'\n\nTo fix this, either:\n' +
' 1. Run: ./tests/scripts/fetch-rn-playground-apk.sh\n' +
' (downloads the latest APK from connect-monorepo GitHub Releases)\n' +
' (downloads the latest APK from metamask-connect GitHub Releases)\n' +
' 2. Build locally:\n' +
' cd connect-monorepo && yarn install && yarn build\n' +
' cd metamask-connect && yarn install && yarn build\n' +
Comment thread
cursor[bot] marked this conversation as resolved.
' cd playground/react-native-playground && npx expo prebuild --platform android\n' +
' cd android && ./gradlew assembleRelease\n' +
' 3. Set RN_PLAYGROUND_APK_PATH to the APK location\n\n' +
Expand Down
6 changes: 3 additions & 3 deletions tests/scripts/fetch-rn-playground-apk.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# Fetch the React Native Playground APK from the connect-monorepo GitHub Releases.
# Fetch the React Native Playground APK from the metamask-connect GitHub Releases.
#
# Usage:
# ./tests/scripts/fetch-rn-playground-apk.sh [--version <version>] [--output <path>]
Expand All @@ -15,11 +15,11 @@
# RN_PLAYGROUND_APK_VERSION Alternative to --version flag.
#
# The script downloads the rn-playground-<version>.apk asset from the
# MetaMask/connect-monorepo GitHub Release matching the requested version.
# MetaMask/metamask-connect GitHub Release matching the requested version.

set -euo pipefail

REPO="MetaMask/connect-monorepo"
REPO="MetaMask/metamask-connect"
APK_PATTERN="rn-playground-"
OUTPUT_PATH="./tmp/rn-playground.apk"
VERSION="${RN_PLAYGROUND_APK_VERSION:-}"
Expand Down
Loading