Skip to content

Conversation

@piotr-iohk
Copy link

πŸ§ͺ Introduce Initial Testing (Unit + Playwright)

βœ… What this PR introduces

This PR lays the groundwork for adding automated testing to the project. It includes:

  • Initial unit tests where coverage was previously missing
  • A basic Playwright E2E testing framework using a Page Object Model (POM) structure

πŸ§ͺ Unit Tests

  • Added initial unit tests for parts of the Redux stores (public-store, admin-store)
  • These serve as a starting point for a more comprehensive test suite
  • Tests can be run with:
yarn test

⚠️ Note: react-scripts expects an older version of babel-jest. You may need to reconcile conflicting versions or use SKIP_PREFLIGHT_CHECK=true in your .env during setup.

🎭 Playwright E2E Tests

  • Introduced Playwright for end-to-end testing
  • Set up a basic Page Object pattern for test scalability
  • Currently, tests run against the live widget instance at: https://widget.synonym.to/?embed=true
cd ui-tests
npx playwright test

⏳ For now, we're testing the live widget due to time constraints β€” the long-term plan is to run tests against a locally built version of the app.


πŸ”­ Observations & Recommendations

βš™οΈ Node.js version

  • The project currently targets Node v14, which is outdated.
  • Modern testing tools (e.g. Playwright, ts-jest, etc.) increasingly require Node >=16.
  • Recommendation: Upgrade Node to a more recent LTS version for better compatibility and tooling support.

🌐 Hardcoded URLs

  • Some API endpoints and resource URLs (e.g. FX rates) are hardcoded in the source code.
  • Recommendation: Move URLs and similar configuration into environment variables or a shared config file.
    This improves testability, flexibility, and prevents accidental production calls.

πŸš€ Future Work

Expand Unit Test Coverage:

  • Redux reducers
  • Selectors
  • Async thunks
  • Utility functions

Add More E2E Flows:

  • Complete channel creation flow
  • Confirmation, payment, claim
  • Edge cases, error handling

Other Goals:

  • Add support for multiple browsers
  • Integrate tests with GitHub Actions to run on pull requests and main branch pushes

πŸ“Œ Summary

This PR is a first step in setting up a structured testing framework for the project.
It provides both unit and E2E infrastructure to build upon.

Feedback Welcome On:

  • Testing architecture and folder structure
  • Priority areas for coverage
  • How/when tests should run in CI/CD

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.

1 participant