Skip to content
Merged
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: 4 additions & 0 deletions packages/vscode-extension/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ import { AdminRestrictedFunctionalityError, PaywalledFunctionalityError } from "
import { registerRadonAI } from "./ai/mcp/RadonMcpController";
import { MaestroCodeLensProvider } from "./providers/MaestroCodeLensProvider";
import { removeLicense } from "./utilities/license";
import { getTelemetryReporter } from "./utilities/telemetry";
import { getEditorType } from "./utilities/editorType";

const CHAT_ONBOARDING_COMPLETED = "chat_onboarding_completed";

Expand Down Expand Up @@ -100,6 +102,8 @@ export async function activate(context: ExtensionContext) {
// after improper deactivation of the extension.
commands.executeCommand("setContext", "RNIDE.panelIsOpen", false);

getTelemetryReporter().sendTelemetryEvent(`extension:activated:${getEditorType()}`);

context.subscriptions.push(
window.registerWebviewPanelSerializer(TabPanel.viewType, new TabPanelSerializer())
);
Expand Down
32 changes: 31 additions & 1 deletion packages/vscode-extension/src/project/MaestroTestRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ import { homedir } from "os";
import path from "path";
import * as vscode from "vscode";
import { Disposable } from "vscode";
import { DevicePlatform } from "../common/State";
import { DeviceInfo, DevicePlatform, DeviceType } from "../common/State";
import { DeviceBase } from "../devices/DeviceBase";
import { ChildProcess, exec, lineReader } from "../utilities/subprocess";
import { getOrCreateDeviceSet, IosSimulatorDevice } from "../devices/IosSimulatorDevice";
import { extensionContext } from "../utilities/extensionContext";
import { Logger } from "../Logger";
import { getTelemetryReporter } from "../utilities/telemetry";

class MaestroPseudoTerminal implements vscode.Pseudoterminal {
private writeEmitter = new vscode.EventEmitter<string>();
Expand Down Expand Up @@ -46,6 +47,27 @@ class MaestroPseudoTerminal implements vscode.Pseudoterminal {
}
}

enum DeviceFamily {
IPHONE_SIMULATOR = "iphone_simulator",
IPAD_SIMULATOR = "ipad_simulator",
ANDROID_EMULATOR = "android_emulator",
ANDROID_PHYSICAL = "android_physical",
}

function getDeviceFamily(deviceInfo: DeviceInfo) {
if (deviceInfo.platform === DevicePlatform.IOS) {
if (deviceInfo.deviceType === DeviceType.Tablet) {
return DeviceFamily.IPAD_SIMULATOR;
}
return DeviceFamily.IPHONE_SIMULATOR;
}

if (deviceInfo.emulator) {
return DeviceFamily.ANDROID_EMULATOR;
}
return DeviceFamily.ANDROID_PHYSICAL;
Comment on lines +58 to +68
Copy link
Member

@latekvo latekvo Dec 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be sure, we don't want to be checking deviceInfo.deviceType on android devices? (feel free to ignore if this is a dumb question)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't set it for Androids, it's always Phone (at this time, at least)

}

export class MaestroTestRunner implements Disposable {
private readonly device: DeviceBase;
private terminal: vscode.Terminal | undefined;
Expand Down Expand Up @@ -88,6 +110,9 @@ export class MaestroTestRunner implements Disposable {
}

public async startMaestroTest(fileNames: string[]): Promise<void> {
const deviceFamily = getDeviceFamily(this.device.deviceInfo);
getTelemetryReporter().sendTelemetryEvent(`maestro:test_started:${deviceFamily}`);

const { terminal, pty } = this.getOrCreateTerminal();
terminal.show(true);
// For some reason the terminal isn't ready immediately and loses initial output
Expand Down Expand Up @@ -116,12 +141,14 @@ export class MaestroTestRunner implements Disposable {
try {
await this.runMaestro(fileNames, pty);
pty.writeLine(`\x1b[32mMaestro test completed successfully!\x1b[0m`);
getTelemetryReporter().sendTelemetryEvent(`maestro:test_completed:${deviceFamily}`);
} catch (error) {
const exitCode =
error && typeof error === "object" && "exitCode" in error ? error.exitCode : null;
// SIGTERM exit code
if (exitCode !== null && exitCode !== 143) {
pty.writeLine(`\x1b[31mMaestro test failed with exit code ${exitCode}\x1b[0m`);
getTelemetryReporter().sendTelemetryEvent(`maestro:test_failed:${deviceFamily}`);
}
} finally {
await cleanupSymlink();
Expand All @@ -133,6 +160,8 @@ export class MaestroTestRunner implements Disposable {
if (!this.maestroProcess) {
return;
}
const deviceFamily = getDeviceFamily(this.device.deviceInfo);

this.pty?.writeLine("");
this.pty?.writeLine(`\x1b[33mAborting Maestro test...\x1b[0m`);

Expand All @@ -154,6 +183,7 @@ export class MaestroTestRunner implements Disposable {
this.maestroProcess = undefined;

this.pty?.writeLine(`\x1b[33mMaestro test aborted\x1b[0m`);
getTelemetryReporter().sendTelemetryEvent(`maestro:test_aborted:${deviceFamily}`);
}

public async dispose() {
Expand Down
Loading