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: always use vendContainer to add files without extra app permissions #2522

Merged
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 2 additions & 1 deletion docs/guides/file-transfer.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ possible formats this path can take:
* `<container-type>` is the container type
* On simulators, common values are `app`, `data`, `groups`, but a custom one can also be provided
* On real devices, the only accepted value is `documents`. All others are treated as Format 2
* This value can only be specified for apps that have the `UIFileSharingEnabled` flag set to
* In `xcuitest-driver` versions prior to version `v8.1.0` the following limitation applies:
aluedeke marked this conversation as resolved.
Show resolved Hide resolved
This value can only be specified for apps that have the `UIFileSharingEnabled` flag set to
`true`. You can use the [`mobile: listApps`](../reference/execute-methods.md#mobile-listapps)
extension to identify such apps.
* `<path-to-file-or-folder>` is the target file or folder
Expand Down
9 changes: 3 additions & 6 deletions lib/commands/file-movement.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,14 @@ function verifyIsSubPath(originalPath, root) {
*
* @param {string} udid
* @param {string} [bundleId]
* @param {string} [containerType]
* @returns {Promise<any>}
*/
async function createAfcClient(udid, bundleId, containerType) {
async function createAfcClient(udid, bundleId) {
if (!bundleId) {
return await services.startAfcService(udid);
}
const service = await services.startHouseArrestService(udid);
return isDocumentsContainer(containerType)
? await service.vendDocuments(bundleId)
: await service.vendContainer(bundleId);
return await service.vendContainer(bundleId);
mykola-mokhnach marked this conversation as resolved.
Show resolved Hide resolved
}

/**
Expand All @@ -103,7 +100,7 @@ function isDocumentsContainer(containerType) {
async function createService(remotePath) {
if (CONTAINER_PATH_PATTERN.test(remotePath)) {
const {bundleId, pathInContainer, containerType} = await parseContainerPath.bind(this)(remotePath);
const service = await createAfcClient(this.device.udid, bundleId, containerType);
const service = await createAfcClient(this.device.udid, bundleId);
const relativePath = isDocumentsContainer(containerType)
mykola-mokhnach marked this conversation as resolved.
Show resolved Hide resolved
? path.join(CONTAINER_DOCUMENTS_PATH, pathInContainer)
: pathInContainer;
Expand Down
Loading