Repository navigation
feat(inspector): XPath quote preference and XPath variations (AL-15521) - #22
Draft
aniket-kes wants to merge 1 commit into
Draft
aniket-kes wants to merge 1 commit into
aniket-kes wants to merge 1 commit into
Conversation
Barclays (deal blocker AL-15521) is moving from SeeTest to App Live and asked for two locator-panel features: - A "double" / 'single' toggle under the locators table. With 'single', every XPath attribute value in the locators table and the variations list uses single quotes, so the XPath drops into a Java string without escaping. The choice is saved per browser (PREFERRED_XPATH_QUOTE, same mechanism as the recorder's client framework); default stays double. A value containing an apostrophe keeps double quotes; one containing both uses concat(). - A collapsible "XPath variations" list: ID only, Type + ID, Type + <attr>, ID + <attr>, Indexed, inside the nearest uniquely-identified parent, and full path from root. Only variations that select exactly the chosen element are listed; they are copy-only and never sent to the device, so element lookup and Get Timing are unchanged. The iOS full path drops the <AppiumAUT> wrapper from the page source: the device evaluates XPath from XCUIElementTypeApplication down, and /AppiumAUT/... matched nothing on a real iPhone. The whole app is never offered as the "unique parent". Verified on real devices through App Automate (Galaxy S23 / Android 13, iPhone 15 / iOS 17) and inside App Live (Pixel 8 / Android 14, iPhone 15 / iOS 17.3): every variation for every element on screen matched exactly one element. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Two additions to the Selected Element panel, for AL-15521 (Barclays deal blocker, moving from SeeTest to App Live):
"double"/'single'under the locators table. With'single', the xpath row and every variation use single quotes (//android.widget.Button[@resource-id='…']). Saved per browser (PREFERRED_XPATH_QUOTE); default stays double, so nothing changes for anyone who doesn't flip it.<attr>, ID +<attr>, Indexed, inside the nearest uniquely-identified parent, full path from root. Android (resource-id,text,content-desc) and iOS (name,label,value).Why
Barclays writes Cucumber Java; double-quoted XPaths need escaping inside a Java string. SeeTest also lets them choose between several XPaths for one element (full path vs. a short ID-based one), which the inspector doesn't offer — it shows a single "optimal" XPath.
Behaviour worth knowing
'stays in double quotes (XPath 1.0 can't escape it); a value with both quote types usesconcat().<AppiumAUT>. The page source wraps the tree in it, but the device evaluates XPath fromXCUIElementTypeApplicationdown:/AppiumAUT/…matched 0 elements on a real iPhone; without the prefix it matched 1.How it was verified
Also checked in App Live: light theme, auto-attach, the toggle persisting across inspector restarts, sessions and platforms, and close → restart picking up a new bundle without ending the session.
Gates:
npm run test:unit191/191 (14 new intest/unit/xpath-variations.spec.js, incl. an exhaustive "every variation selects exactly this node" check on Android + iOS fixtures in both quote styles); eslint clean on the changed files (the reducer's existing import-order error is onv7and left alone). Nightwatch@appium_inspectornot run yet.Implementation note
Shaped as two new files (
utils/xpath-variations.js,SelectedElement/XPathVariations.jsx+.module.css) plus small edits inSelectedElement.jsx, the SessionInspector action/reducer andsetting-defs.js, so the next upstream sync re-applies it cheaply (ADR-001). No postMessage, URL-param orwindow.AppLiveSessionIdcontract changes. Automation ids:#xpathQuoteToggle,#xpathVariations.🤖 Generated with Claude Code