Skip to content
Snippets Groups Projects
Unverified Commit 275fd836 authored by Tom Robinson's avatar Tom Robinson Committed by GitHub
Browse files

Settings email form fixes (#12283)

* Fix email settings form. Resolves #12274, Resolves #12275

* Add email settings cypress tests
parent e67f1692
No related branches found
No related tags found
No related merge requests found
......@@ -33,6 +33,8 @@ const SAVE_SETTINGS_BUTTONS_STATES = {
@connect(
null,
{ updateSettings },
null,
{ withRef: true }, // HACK: needed so consuming components can call methods on the component :-/
)
export default class SettingsBatchForm extends Component {
constructor(props, context) {
......
......@@ -69,7 +69,7 @@ export default class SettingsEmailForm extends Component {
const { sendingEmail } = this.state;
return (
<SettingsBatchForm
ref={form => (this._form = form)}
ref={form => (this._form = form && form.getWrappedInstance())}
{...this.props}
updateSettings={this.props.updateEmailSettings}
disable={sendingEmail !== "default"}
......
......@@ -59,4 +59,37 @@ describe("scenarios > admin > settings", () => {
openOrdersTable();
cy.contains(/^February 11, 2019, 9:40 PM$/);
});
describe(" > email settings", () => {
it("should be able to save email settings", () => {
cy.visit("/admin/settings/email");
cy.findByPlaceholderText("smtp.yourservice.com")
.type("localhost")
.blur();
cy.findByPlaceholderText("587")
.type("1234")
.blur();
cy.findByPlaceholderText("metabase@yourcompany.com")
.type("admin@metabase.com")
.blur();
cy.findByText("Save changes").click();
cy.findByText("Changes saved!");
});
it("should show an error if test email fails", () => {
cy.visit("/admin/settings/email");
cy.findByText("Send test email").click();
cy.findByText("Sorry, something went wrong. Please try again.");
});
it("should be able to clear email settings", () => {
cy.visit("/admin/settings/email");
cy.findByText("Clear").click();
cy.findByPlaceholderText("smtp.yourservice.com").should("have.value", "");
cy.findByPlaceholderText("587").should("have.value", "");
cy.findByPlaceholderText("metabase@yourcompany.com").should(
"have.value",
"",
);
});
});
});
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