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

Feature/testing #192

Merged
merged 18 commits into from
Nov 11, 2024
Merged

Feature/testing #192

merged 18 commits into from
Nov 11, 2024

Conversation

AndreaCuneo
Copy link
Contributor

@AndreaCuneo AndreaCuneo commented Oct 4, 2024

This PR adds proof-of-concept for E2E Testing of UI based on cypress.

UnitTesting of single Components is in progress and I'm undecided to use cypress or not for it (see this ).

The added 'Feature' (here called Spec) is only a stub for now to test the framework integration.

Library support for:

  • Mocking remote requests via MSW: support is both during developement, to use Mock API and/or during E2E
    • Adding a *.mocks.ts file, enable Mocks during Developement AND Testing. These are 'global', always enabled.
    • Mocks can be further added/overriden during Testing on each Test cases
    • Reset RTKQ cache between Test cases
    • Test correct RTKQ cache cleanup between tests
    • Avoid MSW worker and library to be included in build (neither in /public nor bundles)
  • Navigation via Menu OR Router: navigation cannot be done using the Url bar (cy.visit) as that reloads the entire page, instead of navigating as an SPA.
    • Custom Cypress commands for Navigating via the Menu or the internal Router
    • support Navigating via 'closed' Accordion menu entries (or remove the Accordion ?)
    • Test for tracking the 'active' menù entry and ensuring Accordion is opened correctly in case of Hardlink usage to a page from a default closed section
  • CI pipeline:
    • GihHub Actions
    • Azure Dev Ops

Next steps:

  • Support for CodeCoverage
    • Library integration
    • GitHub CI
    • ADO CI
  • Support for Testing the Build output
    • use build output via vite preview when using headless e2e:ci to ensure to test the same code that goes in PROD.
      • there is a slight conflict as in PROD we don't want to include MSW dependency (both for security and bundle size) but we need MSW to test the production build.
  • Test all 'library' capabilities
    • GDPR Cookie Banner
    • Table Components including Pagination, Spinners and Error handling
    • Form Components including 'binding' remote call payload, validation messages, submit error handling
    • i18n translations testing, both support for cimode and for LocaleSwitcher component
    • Global Loading Bar
    • Global and Router Error Boundary
    • Auth: Login flow including Auth0 and AzureAD, token expiration and refresh
    • Authz: Permission handling, including protected routes and 'disabled' actions/buttons via hooks
    • Hardlinking, including after Login

AndreaLandiArk
AndreaLandiArk previously approved these changes Oct 7, 2024
@AndreaCuneo
Copy link
Contributor Author

RFC @AndreaLandiArk @MarcoGix @sean-sligo @Mirko92 @thomasdonlon5

To see it in action:

  1. npm run e2e:start to see how cypress work, used during development
  2. npm run e2e:ci to run headless

Comments welcome on what you think is useful to improve UI reliability reducing regressions and improving quality.

@AndreaCuneo AndreaCuneo linked an issue Nov 11, 2024 that may be closed by this pull request
23 tasks
@AndreaCuneo AndreaCuneo marked this pull request as ready for review November 11, 2024 11:49
@AndreaCuneo AndreaCuneo requested review from sean-sligo and a team as code owners November 11, 2024 11:49
@AndreaCuneo AndreaCuneo merged commit 29f11eb into master Nov 11, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support UI Testing
2 participants