Skip to content

test(badge): refine badge tests - (FE-6443)#7759

Open
divyajindel wants to merge 1 commit intomasterfrom
FE-6443-tidy-badge-tests
Open

test(badge): refine badge tests - (FE-6443)#7759
divyajindel wants to merge 1 commit intomasterfrom
FE-6443-tidy-badge-tests

Conversation

@divyajindel
Copy link
Contributor

Proposed behaviour

Our unit testing and regression testing frameworks need to be optimised. Use GitHub Copilot in VS Code to analyse the *.test.tsx, *.pw.tsx, and *.stories.tsx files to rapidly identify duplicate tests across the platforms, remove unnecessary code, flaky tests and speed up the carbon repo build time.

Current behaviour

The Playwright test suite takes ~20 minutes to run. Some tests are flaky, requiring repeated reruns which adds additional time to the build. Historically, requirements around test coverage have resulted in tests being duplicated in the regression test suite that are already in unit test, resulting in a longer build time than is necessary. Accessibility tests exist for most components that would not detect an accessibility violation.

Checklist

  • Commits follow our style guide
  • Related issues linked in commit messages if required
  • Screenshots are included in the PR if useful
  • All themes are supported if required
  • Unit tests added or updated if required
  • Playwright automation tests added or updated if required
  • Storybook added or updated if required
  • Translations added or updated (including creating or amending translation keys table in storybook) if required
  • Typescript d.ts file added or updated if required
  • Related docs have been updated if required

QA

  • Tested in provided StackBlitz sandbox/Storybook
  • Add new Playwright test coverage if required
  • Carbon implementation matches Design System/designs
  • UI Tests GitHub check reviewed if required

Additional context

Testing instructions

Aim to move individual keystroke and prop test cases into Jest where possible if not covered already, move styling tests, presentation type (icon positions, button types etc) tests, and user interactions into Chromatic snapshot tests, leave convoluted test scenarios and a11y tests in Playwright. Assess coverage and remove unnecessary tests that add no value, particularly among the accessibility test cases. More details are contained in the associated tickets in Jira, including suggested successful prompts and guidelines. After implementing the changes:

  1. Check Jest coverage is still at 100% after changes have been made (run npm run test).
  2. Check the Playwright suite runs without error.
  3. Ensure Chromatic differences are expected. The changes have not caused any unexpected changes in other components.

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

Development

Successfully merging this pull request may close these issues.

1 participant