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

auro-back-to-top: figure out how to test scroll behavior in OpenWC #9

Closed
2 tasks
jason-capsule42 opened this issue Jul 20, 2023 · 2 comments · Fixed by #14
Closed
2 tasks

auro-back-to-top: figure out how to test scroll behavior in OpenWC #9

jason-capsule42 opened this issue Jul 20, 2023 · 2 comments · Fixed by #14
Assignees

Comments

@jason-capsule42
Copy link
Member

jason-capsule42 commented Jul 20, 2023

User story

We need to figure out how to test scroll behavior within our automation testing framework and apply that to testing the UX of backtoptop

Outline subtasks or tasks

List specific steps required to deliver this work.

  • learn how to test scrolling behavior in OpenWC
  • create test cases covering the scrolling behavior of auro-backtoptop

Additional context

Due to low testing, the threshold was lowered. Once this update is complete, this should be updated to 80%

blackfalcon added a commit that referenced this issue Aug 9, 2023
This commit also includes an update to reduce the testing
expectations to 70%. This should be updated once the
following issue has been resolved.

#9

Changes to be committed:
new file:   .husky/pre-commit
modified:   web-test-runner.config.mjs
jason-capsule42 pushed a commit that referenced this issue Aug 9, 2023
This commit also includes an update to reduce the testing
expectations to 70%. This should be updated once the
following issue has been resolved.

#9

Changes to be committed:
new file:   .husky/pre-commit
modified:   web-test-runner.config.mjs
@fajar-apri-alaska
Copy link
Contributor

Hi team.
If I may, I have done some research for this issue.

it('tests scroll-related events', async () => {
    window.innerHeight = 2500;
    const el = await fixture(html`
      <auro-backtotop cssclass="testClass"></auro-backtotop>
    `);

    simulateScroll(0, 500);
    expect(el.hidden).to.be.false;

    simulateScroll(0, 0);
    expect(el.hidden).to.be.true;
  });

function simulateScroll(x, y) {
    const scrollEvent = new CustomEvent('scroll', { detail: { x, y } });
    window.scrollX = x;
    window.scrollY = y;
    document.dispatchEvent(scrollEvent);
  }

I have also added the rest for 100% achievement.
image

@blackfalcon
Copy link
Member

Thanks @fajar-apri-alaska. If you want to submit a PR on this, I will assign the issue to you.

@fajar-apri-alaska fajar-apri-alaska mentioned this issue Sep 1, 2023
3 tasks
@fajar-apri-alaska fajar-apri-alaska linked a pull request Oct 25, 2023 that will close this issue
3 tasks
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.

4 participants