Contents

Mail templates

As an admin or inventory manager I want to customize the text of the emails that leihs sends So that my users get all information they need and so that my leihs instance is unique and matches the rest of my organization.

Scenario Outline: Available default templates in english

  • Then the default <template name> exists in the file system in <directory> as <file name>

Examples:

template namedirectoryfile name
approvedorderapproved.text.liquid
receivedorderreceived.text.liquid
rejectedorderrejected.text.liquid
submittedordersubmitted.text.liquid
deadline soon reminderuserdeadline_soon_reminder.text.liquid
reminderuserreminder.text.liquid

Scenario Outline: Specifying system-wide default templates

@personas

  • Given I am Gino
  • When I specify a mail template for the <template name> action for the whole system for each active language
  • And I save
  • Then the template <template name> is saved for the whole system for each active language

Examples:

template name
approved
received
rejected
submitted
deadline soon reminder
reminder

Scenario Outline: Specifying mail templates specific to an inventory pool

@personas

  • Given I am Mike
  • When I specify a mail template for the <template name> action in the current inventory pool for each active language
  • And I save
  • Then the template <template name> is saved for the current inventory pool for each active language

Examples:

template name
approved
received
rejected
submitted
deadline soon reminder
reminder

Scenario Outline: Multilingual mail templates

@personas

  • Given I am Normin
  • And there is a system-wide approved mail template defined for the language "<language>"
  • When my language is set to "<language>"
  • And one of my submitted orders to an inventory pool without custom approved mail templates get approved
  • Then I receive an approved mail based on the system-wide template for the language "<language>"

Examples:

language
de-CH
en-GB

Scenario Outline: Receiving reminders using the correct mail template

@personas

  • Given I am Normin
  • And I have a contract with deadline <deadline>
  • And there <custom> a custom <template name> mail template for this contract's inventory pool
  • And there <system> a system-wide <template name> mail template
  • And there <default> a default <template name> mail template
  • When the reminders are sent
  • Then I receive an email formatted according to the <received template> <template name> mail template

Examples:

template namedeadlinecustomsystemdefaultreceived template
reminderyesterdayisisiscustom
reminderyesterdayis notisissystem-wide
reminderyesterdayis notis notisdefault
deadline soon remindertomorrowisisiscustom
deadline soon remindertomorrowis notisissystem-wide
deadline soon remindertomorrowis notis notisdefault

Scenario Outline: Mail template language precendence

@personas

  • Given I am Normin
  • And my language is set to "<language>"
  • And I have a contract with deadline yesterday
  • And there is a custom reminder mail template for this contract's inventory pool in "<custom languages>"
  • And there is a system-wide reminder mail template in "<system languages>"
  • When the reminders are sent
  • Then I receive a <received template> reminder in "<received language>"

Examples:

languagecustom languagessystem languagesreceived templatereceived language
de-CHde-CH,en-GB,en-USde-CH,en-GB,en-UScustomde-CH
de-CHen-GB,en-USde-CH,en-GB,en-UScustomen-GB,en-US
de-CHnonede-CH,en-GB,en-USsystem-widede-CH
de-CHnoneen-GB,en-USsystem-wideen-GB,en-US
de-CHnonenonedefaultdefault

Scenario: Receiving mails using order templates

@upcoming

Scenario: How an email template is parsed

@personas

  • Given I am Normin
  • And I have a contract with deadline yesterday for the inventory pool "A-Ausleihe"
  • And there is a custom reminder mail template for this contract's inventory pool
  • And the custom reminder mail template looks like
    Dear {{ user.name }},
    
    Kind regards,
    {{ inventory_pool.name }}
  • When the reminders are sent
  • Then I receive an email formatted according to the custom reminder mail template
  • And the mail body looks like
    Dear Normin Normalo,
    
    Kind regards,
    A-Ausleihe

Scenario Outline: Reporting errors on mail templates

@personas @javascript

  • Given I am <persona>
  • When I specify a mail template for the <template name> action <scope> for each active language
  • When I edit the <template name> with the "<body>" template in "en-GB"
  • And I save
  • Then I land on the mail templates edit page
  • And I see an error message
  • And the failing <template name> mail template in "en-GB" is highlighted in red
  • And the failing <template name> mail template in "en-GB" is not persisted with the "<body>" template

Examples:

personascopetemplate namebody
Ginofor the whole systemreminderHi {{{ user.name }}
Mikein the current inventory poolreminderHi {{{ user.name }}

Scenario: Mail templates edit permissions

@personas

  • Given I am Pius
  • When I navigate to the mail templates list in the current inventory pool
  • Then I am redirected to the login page
  • Given I am Mike
  • When I navigate to the mail templates list in the current inventory pool
  • Then I see a list of mail templates

Source: features/manage/mails/mail_templates.feature at commit eb240d9e, Leihs (GPL license).