Skip to content
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

feat: tvos 17 workaround with skipDeviceCheck #2194

Open
wants to merge 62 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
9e77d9f
chore: add workaround
KazuCocoa Nov 2, 2023
efb3ff9
chore: always return true
KazuCocoa Nov 2, 2023
206235d
chore: add caps
KazuCocoa Nov 7, 2023
e128d07
docs: tweak
KazuCocoa Nov 7, 2023
b881822
docs: add note
KazuCocoa Nov 7, 2023
21a3924
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Nov 7, 2023
9a51048
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Jan 4, 2024
143cfb5
chore: do not check the installed app
KazuCocoa Jan 12, 2024
6e066fb
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Jan 25, 2024
c3503af
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Feb 14, 2024
9e469e4
Update driver.js
KazuCocoa Feb 14, 2024
20f1c5e
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Feb 16, 2024
ee984b4
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Feb 20, 2024
e79b5f0
remove no-deps deps
KazuCocoa Feb 23, 2024
5f8ba41
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Feb 27, 2024
d2967b5
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Feb 29, 2024
168c01a
Revert "remove no-deps deps"
KazuCocoa Mar 1, 2024
1df46a7
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Mar 23, 2024
229773c
feat: add appium:usePreinstalledWDA for real iOS 17 devices (#2350)
KazuCocoa Mar 24, 2024
8cb2554
chore(release): 7.5.0 [skip ci]
semantic-release-bot Mar 24, 2024
218a0fc
chore: skip connected device check if the caps had webDriverAgentUrl …
KazuCocoa Mar 24, 2024
7836dc5
chore(release): 7.5.1 [skip ci]
semantic-release-bot Mar 24, 2024
6d516f0
chore: rename IosDeploy obhect to RealDevice to make the object meani…
KazuCocoa Mar 24, 2024
3a3b6c5
chore(release): 7.5.2 [skip ci]
semantic-release-bot Mar 24, 2024
22cef06
chore: include devicectl in IOSDeploy object (#2352)
KazuCocoa Mar 25, 2024
41f7109
docs: add description the warning is not for ios 16 and lower
KazuCocoa Mar 25, 2024
c423f37
add experimental description
KazuCocoa Mar 25, 2024
c933c8f
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Mar 25, 2024
977ba5b
fix typo
KazuCocoa Mar 25, 2024
250493e
tweak
KazuCocoa Mar 25, 2024
7c9f73c
fix lint
KazuCocoa Mar 25, 2024
c871bd2
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Mar 25, 2024
2ad8a66
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Mar 25, 2024
7a64ec3
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Mar 28, 2024
80d50c6
combine if
KazuCocoa Mar 29, 2024
8358e16
update doc
KazuCocoa Mar 29, 2024
2521253
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Mar 29, 2024
38b0e5b
move to the bottom
KazuCocoa Mar 29, 2024
188fc7e
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Apr 3, 2024
76d9779
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Apr 7, 2024
85d81ad
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Apr 7, 2024
cef3c92
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Apr 11, 2024
8a5b14f
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Apr 14, 2024
1d2381c
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Apr 19, 2024
c88d4c4
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Apr 26, 2024
b962bf4
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Apr 26, 2024
db1beba
Update driver.js
KazuCocoa Apr 26, 2024
d653145
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Apr 27, 2024
bc19c2b
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa May 4, 2024
fd74701
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa May 11, 2024
518ece0
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa May 21, 2024
4d8cc19
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Jun 11, 2024
4ba7755
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Jun 25, 2024
8c68178
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Jul 3, 2024
c294317
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Jul 11, 2024
5437d32
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Aug 1, 2024
4d0b52f
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Aug 22, 2024
79264ff
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Sep 18, 2024
fd02bab
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Sep 24, 2024
c765bdc
fix log
KazuCocoa Oct 23, 2024
aba9e03
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Oct 23, 2024
5409206
Merge branch 'master' into tvos-ios17-workaround2
KazuCocoa Nov 21, 2024
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
1 change: 1 addition & 0 deletions docs/reference/capabilities.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ about capabilities, refer to the [Appium documentation](https://appium.io/docs/e
|`appium:forceAppLaunch`| Specify if the app should be forcefully restarted if it is already running on session startup. This capability only has an effect if an application identifier has been passed to the test session (either explicitly, by setting bundleId, or implicitly, by providing app). Default is `true` unless `noReset` capability is set to `true`. |`true` or `false`|
|`appium:useNativeCachingStrategy`| Set this capability to `false` in order to use the custom elements caching strategy. This might help to avoid stale element exception on property change. By default the native XCTest cache resolution is used (`true`) for all native locators (e.g. all, but xpath). Check the corresponding [WebDriverAgent pull request](https://github.com/appium/WebDriverAgent/pull/516) for more details. |`true` or `false`|
|`appium:appLaunchStateTimeoutSec`|Allows to set the timeout in float seconds for the application state change on the session startup in range (0, 240) exclusively. The default value for it in XCTest is 60 seconds, which means WDA would throw an exception if the application under test is not ready for accessibility interactions in 60s after its process has started. **Important**: The fact the application's user interface is visible does not necessarily mean it could be immediately interacted with by XCTest. The latter must ensure the app's main thread is also idling. Setting this capability to a lower value might help to avoid prolonged test startup with problematic apps taking too much time to be ready and fail fast. It is not advised to increase the capability value above 60 seconds, rather consider fixing the affected application itself. Too low values though may cause unexpected app startup failures. The capability does not have an effect if the app under test is not (re)started at the beginning of the session. | `10.5` |
|`appium:skipDeviceCheck`| _Experimental. This capability may be removed without major version update if we no longer need this._ Whether to skip the device check in a new session request. This capability, `"appium:webDriverAgentUrl": "<device ip address>:<WDA port>"` and `"appium:skipLogCapture": true` might help to avoid [Apple TV 4k tvOS 17](https://github.com/appium/appium/issues/19343) connection issue, but if you need this capability, the session would have communication issue with the device. Commands that can work over WebDriverAgent may work, but commands such as application installation may not work. (We do not recommend using this capability. Please use this only when you need this.) Default is `false`. | `true` or `false` |

### Simulator

Expand Down
5 changes: 4 additions & 1 deletion lib/desired-caps.js
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,10 @@ const desiredCapConstraints = /** @type {const} */ ({
pageLoadStrategy: {
isString: true,
inclusionCaseInsensitive: ['none', 'eager', 'normal']
}
},
skipDeviceCheck: {
isBoolean: true,
},
});

export {desiredCapConstraints, PLATFORM_NAME_IOS, PLATFORM_NAME_TVOS};
Expand Down
23 changes: 20 additions & 3 deletions lib/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,9 @@ export class XCUITestDriver extends BaseDriver {
/** @type {import('./commands/pcap').TrafficCapture|null} */
_trafficCapture;

/** @type {boolean} */
skipDeviceCheck;

/** @type {Simulator|RealDevice} */
_device;

Expand Down Expand Up @@ -323,6 +326,13 @@ export class XCUITestDriver extends BaseDriver {
this.appInfosCache = new AppInfosCache(this.log);
this.remote = null;
this.doesSupportBidi = true;

// 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 tvOS 17+ real device.
// A situation that requires this capability may have an issue with communicating with the device
// over appium-ios-device for example.
// Please remove this capability when we no longer need this workaround.
this.skipDeviceCheck = this.opts.skipDeviceCheck || false;
}

async onSettingsUpdate(key, value) {
Expand Down Expand Up @@ -621,14 +631,16 @@ export class XCUITestDriver extends BaseDriver {

await this.installAUT();

// if we only have bundle identifier and no app, fail if it is not already installed
if (
// if we only have bundle identifier and no app, fail if it is not already installed.
if (this.skipDeviceCheck) {
this.log.debug(`Skipping ${this.opts.bundleId} installation check since skipDeviceCheck was given.`);
} else if (
!this.opts.app &&
this.opts.bundleId &&
!this.isSafari() &&
!(await this.device.isAppInstalled(this.opts.bundleId))
) {
this.log.errorAndThrow(`App with bundle identifier '${this.opts.bundleId}' unknown`);
throw this.log.errorWithException(`App with bundle identifier '${this.opts.bundleId}' unknown`);
}

if (this.isSimulator()) {
Expand Down Expand Up @@ -1582,6 +1594,11 @@ export class XCUITestDriver extends BaseDriver {
return;
}

if (this.opts.bundleId && this.skipDeviceCheck) {
this.log.debug('Skipping the bundle id installation check');
return;
}

await verifyApplicationPlatform.bind(this)();

const {install, skipUninstall} = await this.checkAutInstallationState();
Expand Down
Loading