-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
fix(driver): Sticky elements within a fixed container will not prevent an element from being scrolled to #18441
Conversation
Thanks for taking the time to open a PR!
|
Test summaryRun details
View run in Cypress Dashboard ➡️ Failures
Flakiness
This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
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 don't think that we should use the rotate scrollBehavior if the user has specified a scrollBehavior
to overwrite the default. They may be testing that an element is clickable with a specific scroll behavior - that you can scroll to bottom and always click for example. What would be the use of passing scrollBehavior
if it is always overridden?
I do however think that most people use the scrollBehavior
option as a fix for our issues of not finding the thing to click on, but this would be a breaking change imo.
This does fix the initial issue.
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.
We should also add a test covering when the user specifies the scroll behavior.
I think it could basically be the same as the test you added, but pass in a scrollBehavior
to cy.click()
that makes it fail. Then test it's the right failure. If you're not sure how to do that, look at tests that use cy.on('fail', ...)
. There are a bunch of them in the driver tests.
Co-authored-by: Chris Breiding <chrisbreiding@users.noreply.github.com>
Co-authored-by: Chris Breiding <chrisbreiding@users.noreply.github.com>
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.
Looks great 👍 Nice work!
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.
Sorry, I approved this too soon. We need to take into account all of the commands that can receive scrollBehavior
as an option. That means setting the userSetScrollBehavior
in each command and adding tests for each one too.
I think these are all the other commands that accept scrollBehavior
:
- check
- clear
- dblclick
- trigger
- type
- uncheck
packages/driver/cypress/integration/commands/actions/click_spec.js
Outdated
Show resolved
Hide resolved
…cypress-io/cypress into issue-4233-click-sticky-element
* develop: (40 commits) fix(driver): Sticky elements within a fixed container will not prevent an element from being scrolled to (#18441) chore: make `create` function on server.ts obsolete (#18615) docs: Add instructions to squash commits to develop in Contributing (#18728) fix(@cypress/react): throw if using Next.js swc-loader without nodeVersion=system (#18686) refactor: remove Ramda (#18723) chore: Increase paralleled machines for desktop-gui tests (#18725) chore: Update Chrome (stable) to 95.0.4638.69 (#18696) chore: release @cypress/vue-v3.0.4 chore: release @cypress/react-v5.10.2 chore: release @cypress/schematic-v1.5.3 fix: remove outdated registry link (#18710) chore: release @cypress/schematic-v1.5.2 chore: release create-cypress-tests-v1.1.3 chore: Update Chrome (beta) to 96.0.4664.27 (#18676) chore(tests): Remove flaky assertion that relies on png how compression (#18668) fix: make sure to go back to no-specs when delete spec file (#17760) fix: Next.JS 12 components testing failing with ` TypeError: Cannot read property 'traceChild' of undefined` (#18648) Backport .gitignore from unified-desktop-gui chore(docs): add 'Upgrading Electron' instructions (#18594) release 8.7.0 [skip ci] ...
* develop: (40 commits) fix(driver): Sticky elements within a fixed container will not prevent an element from being scrolled to (#18441) chore: make `create` function on server.ts obsolete (#18615) docs: Add instructions to squash commits to develop in Contributing (#18728) fix(@cypress/react): throw if using Next.js swc-loader without nodeVersion=system (#18686) refactor: remove Ramda (#18723) chore: Increase paralleled machines for desktop-gui tests (#18725) chore: Update Chrome (stable) to 95.0.4638.69 (#18696) chore: release @cypress/vue-v3.0.4 chore: release @cypress/react-v5.10.2 chore: release @cypress/schematic-v1.5.3 fix: remove outdated registry link (#18710) chore: release @cypress/schematic-v1.5.2 chore: release create-cypress-tests-v1.1.3 chore: Update Chrome (beta) to 96.0.4664.27 (#18676) chore(tests): Remove flaky assertion that relies on png how compression (#18668) fix: make sure to go back to no-specs when delete spec file (#17760) fix: Next.JS 12 components testing failing with ` TypeError: Cannot read property 'traceChild' of undefined` (#18648) Backport .gitignore from unified-desktop-gui chore(docs): add 'Upgrading Electron' instructions (#18594) release 8.7.0 [skip ci] ...
…ve-activeProject * unified-desktop-gui: (57 commits) chore: Add e2e tests for global mode (#18719) chore: add percy to app and launchpad package (#18781) chore: update test refactor: move settings in app (#18729) feat: setup launchpad lifecycle (#18734) feat(app): decouple event manager from driver (#18695) chore: Force single resolution for core modules, infinite loop guard (#18764) fix(driver): Sticky elements within a fixed container will not prevent an element from being scrolled to (#18441) chore: cleaning up the runner container pattern (#18741) feat: Use .config files (#18578) chore(app): basic style and example to stop scrollIntoView bug (#18736) chore: make `create` function on server.ts obsolete (#18615) feat: add codegen utility (#18708) docs: Add instructions to squash commits to develop in Contributing (#18728) fix(@cypress/react): throw if using Next.js swc-loader without nodeVersion=system (#18686) refactor: remove Ramda (#18723) fix: support using create-cypress-tests as part of build process (#18714) chore: Increase paralleled machines for desktop-gui tests (#18725) fix(app): do not cache graphql (#18716) chore: Update Chrome (stable) to 95.0.4638.69 (#18696) ...
…t an element from being scrolled to (#18441) Co-authored-by: Chris Breiding <chrisbreiding@users.noreply.github.com>
User facing changelog
Sticky elements within a fixed container will now be able to be scrolled to.
Additional details
Flowchart detailing the new actionability behavior: https://whimsical.com/actionability-J38eY9K2Y3vA6uCMWtmLVA
Previously, sticky elements could cover up elements that user would try to scroll to, causing failed tests such as the one below:
![image](https://user-images.githubusercontent.com/27690333/136830921-dc85a1ee-4165-436f-bfb2-ceb9cb9e2c6c.png)
This error would happen because
cy.ensureVisibility()
would fail before our nudging algorithm would run. This PR extracts some of the visibility checks related to being covered up by ancestors into a new ensure function and runs these checks after the nudging algorithm scrolls the element into view.PR Tasks
cypress-documentation
? --> Sticky elements within a fixed container will not prevent an element from being scrolled to cypress-documentation#4153 (wip)type definitions
? --> N/Acypress.schema.json
? --> N/A