Agenta-AI / agenta

The all-in-one LLM developer platform: prompt management, evaluation, human feedback, and deployment all in one place.
http://www.agenta.ai
MIT License
1.17k stars 178 forks source link

Front end testing #259

Closed Pajko97 closed 1 year ago

Pajko97 commented 1 year ago

Is your feature request related to a problem? Please describe. As the complexity increases, and we introduce more components and features, our code integrity will decrease if we don't introduce unit and integration tests.

Describe the solution you'd like I propose introducing Enzyme and Jest, React testing libraries, that will be used for testing front end code. They are relatively popular so it would be easy to adopt for new contributors. For E2E ( end to end ) tests i think we should go with Cypress for consistency

Implementation of both integration and e2e tests should be divided into smaller tasks so we can a) Work on it simultaneously without affecting each other b) So tasks can be manageable and tests added incrementally

ex. for integration tests "Integration and unit tests for React components - Part 1" would be the first task ex. for E2E tests "E2E tests - Part 1"

Describe alternatives you've considered Alternative solution for E2E could be Selenium but I don't think it makes sense in our case. We could also use Cypress for integration tests, but in our case I think it's better to go with Jest and Enzyme since they come with everything out of the box, and Cypress needs some additional plugins to achieve what we want. This combo works best in my experience.

Additional context TLDR:

  1. Use Cypress for E2E and Jest + Enzyme for Unit and Integration tests
  2. Divide them into two set of tasks, one group for unit and integration, other for E2E
MohammedMaaz commented 1 year ago

Hi @Pajko97

Thanks for your detailed proposal for the frontend testing strategy.

At this point, given the rapid development and iterations we are going through, I think e2e tests for some core features of the app are vital to ensure things are working fine as observed from the user's perspective.

So, we can initially start with writing e2e tests in Cypress for the main features of the app.

Later, we can setup the structure for unit and integration tests through Jest and Enzyme or react-testing-library.

@mmabrouk we should create relevant issues for the above and write a basic example test suite on Cypress that we can then follow to add more test suites.

mmabrouk commented 1 year ago

Thanks a lot for the detailed proposal @Pajko97 ! I agree with @MohammedMaaz, I think we should start with setting up a structure for e2e cypress tests for the main features and gradually add more granularity.

I will create an issue for setting up the infra and one basic test suite on Cypress, and then we can go from there. I will close for now all other issues on testing, we can reopen them as soon as we're done with the basic example.

FYI @aakrem