-
-
Notifications
You must be signed in to change notification settings - Fork 453
feat: tvos 17+ workaround with skipDeviceCheck
#2194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 18 commits
9e77d9f
efb3ff9
206235d
e128d07
b881822
21a3924
9a51048
143cfb5
6e066fb
c3503af
9e469e4
20f1c5e
ee984b4
e79b5f0
5f8ba41
d2967b5
168c01a
1df46a7
229773c
8cb2554
218a0fc
7836dc5
6d516f0
3a3b6c5
22cef06
41f7109
c423f37
c933c8f
977ba5b
250493e
7c9f73c
c871bd2
2ad8a66
7a64ec3
80d50c6
8358e16
2521253
38b0e5b
188fc7e
76d9779
85d81ad
cef3c92
8a5b14f
1d2381c
c88d4c4
b962bf4
db1beba
d653145
bc19c2b
fd74701
518ece0
4d8cc19
4ba7755
8c68178
c294317
5437d32
4d0b52f
79264ff
fd02bab
c765bdc
aba9e03
5409206
bf9e95c
ca7003b
2feafa0
f8815a5
82de69a
8b51d89
ca73574
6aa6c0f
f0db281
4b7bbf8
f77c540
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -388,6 +388,18 @@ class XCUITestDriver extends BaseDriver { | |
| return !(CAP_NAMES_NO_XCODEBUILD_REQUIRED.some((x) => Boolean(this.opts[x]))); | ||
| } | ||
|
|
||
| /** | ||
| * Whether to skip the device check in a new session request. | ||
| * This is a workaround for network connected devices such as an Apple TV 4k real device. | ||
| * A situation that requires this capability may hve an issue to communicate with the device | ||
| * over appium-ios-device for example. | ||
| * Some methods that require the appium-ios-device may get issues. | ||
| * @returns {boolean} | ||
| */ | ||
| skipDeviceCheck() { | ||
KazuCocoa marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| return !!this.opts.skipDeviceCheck; | ||
| } | ||
|
|
||
| async createSession(w3cCaps1, w3cCaps2, w3cCaps3, driverData) { | ||
| try { | ||
| let [sessionId, caps] = await super.createSession(w3cCaps1, w3cCaps2, w3cCaps3, driverData); | ||
|
|
@@ -600,14 +612,16 @@ class XCUITestDriver extends BaseDriver { | |
| await this.installAUT(); | ||
|
|
||
| // if we only have bundle identifier and no app, fail if it is not already installed | ||
| if ( | ||
| !this.opts.app && | ||
| this.opts.bundleId && | ||
| !this.isSafari() && | ||
| // @ts-expect-error - do not assign arbitrary properties to `this.opts` | ||
| !(await this.opts.device.isAppInstalled(this.opts.bundleId)) | ||
| ) { | ||
| this.log.errorAndThrow(`App with bundle identifier '${this.opts.bundleId}' unknown`); | ||
| if (!this.skipDeviceCheck()) { | ||
| if ( | ||
|
||
| !this.opts.app && | ||
| this.opts.bundleId && | ||
| !this.isSafari() && | ||
| // @ts-expect-error - do not assign arbitrary properties to `this.opts` | ||
| !(await this.opts.device.isAppInstalled(this.opts.bundleId)) | ||
| ) { | ||
| this.log.errorAndThrow(`App with bundle identifier '${this.opts.bundleId}' unknown`); | ||
| } | ||
| } | ||
|
|
||
| if (this.isSimulator()) { | ||
|
|
@@ -1207,19 +1221,23 @@ class XCUITestDriver extends BaseDriver { | |
| return {device, realDevice: false, udid: device.udid}; | ||
| } | ||
| } else { | ||
| // make sure it is a connected device. If not, the udid passed in is invalid | ||
| const devices = await getConnectedDevices(); | ||
| this.log.debug(`Available devices: ${devices.join(', ')}`); | ||
| if (!devices.includes(this.opts.udid)) { | ||
| // check for a particular simulator | ||
| this.log.debug(`No real device with udid '${this.opts.udid}'. Looking for a simulator`); | ||
| try { | ||
| const device = await getSimulator(this.opts.udid, { | ||
| devicesSetPath: this.opts.simulatorDevicesSetPath, | ||
| }); | ||
| return {device, realDevice: false, udid: this.opts.udid}; | ||
| } catch (ign) { | ||
| throw new Error(`Unknown device or simulator UDID: '${this.opts.udid}'`); | ||
| if (this.skipDeviceCheck()) { | ||
| this.log.info(`Skipping connected device check. Using the given udid ${this.opts.udid}.`); | ||
| } else { | ||
| // make sure it is a connected device. If not, the udid passed in is invalid | ||
| const devices = await getConnectedDevices(); | ||
KazuCocoa marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| this.log.debug(`Available devices: ${devices.join(', ')}`); | ||
| if (!devices.includes(this.opts.udid)) { | ||
| // check for a particular simulator | ||
| this.log.debug(`No real device with udid '${this.opts.udid}'. Looking for a simulator`); | ||
| try { | ||
| const device = await getSimulator(this.opts.udid, { | ||
| devicesSetPath: this.opts.simulatorDevicesSetPath, | ||
| }); | ||
| return {device, realDevice: false, udid: this.opts.udid}; | ||
| } catch (ign) { | ||
| throw new Error(`Unknown device or simulator UDID: '${this.opts.udid}'`); | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -1656,6 +1674,11 @@ class XCUITestDriver extends BaseDriver { | |
| return; | ||
| } | ||
|
|
||
| if (this.opts.bundleId && this.skipDeviceCheck()) { | ||
| this.log.info('Skipping the bundle id installation check'); | ||
| return; | ||
| } | ||
|
|
||
| await verifyApplicationPlatform(this.opts.app, { | ||
| isSimulator: this.isSimulator(), | ||
| isTvOS: isTvOs(this.opts.platformName), | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe also mention this capability is temporary and we'll remove it as soon as we have a decent replacement to the ios-device lib
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or maybe we could just use devicectl to list devices and do other stuff, so then we'd have an option to not skip, but use devicectl instead of ios-device
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for example we could run
xcrun devicectl list devicesto list devices