API authentication and CRUD testing
This check will monitor the functionality of the Checkly check groups API. It will create, get, update and delete a group, cleaning up any data afterwards. You can find the Checkly API documentation here. The Checkly Public API uses API keys to authenticate requests. You can generate a key for your account here. This example uses environment variables to avoid sharing secrets in clear text. You can learn more about how to use environment variables in Checkly here.auth.spec.ts
Cleaning Up Test Data
In this example we usebeforeAll
to verify that there’s no old test data that will pollute the test, and afterAll
to remove any data created by the test before it ends.
To learn more about these methods see the Playwright documentation.
An API_KEY from https://crudapi.co.uk/ is required for this example to work.
setup-teardown.spec.ts
Verifying Binary Payloads
One way to ensure that e.g. CDN endpoints are serving images correctly is by verifying its binary. Here is an example of how to verify several images in a loop, checking each image against a unique binary.binary.spec.ts