diff --git a/commands.js b/commands.js index 8d21fe5f6cda40e28775d74183d2bdc3559febd7..22640d8d773f80f2fa9c6e49b8e558590c693ac1 100644 --- a/commands.js +++ b/commands.js @@ -118,3 +118,19 @@ Cypress.Commands.add('assertMailhogInbox', (callback) => { callback(resp); }) }) + +Cypress.Commands.add('emptyMailpitInbox', () => { + cy.request('DELETE', Cypress.env('mailpitUrl') + '/api/v1/messages').then((resp) => { + expect(resp.status).to.eq(200) + }); +}) + +Cypress.Commands.add('assertMailpitInbox', (callback) => { + cy.request({ + url: Cypress.env('mailpitUrl') + '/api/v1/messages', + accept: 'application/json' + }).then((resp) => { + expect(resp.status).to.eq(200); + callback(resp); + }) +})