fix(automate): detect App Automate from appium:app capability for session name/status (SDK-7093) - #100
fix(automate): detect App Automate from appium:app capability for session name/status (SDK-7093)#100pri-gadhiya wants to merge 6 commits into
Conversation
…sion name/status (SDK-7093) When the app is supplied only via the appium:app capability (not the top-level browserstack service `app` option), this.config.app is undefined, so isAppAutomate resolved false and the session name/status PUT was routed to the web Automate endpoint for an App Automate session — returning a swallowed 404, leaving the static sessionName capability on the dashboard. Route both markSessionName and markSessionStatus through a new isAppAutomate() helper that also inspects the input + resolved capabilities for appium:app / appium:options.app, mirroring accessibilityModule.isAppAutomateSession. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
🔴 SDK PR Review gate is red. Pending:
It turns green once the latest SDK PR Review Agent run reports GTG on the current head commit. A native reviewer approval is separately required by branch protection before merge. |
|
🔴 Blocking findings — fix required See the SDK PR Review Agent's report from your local run. ↻ This verdict comment is the review anchor — it's updated in place on each run (the gate posts its status separately). — SDK PR Review Agent |
|
🔴 SDK PR Review gate is red. Pending:
It turns green once the latest SDK PR Review Agent run reports GTG on the current head commit. A native reviewer approval is separately required by branch protection before merge. |
…K-7093) Address SDK PR review findings on #100: - Promote hasAppCap + APP_AUTOMATE_CAP_KEYS from config.ts (file-local) to util.ts as a shared export; config.ts reuses it (no behavior change). - automateModule.isAppAutomate() reuses hasAppCap — now covers all app-cap keys (appium:app / appium:bundleId / appium:appPackage / appium:appActivity / appium:options.app) instead of only appium:app. - percyModule: fix the same service-config-only detection (`'app' in this.config`) that misrouted Percy screenshots to the web Automate path for appium:app sessions — now resolves App Automate via hasAppCap over browser + input caps. - changeset: note now covers session name, status, and Percy routing. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
🔴 SDK PR Review gate is red. Pending:
It turns green once the latest SDK PR Review Agent run reports GTG on the current head commit. A native reviewer approval is separately required by branch protection before merge. |
|
🔴 SDK PR Review gate is red. Pending:
It turns green once the latest SDK PR Review Agent run reports GTG on the current head commit. A native reviewer approval is separately required by branch protection before merge. |
…sors (SDK-7093) The reuse refactor made automateModule + percyModule depend on the shared util.hasAppCap and (for the capability fallback) AutomationFramework getTrackedInstance/getState. Update the unit-test mocks accordingly: - automateModule.test: add hasAppCap to the wholesale util.js mock (was undefined → threw → swallowed → fetch never called). - percyModules.test: add getTrackedInstance/getState to the AutomationFramework mock so onAfterCreate's isAppAutomateSession() no longer throws. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
🔴 SDK PR Review gate is red. Pending:
It turns green once the latest SDK PR Review Agent run reports GTG on the current head commit. A native reviewer approval is separately required by branch protection before merge. |
| const autoInstance = AutomationFramework.getTrackedInstance() | ||
| return [AutomationFrameworkConstants.KEY_INPUT_CAPABILITIES, AutomationFrameworkConstants.KEY_CAPABILITIES] | ||
| .some(key => hasAppCap(AutomationFramework.getState(autoInstance, key) as WebdriverIO.Capabilities | undefined)) |
There was a problem hiding this comment.
| const autoInstance = AutomationFramework.getTrackedInstance() | |
| return [AutomationFrameworkConstants.KEY_INPUT_CAPABILITIES, AutomationFrameworkConstants.KEY_CAPABILITIES] | |
| .some(key => hasAppCap(AutomationFramework.getState(autoInstance, key) as WebdriverIO.Capabilities | undefined)) | |
| return hasAppCapInFrameworkState() |
| const appiumOptions = record['appium:options'] as Record<string, unknown> | undefined | ||
| return !!(appiumOptions && !isUndefined(appiumOptions.app)) | ||
| } | ||
|
|
There was a problem hiding this comment.
We can export another function here:
| import AutomationFramework from './cli/frameworks/automationFramework.js' | |
| import { AutomationFrameworkConstants } from './cli/frameworks/constants/automationFrameworkConstants.js' | |
| export function hasAppCapInFrameworkState(): boolean { | |
| const autoInstance = AutomationFramework.getTrackedInstance() | |
| const keys = [ | |
| AutomationFrameworkConstants.KEY_INPUT_CAPABILITIES, | |
| AutomationFrameworkConstants.KEY_CAPABILITIES | |
| ] | |
| return keys.some(key => | |
| hasAppCap(AutomationFramework.getState(autoInstance, key) as WebdriverIO.Capabilities | undefined) | |
| ) | |
| } |
| const autoInstance = AutomationFramework.getTrackedInstance() | ||
| return [AutomationFrameworkConstants.KEY_INPUT_CAPABILITIES, AutomationFrameworkConstants.KEY_CAPABILITIES] | ||
| .some(key => hasAppCap(AutomationFramework.getState(autoInstance, key) as WebdriverIO.Capabilities | undefined)) |
There was a problem hiding this comment.
| const autoInstance = AutomationFramework.getTrackedInstance() | |
| return [AutomationFrameworkConstants.KEY_INPUT_CAPABILITIES, AutomationFrameworkConstants.KEY_CAPABILITIES] | |
| .some(key => hasAppCap(AutomationFramework.getState(autoInstance, key) as WebdriverIO.Capabilities | undefined)) | |
| return hasAppCapInFrameworkState() |
What is this about?
Fixes App Automate session names showing the static
sessionNamecapability instead of the per-test title.automateModule'smarkSessionName/markSessionStatusderived App-Automate-ness fromthis.config.app(the top-levelbrowserstackserviceappoption) alone. When the app is supplied only via theappium:appcapability,this.config.appisundefined, soisAppAutomateresolvedfalseand the session name/status PUT was routed to the web Automate endpoint (automate/sessions/{id}.json) for an App-Automate session — returning a404that is silently swallowed, leaving the static capability name on the dashboard.Both call sites now go through a new
isAppAutomate()helper that also inspects the input + resolved capabilities forappium:app/appium:options.app(checks bothKEY_INPUT_CAPABILITIESandKEY_CAPABILITIES, since the resolved caps BrowserStack echoes back dropappium:app), mirroringaccessibilityModule.isAppAutomateSession. Strictly additive — the existing top-levelapp/skipAppOverridepath is unchanged.Verified on App-Automate iOS (own account): broken build kept the static name + logged the 404; after the fix, sessions get their per-test titles and the PUT hits the App-Automate endpoint with a 200.
Related Jira task/s
https://browserstack.atlassian.net/browse/SDK-7093
Release (mandatory for every PR — required for the
ready-for-reviewlabel)Version bump: (required — tick exactly one)
Release notes type: (optional)
Release notes (customer-facing): (optional but encouraged)
appium:appcapability.Release notes (internal): (required — engineer-facing; what actually changed / why)
automateModule.isAppAutomate()now detects App Automate from theappium:app/appium:options.appcapability (input + resolved) in addition to the top-level serviceapp/skipAppOverride, so session name/status PUTs are routed to the App-Automate endpoint instead of silently 404-ing against the web Automate endpoint.Checklist
PR Validations
Run Tests: Comment RUN_TESTS to trigger sanity tests.