Quickstart Example
const agent = await agentProvider.getAdminAPIAgent();
await agent.get('/posts/');
await agent.put('/posts/');
await agent.post('/posts/');
await agent.patch('/posts/');
await agent.delete('/posts/');
await agent.head('/posts/');
await agent.options('/posts/');
<aside> ✅ Best Practice
expectEmptyBody
for 204s, redirects etcsinon
+ sinon.assert
not should
.should
- use node’s assert library and write thoughtful error messages.snap
filesYou can access the new e2e framework by requiring this file /test/utils/e2e-framework.js
.
There are currently 4 parts to the framework:
The goal of the new framework is to be a single point of access for everything you need for testing, without having to require various utilities files. No more testUtils, utils, localUtils, etc.
These are a variation of the e2e Framework tests. They allow for checking outgoing webhook requests. The principles and building blocks for e2e webhook tests are similar to e2e API tests. The main difference it a concept of webhookMockReceiver. Webhook mock receiver provides receiving endpoint mocking and outgoing webhook request snapshot testing. For more details read the Webhook Mock Receiver section.
The emailMockReceiver
is a vital component for testing outgoing email HTML contents and associated metadata, such as the to address or the email subject. It is obtained by calling mockManager.mockMail()
.
The emailMockReceiver
provides the following methods to ensure that email sending behaves as expected: