UNPKG

@umbraco/playwright-testhelpers

Version:

Test helpers for making playwright tests for Umbraco solutions

33 lines 1.29 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SmtpApiHelper = void 0; class SmtpApiHelper { api; smtpBaseUrl = 'http://localhost:5000'; // Default smtp4dev URL, can be configured constructor(api) { this.api = api; } async getAllEmails() { const response = await this.api.page.request.get(this.smtpBaseUrl + '/api/messages', { ignoreHTTPSErrors: true }); return await response.json(); } async deleteAllEmails() { const response = await this.api.page.request.delete(this.smtpBaseUrl + '/api/messages/*', { ignoreHTTPSErrors: true }); return response.status(); } async findEmailBySubject(subject) { const emails = await this.getAllEmails(); const foundEmail = emails.results.find((email) => email.subject && email.subject.toLowerCase().includes(subject.toLowerCase())); return foundEmail || null; } async doesNotificationEmailWithSubjectExist(actionName, contentName) { const expectedSubject = `Notification about ${actionName} performed on ${contentName}`; return this.findEmailBySubject(expectedSubject); } } exports.SmtpApiHelper = SmtpApiHelper; //# sourceMappingURL=SmtpApiHelper.js.map