Automated Testing
Learn how to run unit and integration tests with your Frigade Flows
Unlike no-code tools, Frigade allows you to easily write automated tests for your Flows. In this guide, we will show you how to write and run tests for your Flows using Playwright and Jest. The same principles can be applied to any testing framework.
Using a test user
When writing tests for your Flows, you should use a test user. This user should have the same permissions and properties as the users who will use your Flow.
Before running your tests, you will likely want to reset this user in Frigade. This can be done by making the following API request using your private API key in the Developer environment (see API docs for more information):
With this in hand, you can add a beforeAll
to reset the test user before and after running your tests.
Writing tests
To write tests for your Flows, you can use Playwright, Puppeteer, or any other testing framework.
In this example, we will use Playwright. This test presses the primary button with the text “Got it” in a Frigade.Announcement
and ensures that the modal is closed.
Going further
For testing more complex scenarios (for instance, the chaining of Flows), you can leverage the underlying Vanilla JS SDK to simulate completing the first Flow and then starting the second Flow.
Methods such as flow.complete()
or step.complete()
support an optional createdAt
parameter that can simulate the time of completion, too.