microsoft / AzureTRE

An accelerator to help organizations build Trusted Research Environments on Azure.
https://microsoft.github.io/AzureTRE
MIT License
182 stars 139 forks source link

UI testing #3869

Open yahya130 opened 7 months ago

yahya130 commented 7 months ago

Currently the portal UI (User interface) does not have any tests in place, that includes unit, integration and E2E (end-to-end - E2E might not be for now) tests. It is important to have tests in place to ensure the UI functionality behaves as expected and prevent bugs or breaking changes. As a first step we need to address the following questions:

Note given the size and complexity of the UI code, putting in testing with a high code coverage may take time and multiple user stories/issues to implement. We first need to create a testing strategy.

We can use this issue as a place to have the discussion, feel free to comment and make suggestions according to above questions.

damoodamoo commented 7 months ago

I'd love to see e2e tests involving the TRE Portal - would be great to use that to create a workspace, resource, then delete them all. But yes probably a way off.

Agree that we should start small - maybe choose a library and implement some routing tests?

yahya130 commented 7 months ago

I'd love to see e2e tests involving the TRE Portal - would be great to use that to create a workspace, resource, then delete them all. But yes probably a way off.

Agree that we should start small - maybe choose a library and implement some routing tests?

@damoodamoo Sounds great 😄 unit and integration (where routing would be) tests would be a great starting point. In terms of the frameworks (there are so many!), my suggestions are Jest and React Testing Library which do a good job and heard Cypress is good for E2E. Another thing that would be good is to create a checklist or table of all the components that we need to test just to understand and keep track of what we're doing too.

marrobi commented 7 months ago

Where does something like https://playwright.dev/ come in?

yahya130 commented 7 months ago

Where does something like https://playwright.dev/ come in?

That looks like a specific E2E testing framework, would be an alternative framework to Cypress E2E. Unit and integration tests will need to be written in another framework like Jest.

damoodamoo commented 7 months ago

Playwright is essentially the "pretend you're a user" type tests. Really useful, but as @yahya130 says, for e2e scenarios. Potentially - you could change the TRE e-2-e tests to start with Playwright clicking the "New Workspace" button, rather than firing requests to the API.