-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Highlight elements that user searched for #344
Conversation
* Can select an element that was searched for and then sets the bounds in Redux * Can also choose not to retrieve screenshot/source when calling a method
* HighlighterRects then passes the location and size of the element that was selected in 'Search for Element' modal
* Don't show other highlighters when Search Modal is open * When an element is selected, clear the currently selected element before fetching the bounds for the new element
@@ -70,7 +70,10 @@ export default class AppiumMethodHandler { | |||
// Give the source/screenshot time to change before taking the screenshot | |||
await Bluebird.delay(500); | |||
|
|||
let sourceAndScreenshot = await this._getSourceAndScreenshot(); | |||
let sourceAndScreenshot; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume an empty array should be assigned to this variable by default since we apply ellipsis operator to it later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you pass undefined
or null
into an object via ellipsis (spread) operator, it has no effect.
@@ -101,7 +104,11 @@ export default class AppiumMethodHandler { | |||
// Give the source/screenshot time to change before taking the screenshot | |||
await Bluebird.delay(500); | |||
|
|||
let sourceAndScreenshot = await this._getSourceAndScreenshot(); | |||
let sourceAndScreenshot; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we avoid code duplication here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I'll make it so there's one main method.
app/main/appium.js
Outdated
@@ -301,6 +301,7 @@ function connectClientMethodListener () { | |||
fetchArray = false, // Optional. Are we fetching an array of elements or just one? | |||
elementId, // Optional. Element being operated on | |||
args = [], // Optional. Arguments passed to method | |||
skipScreenshot = false, // Optional. Do we want the updated source and screenshot? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps, we can select better name for this variable if it also affects source update?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call
@@ -377,11 +382,19 @@ export function findAndAssign (strategy, selector, variableName, isArray) { | |||
}; | |||
} | |||
|
|||
|
|||
// TODO: Is this obsolete? I don't think we use this. | |||
export function setLocatorTestElement (elementId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this function be also defined as async?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function that is returned within it is async
.
Changes pushed |
if (elementId) { | ||
// Give the cached element a variable name (el1, el2, el3,...) the first time it's used | ||
cachedEl = this.elementCache[elementId]; | ||
if (!cachedEl.variableName && cachedEl.variableType === 'string') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can use _.isString
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variableType
is a hard-coded string that identifies what type the element is. It's used by the RecordedActions component which displays recorded code and it uses the variableType to determine if it should be el.text("String")
or el.text(123)
etc...
Any chance to fix Travis run? |
Unfortunately there's a Travis problem that breaks the Electron build. I'm leaving it there in the hopes that eventually Travis gets fixed. |
When user selects an element in the 'Search Elements' modal it highlights it on the screenshot.
When the user opens the 'Search for Element' modal, and searches for elements, when they select one, highlight that element on the screenshots panel.