Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add functionality to search through app source tree #1494

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

sudharsan-selvaraj
Copy link
Contributor

Fixes #1004

Demo

appium-app-source-search.mp4

Copy link
Collaborator

@eglitise eglitise left a comment

Choose a reason for hiding this comment

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

Thank you! Will test this a bit later.
Similarly to your other PR, would it be possible to also update the documentation? I am referring to this page: https://appium.github.io/appium-inspector/latest/session-inspector/source/

  • Update the top two images
  • Add a new section in Application Source (between Refreshing the Source and Toggle Attributes Button)

app/renderer/src/components/Inspector/Inspector.jsx Outdated Show resolved Hide resolved
app/renderer/src/components/Inspector/Source.jsx Outdated Show resolved Hide resolved
app/renderer/src/components/Inspector/Source.jsx Outdated Show resolved Hide resolved
@github-actions github-actions bot added documentation Improvements or additions to documentation i18n Translation changes labels Jun 8, 2024
@sudharsan-selvaraj
Copy link
Contributor Author

Thank you! Will test this a bit later. Similarly to your other PR, would it be possible to also update the documentation? I am referring to this page: https://appium.github.io/appium-inspector/latest/session-inspector/source/

  • Update the top two images
  • Add a new section in Application Source (between Refreshing the Source and Toggle Attributes Button)

Thanks for pointing out to the docs. I have updated all relevant images and added a new section with the gist of search functionality. Do let me know for any improvements.

@github-actions github-actions bot added the dependencies Dependency updates, removals or additions label Jun 11, 2024
package.json Outdated Show resolved Hide resolved
Copy link
Member

@jlipps jlipps left a comment

Choose a reason for hiding this comment

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

cool feature!

Copy link
Collaborator

@eglitise eglitise left a comment

Choose a reason for hiding this comment

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

It seems to work well in the browser, but not so much in the Electron version :(

app/renderer/src/components/Inspector/Source.jsx Outdated Show resolved Hide resolved
@@ -73,6 +73,10 @@
height: 100%;
}

.inspector-main .interaction-tab-container :global(.ant-input-affix-wrapper) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This does not look good at the minimum window width:
image
Although I'm not sure how to best scale this. Ideally it should shrink without affecting the card title, but the actual behavior is the opposite.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also I would suggest defining a class for the searchbar if you intend to change its CSS. This particular line is rather long and it's not obvious what it's meant to affect.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just tweaked a bit to make it better for smaller screens. Do let me know if it looks good.

Screenshot 2024-08-19 at 5 38 49 PM

Copy link
Collaborator

Choose a reason for hiding this comment

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

It is better in that there's no linebreak, but ideally the search bar and icons should not hide the 'App Source' title - instead the title should hide the search bar/buttons. Not sure how possible this is.

@mykola-mokhnach
Copy link
Contributor

@sudharsan-selvaraj Would you have some time to finish this PR?

@sudharsan-selvaraj
Copy link
Contributor Author

@sudharsan-selvaraj Would you have some time to finish this PR?

@mykola-mokhnach Yup, I will be able to close the pending items.

@eglitise
Copy link
Collaborator

The good thing is that it does work in the Electron version now :) But I have some issues with the tree node text extraction:

  • It uses renderToString which is imported from react-dom/server, and as per React docs, it 'unnecessarily increases your bundle size and should be avoided'. There do seem to be alternatives but I haven't checked them in detail.
  • The converted node titles have additional wrapper text, which is unfortunately also taken into account when searching. For example, a node <android.widget.LinearLayout> would be converted to <span>&lt;<b class="_sourcetag_zwtnd_433">android.widget.linearlayout</b>&gt;</span>. Meaning, if I search for span, the entire DOM tree will be unwrapped, and potentially not a single node will be highlighted.

@eglitise
Copy link
Collaborator

I would also suggest exploring the idea of not converting the entire DOM upon every change in the search string. Maybe the raw title of each node can be calculated as part of recursive, or at least the DOM should be converted only once upon starting search.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Dependency updates, removals or additions documentation Improvements or additions to documentation enhancement New feature or request i18n Translation changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feature request: Search option at the App Source section
4 participants