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

fix(PPDSC-2108): handle different browser zoom level in scroll tests #173

Merged
merged 2 commits into from
Apr 21, 2022

Conversation

mstuartf
Copy link
Contributor

PPDSC-2108

What

  1. Background: The scroll component Cypress tests fail if the browser’s zoom !== 100%. This is because when the browser is zoomed in or out scrollTop and scrollLeft are floating points not integers, but the test assertions assume they will always be integers. There is some logic already in the component to handle the behaviour of scrollTop and scrollLeft at different zoom levels. Mirroring this logic in the tests will ensure they pass at all zoom levels.
  2. Update scroll component tests to handle different browser zoom (using SCROLL_THRESHOLD logic from component).

I have done:

  • Written unit tests against changes
  • Written functional tests against the component and/or NewsKit site
  • Updated relevant documentation

I have tested manually:

  • The feature's functionality is working as expected on Chrome, Firefox, Safari and Edge
  • The screen reader reads and flows through the elements as expected.
  • There are no new errors in the browser console coming from this PR.
  • When visual test is not added, it renders correctly on different browsers and mobile viewports (Safari, Firefox, small mobile viewport, tablet)
  • The Playground feature is working as expected

How to test:

  • Run yarn e2e:comps with browser zoom !== 100%

Scroll component tests updated to handle scrollTop and scrollLeft being returned as floats (not int) when browser zoom !== 100%.
@github-actions github-actions bot added the fix This change fixes a bug label Apr 20, 2022
@mstuartf mstuartf added the ready for review Please assist in getting this reviewed label Apr 20, 2022
Copy link
Contributor

@mutebg mutebg left a comment

Choose a reason for hiding this comment

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

Good one 👏

Copy link
Contributor

@Srinivasan-Ramasamy Srinivasan-Ramasamy left a comment

Choose a reason for hiding this comment

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

Nice 👍

@mstuartf mstuartf merged commit e6b152e into main Apr 21, 2022
@mstuartf mstuartf deleted the fix/PPDSC-2108-handle-browser-zoom-in-scroll-tests branch April 21, 2022 07:45
Xin00163 pushed a commit that referenced this pull request Oct 17, 2022
…ser-zoom-in-scroll-tests

fix(PPDSC-2108): handle different browser zoom level in scroll tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix This change fixes a bug ready for review Please assist in getting this reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants