Skip to content
Snippets Groups Projects
Unverified Commit 8c3201e4 authored by Nemanja Glumac's avatar Nemanja Glumac Committed by GitHub
Browse files

Enable `maildev` SMTP server in CI for Cypress tests (#15665)


* Add SMTP server for testing

* Try running maildev in the default executor for Cypress

* Add first email-based Cypress test

* Try different ports

* Stop using ENVs for maildev

* Use camelCase for `const`

Co-authored-by: default avatarLuis Paolini <paoliniluis@gmail.com>
parent 03398cd6
No related branches found
No related tags found
No related merge requests found
......@@ -12,10 +12,12 @@ executors:
- image: metabase/ci:lein-2.9.5-clojure-1.10.3.814
# CircleCI base (Lein 2.9.5) + Node + Headless browsers + Clojure CLI - big one
# Maildev runs by default with all Cypress tests
clojure-and-node-and-browsers:
working_directory: /home/circleci/metabase/metabase/
docker:
- image: circleci/clojure:lein-2.9.5-node-browsers
- image: maildev/maildev
# Java 11 tests also test Metabase with the at-rest encryption enabled. See
# https://metabase.com/docs/latest/operations-guide/encrypting-database-details-at-rest.html for an explanation of
......
......@@ -371,6 +371,26 @@ describe("scenarios > admin > settings", () => {
cy.findByText("Sorry, something went wrong. Please try again.");
});
it("should send a test email for a valid SMTP configuration", () => {
// We must clear maildev inbox before each run - this will be extracted and automated
cy.request("DELETE", "http://localhost:80/email/all");
cy.request("PUT", "/api/setting", {
"email-smtp-host": "localhost",
"email-smtp-port": "25",
"email-smtp-username": "admin",
"email-smtp-password": "admin",
"email-smtp-security": "none",
"email-from-address": "mailer@metabase.test",
});
cy.visit("/admin/settings/email");
cy.findByText("Send test email").click();
cy.findByText("Sent!");
cy.request("GET", "http://localhost:80/email").then(({ body }) => {
const emailBody = body[0].text;
expect(emailBody).to.include("Your Metabase emails are working");
});
});
it("should be able to clear email settings", () => {
cy.visit("/admin/settings/email");
cy.findByText("Clear").click();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment