Skip to content

Commit 7737f8e

Browse files
maestro: when passing an ipa file, assume --real-device
1 parent e865c90 commit 7737f8e

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

src/models/maestro_options.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ export interface MaestroRunOptions {
3838
}
3939

4040
export default class MaestroOptions {
41+
private static isIpaFile(app?: string): boolean {
42+
return app?.toLowerCase().endsWith('.ipa') ?? false;
43+
}
44+
4145
private _app: string;
4246
private _flows: string[];
4347
private _device?: string;
@@ -113,7 +117,8 @@ export default class MaestroOptions {
113117
this._async = options?.async ?? false;
114118
this._report = options?.report;
115119
this._reportOutputDir = options?.reportOutputDir;
116-
this._realDevice = options?.realDevice ?? false;
120+
// IPA files can only be tested on real iOS devices, so automatically enable realDevice
121+
this._realDevice = MaestroOptions.isIpaFile(app) || (options?.realDevice ?? false);
117122
this._downloadArtifacts = options?.downloadArtifacts;
118123
this._artifactsOutputDir = options?.artifactsOutputDir;
119124
this._ignoreChecksumCheck = options?.ignoreChecksumCheck ?? false;

tests/models/maestro_options.test.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ describe('MaestroOptions', () => {
116116
expect(caps).toEqual({
117117
deviceName: '*',
118118
platformName: 'iOS',
119+
realDevice: 'true', // IPA files require real devices
119120
});
120121
});
121122

@@ -196,6 +197,7 @@ describe('MaestroOptions', () => {
196197
timeZone: 'Europe/London',
197198
throttleNetwork: 'Edge',
198199
geoCountryCode: 'GB',
200+
realDevice: 'true', // IPA files require real devices
199201
});
200202
});
201203

@@ -454,12 +456,28 @@ describe('MaestroOptions', () => {
454456
});
455457

456458
describe('realDevice option', () => {
457-
it('should have realDevice as false by default', () => {
459+
it('should have realDevice as false by default for APK files', () => {
458460
const options = new MaestroOptions('app.apk', './flows', 'Pixel 8');
459461

460462
expect(options.realDevice).toBe(false);
461463
});
462464

465+
it('should automatically enable realDevice for IPA files', () => {
466+
const options = new MaestroOptions('app.ipa', './flows', 'iPhone 15');
467+
468+
// IPA files can only be tested on real iOS devices
469+
expect(options.realDevice).toBe(true);
470+
});
471+
472+
it('should automatically enable realDevice for IPA files even without explicit option', () => {
473+
const options = new MaestroOptions('app.ipa', './flows', 'iPhone 15', {
474+
platformName: 'iOS',
475+
realDevice: false, // Even when explicitly set to false, IPA should force it to true
476+
});
477+
478+
expect(options.realDevice).toBe(true);
479+
});
480+
463481
it('should store realDevice when set to true', () => {
464482
const options = new MaestroOptions('app.apk', './flows', 'Pixel 8', {
465483
realDevice: true,

tests/providers/maestro.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,7 @@ describe('Maestro', () => {
449449
{
450450
deviceName: '*',
451451
platformName: 'iOS',
452+
realDevice: 'true', // IPA files require real devices
452453
},
453454
],
454455
}),

0 commit comments

Comments
 (0)