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

Search cannot find paths with filenames #22463

Closed
DanielYang-AT opened this issue Jun 22, 2022 · 5 comments · Fixed by #23325
Closed

Search cannot find paths with filenames #22463

DanielYang-AT opened this issue Jun 22, 2022 · 5 comments · Fixed by #23325
Assignees

Comments

@DanielYang-AT
Copy link

Current behavior

When searching in the Cypres UI for a file, if the full path is used, Cypress cannot find the file. When just the folder is searched, Cypress can find the files. Also, if just the filename is used as a search parameter, then Cypress can find the test file.

For example

cypress/e2e/spec.cy.js -> will not be found

cypress/e2e/ -> will not find any results

cypress/e2e -> will find the files in the e2e folder

spec.cy.js -> will find all tests with the same name

Desired behavior

Cypress should allow searching with the full path of a file and be able to find any test file if the filename+full relative path is passed as a search parameter.

Test code to reproduce

https://github.com/DanielYang-AT/cypress-test-tiny
(this is a fork of the cypress-test-tiny with 0 changes)

  • Run Cypress Open
  • Select e2e testing
  • Open with chrome or electron
  • search for a spec by pasting in cypress/e2e/spec.cy.js
  • no results are found when the example spec should be shown.

Cypress Version

10.2.0

Other

Cypress 9.x.x and below were all able to find the files as expected. This was a change after the upgrade to 10.x.x

@cypress-bot cypress-bot bot added the stage: investigating Someone from Cypress is looking into this label Jun 22, 2022
@dmolin
Copy link

dmolin commented Jun 23, 2022

+1 Cypress UI search is completely broken.
It ALWAYS defaults to partial matching, so there's no way I can find tests via a perfect match and that makes it quite useless.

As an example:
In my specs tree I've a folder "simulations" and a folder "lti", each containing various .cy files.

If I type "lti" in the UI search box, this will match both the "simulation" folder (it matches both the "l" and "ti" separately) and the "lti" folder (via a complete match). That's not what 99% of the human beings using a search box expect, at all....

@tbiethman
Copy link
Contributor

Thank you for the report and the reproduction @DanielYang-AT. I can confirm your findings. We have a separate issue logged for some known issues with search (#21879), but I will leave this issue open as it calls attention to some specific incorrect behaviors.

@marktnoonan
Copy link
Contributor

Note for picking this up:

To fix this, we need to account for more than just baseName and directory here and start to match on the full relative path to the file.

This might have a couple of side effects to watch out for related to how we highlight matching segments of the results, so there could be some further adjustments needed.

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Aug 16, 2022

The code for this is done in cypress-io/cypress#23325, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@tbiethman
Copy link
Contributor

Released in 10.6.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v10.6.0, please open a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants