I have written E2E tests for my application. My manager wants some selected tests to run in CI pipeline. I ran those selected tests locally and found that it was taking around 20 mins to execute in serial mode and 11 mins in parallel mode. In CI pipeline I don't know what will be these stats as I don't know the compute power. Anyways, it's a huge duration and these tests will run whenever there is a push in main branch via a PR and no one will like to wait for this long to get their PR deployed.
Is running these tests in a CI pipeline makes sense?
Or I should run these tests only before any release to production to ensure that all major functionalities are working fine and run unit tests in CI pipeline instead(which we don't have as of now)?
Or Is there a way to mock data and run the tests? Maybe it will reduce the time drastically?
Any thoughts please. Thanks!
This thread is trying to answer question "Is it possible to do E2E testing in playwright using mock data?"
It's OK for end-to-end tests to mock some third party APIs which you want to exclude (just to not have your tests depend on systems which are out of your control).
But as soon as you are mocking /your own/ backend APIs, it's no longer an end-to-end test. Then I would call it a frontend test (which may still be valuable to have, in addition to e2e tests).
End-to-end tests should run automatically somewhere in the process between commit and deployment to production. If they are taking too long, maybe you can split up the product into areas that can be tested and deployed separately, so for each commit there is a smaller selection of tests to run.
thank you @harry_aujla @whitemc2 @refactoreric for sharing your views. Yes the backend apis are ours only not any third party apis. I am thinking to make my manager understand that these are E2E tests and are holistically testing the application so it will take time. As an alternative I can mock our backend APIs and run the test fast but with a compromise, now the test won't be E2E tests but frontend tests like @refactoreric mentioned.
@refactoreric could you please give me an example of last part you suggested related to splitting up the product etc. I didn't get it. Thanks.
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].