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(issue-6229): added support for searching files using keyboard inputs based on OS #15388

Merged
merged 22 commits into from
Mar 22, 2021
Merged

feat(issue-6229): added support for searching files using keyboard inputs based on OS #15388

merged 22 commits into from
Mar 22, 2021

Conversation

Manuel-Suarez-Abascal
Copy link
Contributor

…uts based OS

User facing changelog

There's a new keyboard shortcut (ctrl/cmd + f) to search spec files in the Test Runner based on the user's OS.

Additional details

This PR allows users to perform a search for test files with the ctrl/cmd + f command based on the Operating System. The file where the implementation was added is cypress\packages\desktop-gui\src\specs\specs-list.jsx. I used a method that uses the ternary operator & adds focus to the search input if ctrl/cmd + f is pressed. Then I called the method on keydown on the window object.

How has the user experience changed?

filter-test-runner.mov

PR Tasks

  • Has a PR for user-facing changes been opened in issue-6269?

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Mar 10, 2021

Thanks for taking the time to open a PR!

}

_isMac () {
return (window.clientInformation['platform'] === 'MacIntel')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jennifer-shehane in case you're wondering about this. It's a workaround of a known issue.

@Manuel-Suarez-Abascal Manuel-Suarez-Abascal changed the title feat/issue-6229: added support for searching files using keyboard inp… issue-6229: added support for searching files using keyboard inp… Mar 12, 2021
@jennifer-shehane jennifer-shehane changed the title issue-6229: added support for searching files using keyboard inp… feat(issue-6229): added support for searching files using keyboard inp… Mar 15, 2021
@jennifer-shehane jennifer-shehane changed the title feat(issue-6229): added support for searching files using keyboard inp… feat(issue-6229): added support for searching files using keyboard inputs based on OS Mar 15, 2021
Copy link
Member

@jennifer-shehane jennifer-shehane left a comment

Choose a reason for hiding this comment

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

Thanks for opening a PR! It appears to be working in Mac. 👍 Will have to get someone to test in Windows.

Just some suggestions, mostly on naming and consolidating functions/variables.

packages/desktop-gui/src/specs/specs-list.jsx Outdated Show resolved Hide resolved
Comment on lines 120 to 122
onBlur={this._setBlur}
onChange={this._updateFilter}
onFocus={this._setFocus}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
onBlur={this._setBlur}
onChange={this._updateFilter}
onFocus={this._setFocus}
onBlur={this._toggleFocus}
onChange={this._updateFilter}
onFocus={this._toggleFocus}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same comment as above.

packages/desktop-gui/src/specs/specs-list.jsx Outdated Show resolved Hide resolved
onKeyUp={this._executeFilterAction}
/>

{ window.addEventListener('keydown', this._executeSearch) }
Copy link
Member

Choose a reason for hiding this comment

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

The function is focusing the input when search keys are detected. Think this naming is a bit clearer of the function.

Suggested change
{ window.addEventListener('keydown', this._executeSearch) }
{ window.addEventListener('keydown', this._focusWhenSearchKeys) }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jennifer-shehane I have addressed the comment & pushed the changes.

packages/desktop-gui/src/specs/specs-list.jsx Outdated Show resolved Hide resolved
@Manuel-Suarez-Abascal
Copy link
Contributor Author

Manuel-Suarez-Abascal commented Mar 22, 2021

Thanks for opening a PR! It appears to be working in Mac. 👍 Will have to get someone to test in Windows.

Just some suggestions, mostly on naming and consolidating functions/variables.

Great comments @jennifer-shehane I have addressed all of them & pushed the latest changes. I have retested the new feature & it seems everything to be working just fine. I'll be waiting for your next review & your confirmation on the functionality of Windows OS 🚀

@flotwig
Copy link
Contributor

flotwig commented Mar 22, 2021

Appears to work perfectly on Windows 👍

image

Copy link
Member

@jennifer-shehane jennifer-shehane left a comment

Choose a reason for hiding this comment

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

Thanks again!

@jennifer-shehane jennifer-shehane merged commit cbb9664 into cypress-io:develop Mar 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ctrl+F to set focus on the search bar
3 participants