Skip to content

fix: resolve hub URL on appium_lib_core 11+ and read viewportRect as a Hash (PPLT-6148) - #41

Merged
Shivanshu-07 merged 1 commit into
mainfrom
fix/appium-lib-core-server-url
Oct 8, 2026
Merged

Shivanshu-07 merged 1 commit into
mainfrom
fix/appium-lib-core-server-url

Conversation

@Shivanshu-07

@Shivanshu-07 Shivanshu-07 commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Jira: PPLT-6148 — Appium quarterly upgrade + shift default to Appium 2.x

The SDK breaks on appium_lib 15/16 (appium_lib_core >= 11) on every Appium server version.

Root cause

  • Metadata#remote_url and DriverMetadata#command_executor_url read the hub URL via @bridge.@http.@server_url. From appium_lib_core 11 (selenium-webdriver ClientConfig) that ivar is no longer set; the URL lives in http.client_config.server_url. The SDK got "", so:
    • App Percy resolved GenericProvider instead of AppAutomate → Android: Missing required tag name for comparison (no device name); iOS: silently skips the AppAutomate path.
    • Percy on Automate posted an empty commandExecutorUrl → CLI Comparison tag details not available.
  • AndroidMetadata read capabilities.to_json['viewportRect'], which indexes a JSON String, so the rect was never used and every call fell back to driver.get_system_bars (the Appium 2-only mobile: getSystemBars on core 13+).

Fix

  • Percy::DriverMetadata.server_url keeps the @server_url path and falls back to client_config.server_url (trailing slash stripped); used by both call sites.
  • viewportRect read via get_capability_value (Hash or nil).
  • CI: extra leg Ruby 3.3 + APPIUM_LIB_VERSION='~> 16.0'; appium_console only on the 12.x resolution; minitest ~> 5.0 (minitest 6 moved Minitest::Mock out).
  • Specs: client_config fallback, empty fallback, viewport-rect bar path; fixed the inert assert(x, y) in the touched specs.

Verification

  • Specs + 100% line coverage gate on Ruby 2.6 / 3.0 (appium_lib 12) and 3.3 (appium_lib 16.3.2 / core 13.1.4). New specs fail when the fix is reverted.
  • RuboCop: no new offenses vs main.
  • Live on BrowserStack with appium_lib 16.3.2: App Percy Android + iOS on Appium 1.22.0 and 2.19.0, and Percy on Automate (Chrome/Safari) on 2.19.0 — all 3/3 snapshots, comparison tags carry the real device names.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Android system bar measurements now use viewport data only when it is valid, and fall back to driver-provided measurements when it is unavailable.
    • Remote driver URLs are now detected from additional configuration sources, including when the HTTP client does not expose a server URL. Trailing slashes are removed from configured URLs, and an empty value is returned when no URL can be found.
  • Compatibility
    • Test coverage now includes Ruby 3.3 with a newer Appium library version.

…a Hash (PPLT-6148)

appium_lib_core 11+ (selenium-webdriver ClientConfig) no longer sets the HTTP
client's @server_url, so the SDK's reflection returned "". On BrowserStack that
made every session resolve to GenericProvider: Android App Percy failed with
"Missing required tag name for comparison", iOS silently skipped the AppAutomate
path, and Percy on Automate posted an empty executor URL ("Comparison tag details
not available"). Fall back to http.client_config.server_url when @server_url is
unset.

AndroidMetadata read capabilities.to_json['viewportRect'], which indexes a JSON
String, so the rect was never used and every call fell back to
driver.get_system_bars (the Appium 2-only `mobile: getSystemBars` on core 13+).
Read it through get_capability_value instead.

CI adds a Ruby 3.3 / appium_lib ~> 16.0 leg (APPIUM_LIB_VERSION) and pins
minitest ~> 5.0 (minitest 6 split out Minitest::Mock).

Verified live on BrowserStack with appium_lib 16.3.2 / core 13.1.4: App Percy
Android+iOS on Appium 1.22.0 and 2.19.0, and Percy on Automate mobile web on
2.19.0, all 3/3 snapshots.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Central YAML (base), Organization UI (inherited), Workspace UI (inherited)
  • Review profile: ASSERTIVE
  • Plan: Enterprise
  • Run ID: 0354e126-023b-45fa-bc24-880521b4e53a
📥 Commits

Reviewing files that changed from the base of the PR and between dc4c73d and 86e37fe.

📒 Files selected for processing (7)
  • .github/workflows/test.yml
  • Gemfile
  • percy/metadata/android_metadata.rb
  • percy/metadata/driver_metadata.rb
  • percy/metadata/metadata.rb
  • specs/android_metadata.rb
  • specs/driver_metadata.rb

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout. (6)
  • GitHub Check: Test (ubuntu-latest, 3.3, ~> 16.0)
  • GitHub Check: Test (ubuntu-latest, 2.7)
  • GitHub Check: Test (ubuntu-latest, 2.6)
  • GitHub Check: Test (ubuntu-latest, 3.0)
  • GitHub Check: Analyze (ruby)
  • GitHub Check: Analyze (actions)
🧰 Additional context used
🪛 zizmor (1.30.1)
.github/workflows/test.yml

[warning] 1-74: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block

(excessive-permissions)


[warning] 14-74: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block

(excessive-permissions)


📝 Walkthrough

Walkthrough

The pull request updates Appium and Minitest dependency selection. It also changes Android viewport capability handling and driver server URL retrieval, with tests for the metadata behavior.

Changes

Appium dependency compatibility

Layer / File(s) Summary
Dependency selection and test matrix
.github/workflows/test.yml, Gemfile
The test matrix adds Ruby 3.3 with appium_lib ~> 16.0. The Gemfile selects the version through APPIUM_LIB_VERSION, includes appium_console when the version string contains 12., and constrains Minitest to ~> 5.0.

Driver and Android metadata

Layer / File(s) Summary
Android viewport lookup
percy/metadata/android_metadata.rb, specs/android_metadata.rb
viewport reads viewportRect through get_capability_value and returns the value only when it is a Hash. Tests check the viewport value, system-bars fallback, and derived bar heights.
Driver server URL retrieval
percy/metadata/driver_metadata.rb, percy/metadata/metadata.rb, specs/driver_metadata.rb
Percy::DriverMetadata.server_url checks the HTTP client URL and client configuration. command_executor_url and Metadata#remote_url use this method. Tests cover the client configuration fallback and empty URL result.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 86e37

No identified issue blocks merging after normal checks.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title includes the Jira ID PPLT-6148 and a plain-English description of the hub URL and viewportRect fixes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@Shivanshu-07
Shivanshu-07 merged commit 8a66d11 into main Oct 8, 2026
8 checks passed
@Shivanshu-07 Shivanshu-07 mentioned this pull request Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants