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

Refactoring: Migration of visual regression tests and testfile restructering #2731

Closed
71 tasks done
jeripeierSBB opened this issue Jun 10, 2024 · 1 comment · Fixed by #2788 or #2751
Closed
71 tasks done

Refactoring: Migration of visual regression tests and testfile restructering #2731

jeripeierSBB opened this issue Jun 10, 2024 · 1 comment · Fixed by #2788 or #2751
Assignees

Comments

@jeripeierSBB
Copy link
Contributor

jeripeierSBB commented Jun 10, 2024

For every component we would like to:

  • Check if tests are in the appropriate file (should be done already)
  • Snapshot tests
    • Should avoid using inline snapshots where possible
    • Should wrap the test with describe('Test name') and contain it('DOM', ...) and it('Shadow DOM') like
  describe('renders', () => {
    beforeEach(async () => {
      element = await fixture(html`<sbb-card></sbb-card>`);
    });

    it('DOM', async () => {
      await expect(element).dom.to.be.equalSnapshot();
    });

    it('Shadow DOM', async () => {
      await expect(element).shadowDom.to.be.equalSnapshot();
    });

    testA11yTreeSnapshot();
  });
  • Adapt all Chromatic tests to the new visual tests using the utility functions. Keep the Chromatic tests during migration (We could clean up Chromatic specific stories when the new tests successfully elaborated and everything is migrated.)
    • Try to avoid unnecessary screenshots
      • As a base rule, every viewport should be included. However we have a lot of components where e.g. only viewport sizes make sense to tests (e.g. button)
      • Only test states that makes sense (e.g. no active state if there is non implemented...)

Helpful Commands

  • Run all tests: FORCE_LOCAL=true yarn test:visual-regression --watch (start tests on local machine (not Container))
  • Run specific file: yarn test:visual-regression --file=$FileDirRelativeToProjectRoot$/$FileName$
  • start:visual-regression-app (has to be restarted after every run)

Component list


@jeripeierSBB jeripeierSBB changed the title Refactoring: Migration of visual regression tests Refactoring: Migration of visual regression tests and testfile restructering Jun 10, 2024
@jeripeierSBB jeripeierSBB self-assigned this Jun 10, 2024
@TomMenga TomMenga reopened this Jun 18, 2024
@TomMenga TomMenga linked a pull request Jun 18, 2024 that will close this issue
@TomMenga
Copy link
Contributor

TomMenga commented Jul 10, 2024

Components with missing visual spec (checked if intentional):

  • timetable-occupancy (soon to be merged)
  • tab
  • step
  • navigation-marker
  • navigation-list
  • expansion-panel-header
  • expansion-panel-content
  • dialog-title
  • dialog-content
  • dialog-actions
  • card-badge
  • transparent-button-static
  • transparent-button-link
  • tertiary-button-static
  • tertiary-button-link
  • secondary-button-static
  • secondary-button-link

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