Skip to content

feat: add action and camera values for mobile: pressButton#1115

Merged
eglitise merged 8 commits intoappium:masterfrom
eglitise:pressbutton
Mar 4, 2026
Merged

feat: add action and camera values for mobile: pressButton#1115
eglitise merged 8 commits intoappium:masterfrom
eglitise:pressbutton

Conversation

@eglitise
Copy link

@eglitise eglitise commented Mar 3, 2026

Currently WDA only supports the home, volumeUp and volumeDown buttons for iOS, but Apple's documentation also lists action and camera. This PR adds support for them.
Since not all devices have these buttons, their use is guarded behind the hasHardwareButton: check, which itself requires iOS 16, so a second guard was also added.

(I don't actually have a way to test this, so any validation would be appreciated)

Reference: https://developer.apple.com/documentation/xcuiautomation/xcuidevice/button?language=objc

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds support for additional iOS hardware button names (action, camera) to mobile: pressButton in WebDriverAgent by mapping them to the corresponding XCUIDeviceButton values when available on-device.

Changes:

  • Extend XCUIDevice (FBHelpers) button name mapping to include action (iOS 16+) and camera (iOS 16+) gated by hasHardwareButton:.
  • Update the public header docstring to list the newly supported button names.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.m Adds runtime-gated mapping for action/camera buttons and updates supported button list construction.
WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.h Updates API documentation to include action and camera button names.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

}
}

- (BOOL)fb_hasButton:(NSString *)buttonName
Copy link
Member

Choose a reason for hiding this comment

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

I assume this is expected to be called only for non-tvOS, then wrapping the entire method with #if !TARGET_OS_TV and reduce it inside this method would simplify the context switching when we read the code. Then, we can assume this button is dedicated for non-tvOS env.

Copy link
Author

@eglitise eglitise Mar 4, 2026

Choose a reason for hiding this comment

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

I would like to extend it in the other tvOS PR, which is why I haven't added the target compiler guard for the whole method. Or would it be better to make two separate fb_hasButton methods?

Copy link
Member

@KazuCocoa KazuCocoa Mar 4, 2026

Choose a reason for hiding this comment

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

Personally yes. One is dedicated for tvOS and the other is iPhone, rather than mixed up both in one method and add many if/endif in it. (this is more internal/private method thing)

@mykola-mokhnach
Copy link

Testing failed:

No visible @interface for 'XCUIDevice' declares the selector 'fb_hasButton:'

Test session results, code coverage, and logs:
Testing cancelled because the build failed.
/Users/runner/Library/Developer/Xcode/DerivedData/WebDriverAgent-fndqjcijeilvqoffkuwcnnjhnikz/Logs/Test/Test-WebDriverAgentLib-2026.03.04_16-59-53-+0000.xcresult

Copy link

@mykola-mokhnach mykola-mokhnach left a comment

Choose a reason for hiding this comment

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

me likey

@eglitise
Copy link
Author

eglitise commented Mar 4, 2026

I'll create the XCUITest driver PR after merging #1116, if that's okay.

@eglitise eglitise merged commit 3df0284 into appium:master Mar 4, 2026
43 of 46 checks passed
github-actions bot pushed a commit that referenced this pull request Mar 4, 2026
## [11.2.0](v11.1.7...v11.2.0) (2026-03-04)

### Features

* add `action` and `camera` values for `mobile: pressButton` ([#1115](#1115)) ([3df0284](3df0284))
@github-actions
Copy link

github-actions bot commented Mar 4, 2026

🎉 This PR is included in version 11.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants