GODT-1779: Remove go-imap

This commit is contained in:
James Houlahan
2022-08-26 17:00:21 +02:00
parent 3b0bc1ca15
commit 39433fe707
593 changed files with 12725 additions and 91626 deletions

View File

@ -0,0 +1,92 @@
Feature: IMAP auth
Scenario: Authenticates successfully
Given there is connected user "user"
When IMAP client authenticates "user"
Then IMAP response is "OK"
Scenario: Authenticates with bad password
Given there is connected user "user"
When IMAP client authenticates "user" with bad password
Then IMAP response is "IMAP error: NO backend/credentials: incorrect password"
@ignore-live-auth
Scenario: Authenticates with disconnected user
Given there is disconnected user "user"
When IMAP client authenticates "user"
Then IMAP response is "IMAP error: NO account is logged out, use the app to login again"
@ignore-live-auth
Scenario: Authenticates with connected user that was loaded without internet
Given there is user "user" which just logged in
And there is no internet connection
When bridge starts
And the internet connection is restored
And the event loop of "user" loops once
And IMAP client authenticates "user"
# Problems during IMAP auth could lead to the user being disconnected.
# This could take a few milliseconds because it happens async in separate goroutines.
# We wait enough time for that to happen, then check that it didn't happen (user should remain connected).
And 2 seconds pass
Then "user" is connected
@ignore-live-auth
Scenario: Authenticates with freshly logged-out user
Given there is user "user" which just logged in
When "user" logs out
And IMAP client authenticates "user"
Then IMAP response is "IMAP error: NO account is logged out, use the app to login again"
@ignore-live-auth
Scenario: Authenticates user which was re-logged in
Given there is user "user" which just logged in
When "user" logs out
And IMAP client authenticates "user"
Then IMAP response is "IMAP error: NO account is logged out, use the app to login again"
When "user" logs in
And IMAP client authenticates "user"
Then IMAP response is "OK"
When IMAP client selects "INBOX"
Then IMAP response is "OK"
Scenario: Authenticates with no user
When IMAP client authenticates with username "user@pm.me" and password "bridgepassword"
Then IMAP response is "IMAP error: NO user user@pm.me not found"
Scenario: Authenticates with capital letter
Given there is connected user "userAddressWithCapitalLetter"
When IMAP client authenticates "userAddressWithCapitalLetter"
Then IMAP response is "OK"
Scenario: Authenticates with more addresses - primary one
Given there is connected user "userMoreAddresses"
When IMAP client authenticates "userMoreAddresses" with address "primary"
Then IMAP response is "OK"
Scenario: Authenticates with more addresses - secondary one
Given there is connected user "userMoreAddresses"
When IMAP client authenticates "userMoreAddresses" with address "secondary"
Then IMAP response is "OK"
Scenario: Authenticates with more addresses - disabled address
Given there is connected user "userMoreAddresses"
When IMAP client authenticates "userMoreAddresses" with address "disabled"
Then IMAP response is "IMAP error: NO user .* not found"
@ignore-live
Scenario: Authenticates with secondary address of account with disabled primary address
Given there is connected user "userDisabledPrimaryAddress"
When IMAP client authenticates "userDisabledPrimaryAddress" with address "secondary"
Then IMAP response is "OK"
Scenario: Authenticates two users
Given there is connected user "user"
And there is connected user "userMoreAddresses"
When IMAP client "imap1" authenticates "user"
Then IMAP response to "imap1" is "OK"
When IMAP client "imap2" authenticates "userMoreAddresses" with address "primary"
Then IMAP response to "imap2" is "OK"
Scenario: Logs out user
Given there is connected user "user"
When IMAP client logs out
Then IMAP response is "OK"

View File

@ -0,0 +1,63 @@
Feature: IMAP IDLE
Background:
Given there is connected user "user"
And there are 10 messages in mailbox "INBOX" for "user"
# Those tests are ignored as currently our IMAP implementation is not responding with updates to all open connections.
@ignore
Scenario Outline: Mark as read
Given there is IMAP client "active" logged in as "user"
And there is IMAP client "active" selected in "INBOX"
And there is IMAP client "idling" logged in as "user"
And there is IMAP client "idling" selected in "INBOX"
When IMAP client "idling" starts IDLE-ing
And IMAP client "active" marks message seq "<seq>" as read
Then IMAP client "idling" receives update marking message seq "<seq>" as read within <seconds> seconds
Then message "<seq>" in "INBOX" for "user" is marked as read
Examples:
| seq | seconds |
| 1 | 2 |
| 1:5 | 2 |
| 1:10 | 5 |
@ignore
Scenario Outline: Mark as unread
Given there is IMAP client "active" logged in as "user"
And there is IMAP client "active" selected in "INBOX"
And there is IMAP client "idling" logged in as "user"
And there is IMAP client "idling" selected in "INBOX"
When IMAP client "idling" starts IDLE-ing
And IMAP client "active" marks message seq "<seq>" as unread
Then IMAP client "idling" receives update marking message seq "<seq>" as unread within <seconds> seconds
And message "<seq>" in "INBOX" for "user" is marked as unread
Examples:
| seq | seconds |
| 1 | 2 |
| 1:5 | 2 |
| 1:10 | 5 |
@ignore
Scenario Outline: Three IDLEing
Given there is IMAP client "active" logged in as "user"
And there is IMAP client "active" selected in "INBOX"
And there is IMAP client "idling1" logged in as "user"
And there is IMAP client "idling1" selected in "INBOX"
And there is IMAP client "idling2" logged in as "user"
And there is IMAP client "idling2" selected in "INBOX"
And there is IMAP client "idling3" logged in as "user"
And there is IMAP client "idling3" selected in "INBOX"
When IMAP client "idling1" starts IDLE-ing
And IMAP client "idling2" starts IDLE-ing
And IMAP client "idling3" starts IDLE-ing
And IMAP client "active" marks message seq "<seq>" as read
Then IMAP client "idling1" receives update marking message seq "<seq>" as read within <seconds> seconds
Then IMAP client "idling2" receives update marking message seq "<seq>" as read within <seconds> seconds
Then IMAP client "idling3" receives update marking message seq "<seq>" as read within <seconds> seconds
Examples:
| seq | seconds |
| 1 | 2 |
| 1:5 | 2 |
| 1:10 | 5 |

View File

@ -0,0 +1,27 @@
Feature: IMAP IDLE with two users
Scenario: IDLE statements are not leaked to other account
Given there is connected user "user"
And there are 10 messages in mailbox "INBOX" for "user"
And there is connected user "userMoreAddresses"
And there is IMAP client "active" logged in as "user"
And there is IMAP client "active" selected in "INBOX"
And there is IMAP client "idling" logged in as "userMoreAddresses"
And there is IMAP client "idling" selected in "INBOX"
When IMAP client "idling" starts IDLE-ing
And IMAP client "active" marks message seq "1" as read
Then IMAP client "idling" does not receive update for message seq "1" within 5 seconds
Scenario: IDLE statements are not leaked to other alias
Given there is connected user "userMoreAddresses"
And there is "userMoreAddresses" in "combined" address mode
And there are messages in mailbox "INBOX" for "userMoreAddresses"
| from | to | subject |
| john.doe@mail.com | [primary] | foo |
| jane.doe@mail.com | [secondary] | bar |
And there is IMAP client "active" logged in as "userMoreAddresses" with address "primary"
And there is IMAP client "active" selected in "INBOX"
And there is IMAP client "idling" logged in as "userMoreAddresses" with address "secondary"
And there is IMAP client "idling" selected in "INBOX"
When IMAP client "idling" starts IDLE-ing
And IMAP client "active" marks message seq "1" as read
Then IMAP client "idling" does not receive update for message seq "1" within 5 seconds

View File

@ -0,0 +1,50 @@
Feature: IMAP create mailbox
Background:
Given there is connected user "user"
And there is IMAP client logged in as "user"
And "user" does not have mailbox "Folders/mbox"
And "user" does not have mailbox "Labels/mbox"
Scenario: Create folder
When IMAP client creates mailbox "Folders/mbox"
Then IMAP response is "OK"
And "user" has mailbox "Folders/mbox"
And "user" does not have mailbox "Labels/mbox"
Scenario: Create label
When IMAP client creates mailbox "Labels/mbox"
Then IMAP response is "OK"
And "user" does not have mailbox "Folders/mbox"
And "user" has mailbox "Labels/mbox"
Scenario: Creating label with existing name is not possible
Given there is "user" with mailbox "Folders/mbox"
When IMAP client creates mailbox "Labels/mbox"
Then IMAP response is "IMAP error: NO A label or folder with this name already exists"
And "user" has mailbox "Folders/mbox"
And "user" does not have mailbox "Labels/mbox"
Scenario: Creating folder with existing name is not possible
Given there is "user" with mailbox "Labels/mbox"
When IMAP client creates mailbox "Folders/mbox"
Then IMAP response is "IMAP error: NO A label or folder with this name already exists"
And "user" has mailbox "Labels/mbox"
And "user" does not have mailbox "Folders/mbox"
Scenario: Creating system mailbox is not possible
When IMAP client creates mailbox "INBOX"
Then IMAP response is "IMAP error: NO mailbox INBOX already exists"
When IMAP client creates mailbox "Folders/INBOX"
Then IMAP response is "IMAP error: NO Invalid name"
# API allows you to create custom folder with naem `All Mail`
#When IMAP client creates mailbox "Folders/All mail"
#Then IMAP response is "IMAP error: NO mailbox All Mail already exists"
Scenario: Creating mailbox without prefix is not possible
When IMAP client creates mailbox "mbox"
Then IMAP response is "OK"
And "user" does not have mailbox "mbox"
When All mail mailbox is hidden
And IMAP client creates mailbox "All mail"
Then IMAP response is "OK"
And "user" does not have mailbox "All mail"

View File

@ -0,0 +1,29 @@
Feature: IMAP delete mailbox
Background:
Given there is connected user "user"
Scenario: Delete folder
Given there is "user" with mailbox "Folders/mbox"
And there is IMAP client logged in as "user"
When IMAP client deletes mailbox "Folders/mbox"
Then IMAP response is "OK"
And "user" does not have mailbox "Folders/mbox"
Scenario: Delete label
Given there is "user" with mailbox "Labels/mbox"
And there is IMAP client logged in as "user"
When IMAP client deletes mailbox "Labels/mbox"
Then IMAP response is "OK"
And "user" does not have mailbox "Labels/mbox"
Scenario: Empty Trash by deleting it
Given there are 10 messages in mailbox "Trash" for "user"
And there is IMAP client logged in as "user"
When IMAP client deletes mailbox "Trash"
Then IMAP response is "OK"
And mailbox "Trash" for "user" has 0 messages
Scenario: Deleting system mailbox is not possible
Given there is IMAP client logged in as "user"
When IMAP client deletes mailbox "INBOX"
Then IMAP response is "IMAP error: NO cannot empty mailbox 0"

View File

@ -0,0 +1,15 @@
Feature: IMAP get mailbox info
Background:
Given there is connected user "user"
And there are messages in mailbox "INBOX" for "user"
| from | to | subject | body | read | starred |
| john.doe@mail.com | user@pm.me | foo | hello | false | false |
| jane.doe@mail.com | name@pm.me | bar | world | true | true |
And there is IMAP client logged in as "user"
Scenario: Mailbox info contains mailbox name
When IMAP client gets info of "INBOX"
Then IMAP response contains "2 EXISTS"
And IMAP response contains "UNSEEN 1"
And IMAP response contains "UIDNEXT 3"
And IMAP response contains "UIDVALIDITY"

View File

@ -0,0 +1,143 @@
Feature: IMAP list mailboxes
Background:
Given there is connected user "user"
Scenario: List mailboxes
Given there is "user" with mailbox "Folders/mbox1"
And there is "user" with mailbox "Labels/mbox2"
And there is IMAP client logged in as "user"
When IMAP client lists mailboxes
Then IMAP response contains "INBOX"
Then IMAP response contains "Sent"
Then IMAP response contains "Archive"
Then IMAP response contains "Trash"
Then IMAP response contains "All Mail"
Then IMAP response contains "Folders/mbox1"
Then IMAP response contains "Labels/mbox2"
Scenario: List mailboxes without All Mail
Given there is IMAP client logged in as "user"
When IMAP client lists mailboxes
Then IMAP response contains "INBOX"
Then IMAP response contains "Sent"
Then IMAP response contains "Archive"
Then IMAP response contains "Trash"
Then IMAP response contains "All Mail"
When All mail mailbox is hidden
And IMAP client lists mailboxes
Then IMAP response contains "INBOX"
Then IMAP response contains "Sent"
Then IMAP response contains "Archive"
Then IMAP response contains "Trash"
Then IMAP response doesn't contain "All Mail"
When All mail mailbox is visible
And IMAP client lists mailboxes
Then IMAP response contains "INBOX"
Then IMAP response contains "Sent"
Then IMAP response contains "Archive"
Then IMAP response contains "Trash"
Then IMAP response contains "All Mail"
Scenario: List multiple times in parallel without crash
Given there is "user" with mailboxes
| Folders/mbox1 |
| Folders/mbox2 |
| Folders/mbox3 |
| Folders/mbox4 |
| Folders/mbox5 |
| Folders/mbox6 |
| Folders/mbox7 |
| Folders/mbox8 |
| Folders/mbox9 |
| Folders/mbox10 |
| Folders/mbox11 |
| Folders/mbox12 |
| Folders/mbox13 |
| Folders/mbox14 |
| Folders/mbox15 |
| Folders/mbox16 |
| Folders/mbox17 |
| Folders/mbox18 |
| Folders/mbox19 |
| Folders/mbox20 |
| Labels/lab1 |
| Labels/lab2 |
| Labels/lab3 |
| Labels/lab4 |
| Labels/lab5 |
| Labels/lab6 |
| Labels/lab7 |
| Labels/lab8 |
| Labels/lab9 |
| Labels/lab10 |
| Labels/lab11 |
| Labels/lab12 |
| Labels/lab13 |
| Labels/lab14 |
| Labels/lab15 |
| Labels/lab16 |
| Labels/lab17 |
| Labels/lab18 |
| Labels/lab19 |
| Labels/lab20 |
| Labels/lab1.1 |
| Labels/lab1.2 |
| Labels/lab1.3 |
| Labels/lab1.4 |
| Labels/lab1.5 |
| Labels/lab1.6 |
| Labels/lab1.7 |
| Labels/lab1.8 |
| Labels/lab1.9 |
| Labels/lab1.10 |
| Labels/lab1.11 |
| Labels/lab1.12 |
| Labels/lab1.13 |
| Labels/lab1.14 |
| Labels/lab1.15 |
| Labels/lab1.16 |
| Labels/lab1.17 |
| Labels/lab1.18 |
| Labels/lab1.19 |
| Labels/lab1.20 |
| Labels/lab2.1 |
| Labels/lab2.2 |
| Labels/lab2.3 |
| Labels/lab2.4 |
| Labels/lab2.5 |
| Labels/lab2.6 |
| Labels/lab2.7 |
| Labels/lab2.8 |
| Labels/lab2.9 |
| Labels/lab2.10 |
| Labels/lab2.11 |
| Labels/lab2.12 |
| Labels/lab2.13 |
| Labels/lab2.14 |
| Labels/lab2.15 |
| Labels/lab2.16 |
| Labels/lab2.17 |
| Labels/lab2.18 |
| Labels/lab2.19 |
| Labels/lab2.20 |
And there is IMAP client "A" logged in as "user"
And there is IMAP client "B" logged in as "user"
When IMAP client "A" lists mailboxes
And IMAP client "B" lists mailboxes
Then IMAP response to "A" is "OK"
And IMAP response to "A" contains "mbox1"
And IMAP response to "A" contains "mbox10"
And IMAP response to "A" contains "mbox20"
@ignore-live
Scenario: List mailboxes with subfolders
# Escaped slash in the name contains slash in the name.
# Not-escaped slash in the name means tree structure.
# We keep escaping in an IMAP communication so each mailbox is unique and
# both mailboxes are accessible. The slash is visible in the IMAP client.
Given there is "user" with mailbox "Folders/a\/b"
And there is "user" with mailbox "Folders/a/b"
And there is IMAP client logged in as "user"
When IMAP client lists mailboxes
Then IMAP response contains "Folders/a\/b"
Then IMAP response contains "Folders/a/b"

View File

@ -0,0 +1,30 @@
Feature: IMAP mailbox rename
Background:
Given there is connected user "user"
Scenario: Rename folder
Given there is "user" with mailbox "Folders/mbox"
And there is IMAP client logged in as "user"
When IMAP client renames mailbox "Folders/mbox" to "Folders/mbox2"
Then IMAP response is "OK"
And "user" does not have mailbox "Folders/mbox"
And "user" has mailbox "Folders/mbox2"
Scenario: Rename label
Given there is "user" with mailbox "Labels/mbox"
And there is IMAP client logged in as "user"
When IMAP client renames mailbox "Labels/mbox" to "Labels/mbox2"
Then IMAP response is "OK"
And "user" does not have mailbox "Labels/mbox"
And "user" has mailbox "Labels/mbox2"
Scenario: Renaming folder to label is not possible
Given there is "user" with mailbox "Folders/mbox"
And there is IMAP client logged in as "user"
When IMAP client renames mailbox "Folders/mbox" to "Labels/mbox"
Then IMAP response is "IMAP error: NO cannot rename folder to non-folder"
Scenario: Renaming system folder is not possible
Given there is IMAP client logged in as "user"
When IMAP client renames mailbox "INBOX" to "Folders/mbox"
Then IMAP response is "IMAP error: NO cannot rename system mailboxes"

View File

@ -0,0 +1,17 @@
Feature: IMAP select into mailbox
Background:
Given there is connected user "user"
And there is "user" with mailbox "Folders/mbox"
And there is IMAP client logged in as "user"
Scenario: Select into inbox
When IMAP client selects "INBOX"
Then IMAP response is "OK"
Scenario: Select into custom mailbox
When IMAP client selects "Folders/mbox"
Then IMAP response is "OK"
Scenario: Select into non-existing mailbox
When IMAP client selects "qwerty"
Then IMAP response is "IMAP error: NO mailbox qwerty does not exist"

View File

@ -0,0 +1,20 @@
Feature: IMAP get mailbox status
Background:
Given there is connected user "user"
And there are messages in mailbox "INBOX" for "user"
| from | to | subject | body | read | starred |
| john.doe@mail.com | user@pm.me | foo | hello | false | false |
| jane.doe@mail.com | name@pm.me | bar | world | true | true |
And there is IMAP client logged in as "user"
And there is IMAP client selected in "INBOX"
Scenario: Mailbox status contains mailbox name
When IMAP client gets status of "INBOX"
Then IMAP response contains "INBOX"
Scenario: Mailbox status contains counts and UIDs
When IMAP client gets status of "INBOX"
And IMAP response contains "MESSAGES 2"
And IMAP response contains "UNSEEN 1"
And IMAP response contains "UIDNEXT 3"
And IMAP response contains "UIDVALIDITY"

View File

@ -0,0 +1,89 @@
Feature: IMAP copy messages
Background:
Given there is connected user "user"
And there is "user" with mailbox "Folders/mbox"
And there is "user" with mailbox "Labels/label"
And there are messages in mailbox "INBOX" for "user"
| from | to | subject | body | read | deleted |
| john.doe@mail.com | user@pm.me | foo | hello | true | false |
| jane.doe@mail.com | name@pm.me | bar | world | false | true |
And there are messages in mailbox "Sent" for "user"
| from | to | subject | body |
| john.doe@mail.com | user@pm.me | response | hello |
And there is IMAP client logged in as "user"
Scenario: Copy message to label
Given there is IMAP client selected in "INBOX"
When IMAP client copies message seq "1" to "Labels/label"
Then IMAP response is "OK"
And mailbox "INBOX" for "user" has messages
| from | to | subject | body | read | deleted |
| john.doe@mail.com | user@pm.me | foo | hello | true | false |
| jane.doe@mail.com | name@pm.me | bar | world | false | true |
And mailbox "Labels/label" for "user" has messages
| from | to | subject | body | read | deleted |
| john.doe@mail.com | user@pm.me | foo | hello | true | false |
Scenario: Copy all messages to label
Given there is IMAP client selected in "INBOX"
When IMAP client copies message seq "1:*" to "Labels/label"
Then IMAP response is "OK"
And mailbox "INBOX" for "user" has messages
| from | to | subject | body | read | deleted |
| john.doe@mail.com | user@pm.me | foo | hello | true | false |
| jane.doe@mail.com | name@pm.me | bar | world | false | true |
And mailbox "Labels/label" for "user" has messages
| from | to | subject | body | read | deleted |
| john.doe@mail.com | user@pm.me | foo | hello | true | false |
| jane.doe@mail.com | name@pm.me | bar | world | false | true |
Scenario: Copy message to folder does move
Given there is IMAP client selected in "INBOX"
When IMAP client copies message seq "1" to "Folders/mbox"
Then IMAP response is "OK"
And mailbox "INBOX" for "user" has messages
| from | to | subject | body | read | deleted |
| jane.doe@mail.com | name@pm.me | bar | world | false | true |
And mailbox "Folders/mbox" for "user" has messages
| from | to | subject | body | read | deleted |
| john.doe@mail.com | user@pm.me | foo | hello | true | false |
Scenario: Copy message from All mail moves from the original location
Given there is IMAP client selected in "All Mail"
When IMAP client copies message seq "1" to "Folders/mbox"
Then IMAP response is "OK"
And mailbox "INBOX" for "user" has 2 messages
And mailbox "INBOX" for "user" has messages
| from | to | subject | body | read | deleted |
| jane.doe@mail.com | name@pm.me | bar | world | false | true |
| john.doe@mail.com | user@pm.me | response | hello | true | false |
And mailbox "All Mail" for "user" has 3 messages
And mailbox "All Mail" for "user" has messages
| from | to | subject | body | read | deleted |
| john.doe@mail.com | user@pm.me | foo | hello | true | false |
| jane.doe@mail.com | name@pm.me | bar | world | false | false |
| john.doe@mail.com | user@pm.me | response | hello | true | false |
And mailbox "Folders/mbox" for "user" has 1 messages
And mailbox "Folders/mbox" for "user" has messages
| from | to | subject | body | read | deleted |
| john.doe@mail.com | user@pm.me | foo | hello | true | false |
Scenario: Copy all messages to folder does move
Given there is IMAP client selected in "INBOX"
When IMAP client copies message seq "1:*" to "Folders/mbox"
Then IMAP response is "OK"
And mailbox "INBOX" for "user" has 0 messages
And mailbox "Folders/mbox" for "user" has messages
| from | to | subject | body | read | deleted |
| john.doe@mail.com | user@pm.me | foo | hello | true | false |
| jane.doe@mail.com | name@pm.me | bar | world | false | true |
Scenario: Copy message from Inbox to Sent is not possible
Given there is IMAP client selected in "INBOX"
When IMAP client copies message seq "1" to "Sent"
Then IMAP response is "move from Inbox to Sent is not allowed"
Scenario: Copy message from Sent to Inbox is not possible
Given there is IMAP client selected in "Sent"
When IMAP client copies message seq "1" to "INBOX"
Then IMAP response is "move from Sent to Inbox is not allowed"

View File

@ -0,0 +1,78 @@
Feature: IMAP create messages
Background:
Given there is connected user "userMoreAddresses"
And there is IMAP client logged in as "userMoreAddresses"
Scenario: Creates message to user's primary address
Given there is IMAP client selected in "INBOX"
When IMAP client creates message "foo" from "john.doe@email.com" to address "primary" of "userMoreAddresses" with body "hello world" in "INBOX"
Then IMAP response is "OK"
And mailbox "INBOX" for "userMoreAddresses" has messages
| from | to | subject | read |
| john.doe@email.com | [primary] | foo | true |
Scenario: Creates draft
When IMAP client creates message "foo" from address "primary" of "userMoreAddresses" to "john.doe@email.com" with body "hello world" in "Drafts"
Then IMAP response is "OK"
And mailbox "Drafts" for "userMoreAddresses" has messages
| from | to | subject | read |
| [primary] | john.doe@email.com | foo | true |
Scenario: Creates message sent from user's primary address
Given there is IMAP client selected in "Sent"
When IMAP client creates message "foo" from address "primary" of "userMoreAddresses" to "john.doe@email.com" with body "hello world" in "Sent"
Then IMAP response is "OK"
When the event loop of "userMoreAddresses" loops once
Then mailbox "Sent" for "userMoreAddresses" has messages
| from | to | subject | read |
| [primary] | john.doe@email.com | foo | true |
And mailbox "INBOX" for "userMoreAddresses" has no messages
Scenario: Creates message sent from user's secondary address
Given there is IMAP client selected in "Sent"
When IMAP client creates message "foo" from address "secondary" of "userMoreAddresses" to "john.doe@email.com" with body "hello world" in "Sent"
Then IMAP response is "OK"
When the event loop of "userMoreAddresses" loops once
Then mailbox "Sent" for "userMoreAddresses" has messages
| from | to | subject | read |
| [secondary] | john.doe@email.com | foo | true |
And mailbox "INBOX" for "userMoreAddresses" has no messages
Scenario: Imports an unrelated message to inbox
Given there is IMAP client selected in "INBOX"
When IMAP client creates message "foo" from "john.doe@email.com" to "john.doe2@email.com" with body "hello world" in "INBOX"
Then IMAP response is "OK"
And mailbox "INBOX" for "userMoreAddresses" has messages
| from | to | subject | read |
| john.doe@email.com | john.doe2@email.com | foo | true |
Scenario: Imports an unrelated message to sent
Given there is IMAP client selected in "Sent"
When IMAP client creates message "foo" from "notuser@gmail.com" to "alsonotuser@gmail.com" with body "hello world" in "Sent"
Then IMAP response is "OK"
When the event loop of "userMoreAddresses" loops once
Then mailbox "Sent" for "userMoreAddresses" has messages
| from | to | subject | read |
| notuser@gmail.com | alsonotuser@gmail.com | foo | true |
And mailbox "INBOX" for "userMoreAddresses" has no messages
# Importing duplicate messages when messageID cannot be found in Sent already.
#
# Previously, we discarded messages for which sender matches account address to
# avoid duplicates, but this led to discarding messages imported through mail client.
#
# NOTE: We need to introduce cooldown here in order to detect duplicates
# properly. Once mail is imported to API the Sphinx indices for duplicate
# detection are updated every 10s. Therefore it is good to leave at least 15
# second gap after import in order to be able to correctly handle the case
# when we try to detect duplicate imports
Scenario: Imports a similar (duplicate) message to sent
Given there are messages in mailbox "Sent" for "userMoreAddresses"
| from | to | subject | body |
| [primary] | chosen@one.com | Meet the Twins | Hello, Mr. Anderson |
And wait for Sphinx to create duplication indices
And there is IMAP client selected in "Sent"
Then mailbox "Sent" for "userMoreAddresses" has 1 messages
When IMAP client creates message "Meet the Twins" from address "primary" of "userMoreAddresses" to "chosen@one.com" with body "Hello, Mr. Anderson" in "Sent"
Then IMAP response is "OK \[APPENDUID 4 2\] APPEND completed"
And mailbox "Sent" for "userMoreAddresses" has 2 messages

View File

@ -0,0 +1,127 @@
Feature: IMAP remove messages from mailbox
Background:
Given there is connected user "user"
And there is "user" with mailbox "Folders/mbox"
And there is "user" with mailbox "Labels/label"
Scenario Outline: Mark message as deleted and EXPUNGE
Given there are 10 messages in mailbox "<mailbox>" for "user"
And there is IMAP client logged in as "user"
And there is IMAP client selected in "<mailbox>"
When IMAP client marks message seq "2" as deleted
Then IMAP response is "OK"
And mailbox "<mailbox>" for "user" has 10 messages
And message "2" in "<mailbox>" for "user" is marked as deleted
And IMAP response contains "\* 2 FETCH[ (]*FLAGS \([^)]*\\Deleted"
When IMAP client sends expunge
Then IMAP response is "OK"
And IMAP response contains "\* 2 EXPUNGE"
And mailbox "<mailbox>" for "user" has 9 messages
Examples:
| mailbox |
| INBOX |
| Folders/mbox |
| Labels/label |
| Spam |
| Trash |
Scenario Outline: Mark all messages as deleted and EXPUNGE
Given there are 5 messages in mailbox "<mailbox>" for "user"
And there is IMAP client logged in as "user"
And there is IMAP client selected in "<mailbox>"
When IMAP client marks message seq "1:*" as deleted
Then IMAP response is "OK"
# Use UID version to not be sensitive about the order from API. Event loop
# could return it in different order and delete first message with seq 1,
# which would produce EXPUNGE sequence as 1 4 3 2 1, for example.
When IMAP client sends expunge by UID "1:5"
Then IMAP response is "OK"
And IMAP response contains "\* 1 EXPUNGE"
And IMAP response contains "\* 2 EXPUNGE"
And IMAP response contains "\* 3 EXPUNGE"
And IMAP response contains "\* 4 EXPUNGE"
And IMAP response contains "\* 5 EXPUNGE"
And mailbox "<mailbox>" for "user" has 0 messages
Examples:
| mailbox |
| INBOX |
| Folders/mbox |
| Labels/label |
| Spam |
| Trash |
Scenario Outline: Mark messages as undeleted and EXPUNGE
Given there are 5 messages in mailbox "<mailbox>" for "user"
And there is IMAP client logged in as "user"
And there is IMAP client selected in "<mailbox>"
When IMAP client marks message seq "1:*" as deleted
Then IMAP response is "OK"
When IMAP client marks message seq "1:3" as undeleted
Then IMAP response is "OK"
When IMAP client sends expunge
Then IMAP response is "OK"
And IMAP response contains "\* 4 EXPUNGE"
And IMAP response contains "\* 5 EXPUNGE"
And mailbox "<mailbox>" for "user" has 3 messages
Examples:
| mailbox |
| INBOX |
| Folders/mbox |
| Labels/label |
| Spam |
| Trash |
Scenario Outline: Mark message as deleted and leave mailbox
Given there are 10 messages in mailbox "INBOX" for "user"
And there is IMAP client logged in as "user"
And there is IMAP client selected in "INBOX"
When IMAP client marks message seq "2" as deleted
Then IMAP response is "OK"
And mailbox "INBOX" for "user" has 10 messages
And message "2" in "INBOX" for "user" is marked as deleted
When IMAP client sends command "<leave>"
Then IMAP response is "OK"
And mailbox "INBOX" for "user" has <n> messages
Examples:
| leave | n |
| CLOSE | 9 |
| SELECT INBOX | 9 |
| SELECT Trash | 9 |
| EXAMINE INBOX | 9 |
| EXAMINE Trash | 9 |
| LOGOUT | 9 |
| UNSELECT | 10 |
Scenario: Not possible to delete from All Mail and expunge does nothing
Given there are messages in mailbox "INBOX" for "user"
| id | from | to | subject | body |
| 1 | john.doe@mail.com | user@pm.me | subj1 | body1 |
And there is IMAP client logged in as "user"
And there is IMAP client selected in "All Mail"
When IMAP client marks message seq "1" as deleted
Then IMAP response is "IMAP error: NO operation not allowed for 'All Mail' folder"
And mailbox "All Mail" for "user" has messages
| from | to | subject |
| john.doe@mail.com | user@pm.me | subj1 |
When IMAP client sends expunge
Then IMAP response is "OK"
And mailbox "All Mail" for "user" has messages
| from | to | subject |
| john.doe@mail.com | user@pm.me | subj1 |
Scenario: Expunge specific message only
Given there are 5 messages in mailbox "INBOX" for "user"
And there is IMAP client logged in as "user"
And there is IMAP client selected in "INBOX"
When IMAP client marks message seq "1" as deleted
Then IMAP response is "OK"
When IMAP client marks message seq "2" as deleted
Then IMAP response is "OK"
When IMAP client sends command "UID EXPUNGE 1"
Then IMAP response is "OK"
And mailbox "INBOX" for "user" has 4 messages
And message "2" in "INBOX" for "user" is marked as deleted

View File

@ -0,0 +1,51 @@
Feature: IMAP remove messages from Trash
Background:
Given there is connected user "user"
And there is "user" with mailbox "Folders/mbox"
And there is "user" with mailbox "Labels/label"
Scenario Outline: Message in Trash/Spam and some other label is not permanently deleted
Given there are messages in mailbox "<mailbox>" for "user"
| id | from | to | subject | body |
| 1 | john.doe@mail.com | user@pm.me | foo | hello |
| 2 | jane.doe@mail.com | name@pm.me | bar | world |
And there is IMAP client logged in as "user"
And there is IMAP client selected in "<mailbox>"
When IMAP client copies message seq "2" to "Labels/label"
Then IMAP response is "OK"
When IMAP client marks message seq "2" as deleted
Then IMAP response is "OK"
And mailbox "<mailbox>" for "user" has 2 messages
And mailbox "All Mail" for "user" has 2 messages
And mailbox "Labels/label" for "user" has 1 messages
When IMAP client sends expunge
Then IMAP response is "OK"
And mailbox "<mailbox>" for "user" has 1 messages
And mailbox "All Mail" for "user" has 2 messages
And mailbox "Labels/label" for "user" has 1 messages
Examples:
| mailbox |
| Spam |
| Trash |
Scenario Outline: Message in Trash/Spam only is permanently deleted
Given there are messages in mailbox "<mailbox>" for "user"
| id | from | to | subject | body |
| 1 | john.doe@mail.com | user@pm.me | foo | hello |
| 2 | jane.doe@mail.com | name@pm.me | bar | world |
And there is IMAP client logged in as "user"
And there is IMAP client selected in "<mailbox>"
When IMAP client marks message seq "2" as deleted
Then IMAP response is "OK"
And mailbox "<mailbox>" for "user" has 2 messages
And mailbox "All Mail" for "user" has 2 messages
When IMAP client sends expunge
Then IMAP response is "OK"
And mailbox "<mailbox>" for "user" has 1 messages
And mailbox "All Mail" for "user" has 1 messages
Examples:
| mailbox |
| Spam |
| Trash |

View File

@ -0,0 +1,47 @@
Feature: IMAP operations with Drafts
Background:
Given there is connected user "user"
And there are messages in mailbox "Drafts" for "user"
| id | from | subject | body |
| msg1 | Lionel Richie <lionel@richie.com> | RE: Hello, is it me you looking for? | Nope |
And there is IMAP client logged in as "user"
And there is IMAP client selected in "Drafts"
Scenario: Draft subject updated locally
Scenario: Draft recipient updated locally
Scenario: Draft body updated locally
@ignore-live
Scenario: Draft subject updated on server side
@ignore-live
Scenario: Draft recipient updated on server side
@ignore-live
Scenario: Draft body and size updated on server side
When IMAP client fetches body of UID "1"
Then IMAP response is "OK"
Then IMAP response contains "Nope"
When IMAP client sends command "UID FETCH 1 RFC822.SIZE"
Then IMAP response is "OK"
Then IMAP response contains "538"
When IMAP client sends command "UID FETCH 1 BODYSTRUCTURE"
Then IMAP response is "OK"
Then IMAP response contains "4 14"
Given the body of draft "msg1" for "user" has changed to "Yes I am"
And the event loop of "user" loops once
And mailbox "Drafts" for "user" has 1 messages
When IMAP client fetches body of UID "2"
Then IMAP response is "OK"
Then IMAP response contains "Yes I am"
Then IMAP response does not contain "Nope"
When IMAP client sends command "UID FETCH 2 RFC822.SIZE"
Then IMAP response is "OK"
Then IMAP response contains "542"
When IMAP client sends command "UID FETCH 2 BODYSTRUCTURE"
Then IMAP response is "OK"
Then IMAP response contains "8 14"

View File

@ -0,0 +1,191 @@
Feature: IMAP fetch messages
Background:
Given there is connected user "user"
And there is "user" with mailbox "Folders/mbox"
Scenario: Fetch of inbox
Given there are 10 messages in mailbox "INBOX" for "user"
And there is IMAP client logged in as "user"
And there is IMAP client selected in "INBOX"
When IMAP client fetches "1:*"
Then IMAP response is "OK"
And IMAP response has 10 messages
Scenario: Fetch of inbox by UID
Given there are 10 messages in mailbox "INBOX" for "user"
And there is IMAP client logged in as "user"
And there is IMAP client selected in "INBOX"
When IMAP client fetches by UID "1:*"
Then IMAP response is "OK"
And IMAP response has 10 messages
Scenario: Fetch first few messages of inbox
Given there are 10 messages in mailbox "INBOX" for "user"
And there is IMAP client logged in as "user"
And there is IMAP client selected in "INBOX"
When IMAP client fetches "1:5"
Then IMAP response is "OK"
And IMAP response has 5 messages
Scenario: Fetch first few messages of inbox by UID
Given there are 10 messages in mailbox "INBOX" for "user"
And there is IMAP client logged in as "user"
And there is IMAP client selected in "INBOX"
When IMAP client fetches by UID "1:5"
Then IMAP response is "OK"
And IMAP response has 5 messages
Scenario: Fetch last few messages of inbox using wildcard
Given there are 10 messages in mailbox "INBOX" for "user"
And there is IMAP client logged in as "user"
And there is IMAP client selected in "INBOX"
When IMAP client fetches "6:*"
Then IMAP response is "OK"
And IMAP response has 5 messages
Scenario: Fetch last few messages of inbox using wildcard by UID
Given there are 10 messages in mailbox "INBOX" for "user"
And there is IMAP client logged in as "user"
And there is IMAP client selected in "INBOX"
When IMAP client fetches by UID "6:*"
Then IMAP response is "OK"
And IMAP response has 5 messages
Scenario: Fetch last message of inbox using wildcard
Given there are 10 messages in mailbox "INBOX" for "user"
And there is IMAP client logged in as "user"
And there is IMAP client selected in "INBOX"
When IMAP client fetches "*"
Then IMAP response is "OK"
And IMAP response has 1 message
Scenario: Fetch last message of inbox using wildcard by UID
Given there are 10 messages in mailbox "INBOX" for "user"
And there is IMAP client logged in as "user"
And there is IMAP client selected in "INBOX"
When IMAP client fetches by UID "*"
Then IMAP response is "OK"
And IMAP response has 1 message
Scenario: Fetch backwards range using wildcard
Given there are 10 messages in mailbox "INBOX" for "user"
And there is IMAP client logged in as "user"
And there is IMAP client selected in "INBOX"
When IMAP client fetches "*:1"
Then IMAP response is "OK"
And IMAP response has 10 messages
Scenario: Fetch backwards range using wildcard by UID
Given there are 10 messages in mailbox "INBOX" for "user"
And there is IMAP client logged in as "user"
And there is IMAP client selected in "INBOX"
When IMAP client fetches by UID "*:1"
Then IMAP response is "OK"
And IMAP response has 10 messages
Scenario: Fetch overshot range using wildcard returns last message
Given there are 10 messages in mailbox "INBOX" for "user"
And there is IMAP client logged in as "user"
And there is IMAP client selected in "INBOX"
When IMAP client fetches "20:*"
Then IMAP response is "OK"
And IMAP response has 1 message
Scenario: Fetch overshot range using wildcard by UID returns last message
Given there are 10 messages in mailbox "INBOX" for "user"
And there is IMAP client logged in as "user"
And there is IMAP client selected in "INBOX"
When IMAP client fetches by UID "20:*"
Then IMAP response is "OK"
And IMAP response has 1 message
Scenario: Fetch of custom mailbox
Given there are 10 messages in mailbox "Folders/mbox" for "user"
And there is IMAP client logged in as "user"
And there is IMAP client selected in "Folders/mbox"
When IMAP client fetches "1:*"
Then IMAP response is "OK"
And IMAP response has 10 messages
# This test is wrong! RFC says it should return "BAD" (GODT-1153).
Scenario Outline: Fetch range of empty mailbox
Given there is IMAP client logged in as "user"
And there is IMAP client selected in "Folders/mbox"
When IMAP client fetches "<range>"
Then IMAP response is "OK"
And IMAP response has 0 messages
When IMAP client fetches by UID "<range>"
Then IMAP response is "OK"
And IMAP response has 0 messages
Examples:
| range |
| 1 |
| 1,5,6 |
| 1:* |
| * |
@ignore-live
Scenario: Fetch of big mailbox
Given there are 100 messages in mailbox "Folders/mbox" for "user"
And there is IMAP client logged in as "user"
And there is IMAP client selected in "Folders/mbox"
When IMAP client fetches "1:*"
Then IMAP response is "OK"
And IMAP response has 100 messages
Scenario: Fetch of big mailbox by UID
Given there are 100 messages in mailbox "Folders/mbox" for "user"
And there is IMAP client logged in as "user"
And there is IMAP client selected in "Folders/mbox"
When IMAP client fetches by UID "1:*"
Then IMAP response is "OK"
And IMAP response has 100 messages
Scenario: Fetch returns also messages that are marked as deleted
Given there are messages in mailbox "Folders/mbox" for "user"
| from | to | subject | body | read | starred | deleted |
| john.doe@mail.com | user@pm.me | foo | hello | false | false | false |
| jane.doe@mail.com | name@pm.me | bar | world | true | true | true |
And there is IMAP client logged in as "user"
And there is IMAP client selected in "Folders/mbox"
When IMAP client fetches "1:*"
Then IMAP response is "OK"
And IMAP response has 2 message
Scenario: Fetch by UID returns also messages that are marked as deleted
Given there are messages in mailbox "Folders/mbox" for "user"
| from | to | subject | body | read | starred | deleted |
| john.doe@mail.com | user@pm.me | foo | hello | false | false | false |
| jane.doe@mail.com | name@pm.me | bar | world | true | true | true |
And there is IMAP client logged in as "user"
And there is IMAP client selected in "Folders/mbox"
When IMAP client fetches by UID "1:*"
Then IMAP response is "OK"
And IMAP response has 2 message
Scenario: Fetch of very old message sent from the moon succeeds with modified date
Given there are messages in mailbox "Folders/mbox" for "user"
| from | to | subject | time |
| john.doe@mail.com | user@pm.me | Very old email | 1969-07-20T00:00:00 |
And there is IMAP client logged in as "user"
And there is IMAP client selected in "Folders/mbox"
When IMAP client sends command "FETCH 1:* rfc822"
Then IMAP response is "OK"
And IMAP response contains "\nDate: Fri, 13 Aug 1982"
And IMAP response contains "\nX-Pm-Date: Thu, 01 Jan 1970"
And IMAP response contains "\nX-Original-Date: Sun, 20 Jul 1969"
# We had bug to incorectly set empty date, so let's make sure
# there is no reference anywhere in the response.
And IMAP response does not contain "\nDate: Thu, 01 Jan 1970"
Scenario: Fetch of message which was deleted without event processed
Given there are 10 messages in mailbox "INBOX" for "user"
And message "5" was deleted forever without event processed for "user"
And there is IMAP client logged in as "user"
And there is IMAP client selected in "INBOX"
When IMAP client fetches bodies "1:*"
Then IMAP response is "NO"
When IMAP client fetches bodies "1:*"
Then IMAP response is "OK"
And IMAP response has 9 messages

View File

@ -0,0 +1,41 @@
Feature: IMAP fetch header of message
Background: Fetch header deterministic content type and boundary
Given there is connected user "user"
And there are messages in mailbox "INBOX" for "user"
| id | from | to | subject | n attachments | content type | body |
| 1 | f@m.co | t@pm.me | A message with attachment | 2 | html | body |
| 2 | f@m.co | t@pm.me | A simple html message | 0 | html | body |
| 3 | f@m.co | t@pm.me | A simple plain message | 0 | plain | body |
# | 4 | f@m.co | t@pm.me | An externally encrypted message | 0 | mixed | body |
# | 5 | f@m.co | t@pm.me | A simple plain message in latin1 | 0 | plain-latin1 | body |
And there is IMAP client logged in as "user"
And there is IMAP client selected in "INBOX"
@ignore-live
Scenario Outline: Fetch header deterministic content type and boundary
Given header is not cached for message "<id>" in "INBOX" for "user"
# First time need to download and cache
When IMAP client fetches header of "<id>"
Then IMAP response is "OK"
And IMAP response contains "Content-Type: <contentType>"
And IMAP response contains "<parameter>"
And header is cached for message "<id>" in "INBOX" for "user"
# Second time it's taken from imap cache
When IMAP client fetches body "<id>"
Then IMAP response is "OK"
And IMAP response contains "Content-Type: <contentType>"
And IMAP response contains "<parameter>"
# Third time header taken from DB
When IMAP client fetches header of "<id>"
Then IMAP response is "OK"
And IMAP response contains "Content-Type: <contentType>"
And IMAP response contains "<parameter>"
Examples:
| id | contentType | parameter |
| 1 | multipart/mixed | boundary=4e07408562bedb8b60ce05c1decfe3ad16b72230967de01f640b7e4729b49fce |
| 2 | text/html | charset=utf-8 |
| 3 | text/plain | charset=utf-8 |

View File

@ -0,0 +1,220 @@
Feature: IMAP import messages
Background:
Given there is connected user "user"
And there is IMAP client logged in as "user"
And there is IMAP client selected in "INBOX"
Scenario: Import message with double charset in content type
When IMAP client imports message to "INBOX"
"""
From: Bridge Test <bridgetest@pm.test>
To: Internal Bridge <bridgetest@protonmail.com>
Subject: Message with double charset in content type
Content-Type: text/plain; charset=utf-8; charset=utf-8
Content-Disposition: inline
Received: by 2002:0:0:0:0:0:0:0 with SMTP id 0123456789abcdef; Wed, 30 Dec 2020 01:23:45 0000
Hello
"""
Then IMAP response is "OK"
# I could not find any RFC why this is not valid. But for now our parser is not able to process it.
@ignore
Scenario: Import message with attachment name encoded by RFC 2047 without quoting
When IMAP client imports message to "INBOX"
"""
From: Bridge Test <bridgetest@pm.test>
To: Internal Bridge <bridgetest@protonmail.com>
Subject: Message with attachment name encoded by RFC 2047 without quoting
Content-type: multipart/mixed; boundary="boundary"
Received: by 2002:0:0:0:0:0:0:0 with SMTP id 0123456789abcdef; Wed, 30 Dec 2020 01:23:45 0000
--boundary
Content-Type: text/plain
Hello
--boundary
Content-Type: application/pdf; name==?US-ASCII?Q?filename?=
Content-Disposition: attachment; filename==?US-ASCII?Q?filename?=
somebytes
--boundary--
"""
Then IMAP response is "OK"
Scenario: Import message as latin1 without content type
When IMAP client imports message to "INBOX" with encoding "latin1"
"""
From: Bridge Test <bridgetest@pm.test>
To: Internal Bridge <bridgetest@protonmail.com>
Subject: Message in latin1 without content type
Content-Disposition: inline
Received: by 2002:0:0:0:0:0:0:0 with SMTP id 0123456789abcdef; Wed, 30 Dec 2020 01:23:45 0000
Hello íááá
"""
Then IMAP response is "OK"
Scenario: Import message as latin1 with content type
When IMAP client imports message to "INBOX" with encoding "latin1"
"""
From: Bridge Test <bridgetest@pm.test>
To: Internal Bridge <bridgetest@protonmail.com>
Subject: Message in latin1 with content type
Content-Disposition: inline
Content-Type: text/plain; charset=latin1
Received: by 2002:0:0:0:0:0:0:0 with SMTP id 0123456789abcdef; Wed, 30 Dec 2020 01:23:45 0000
Hello íááá
"""
Then IMAP response is "OK"
Scenario: Import message as latin1 with wrong content type
When IMAP client imports message to "INBOX" with encoding "latin1"
"""
From: Bridge Test <bridgetest@pm.test>
To: Internal Bridge <bridgetest@protonmail.com>
Subject: Message in latin1 with wrong content type
Content-Disposition: inline
Content-Type: text/plain; charset=KOI8R
Received: by 2002:0:0:0:0:0:0:0 with SMTP id 0123456789abcdef; Wed, 30 Dec 2020 01:23:45 0000
Hello íááá
"""
Then IMAP response is "OK"
Scenario: Import received message to Sent
When IMAP client imports message to "Sent"
"""
From: Foo <foo@example.com>
To: Bridge Test <bridgetest@pm.test>
Subject: Hello
Received: by 2002:0:0:0:0:0:0:0 with SMTP id 0123456789abcdef; Wed, 30 Dec 2020 01:23:45 0000
Hello
"""
Then IMAP response is "OK"
And API mailbox "Sent" for "user" has 0 message
And API mailbox "INBOX" for "user" has 1 message
Scenario: Import non-received message to Inbox
When IMAP client imports message to "INBOX"
"""
From: Foo <foo@example.com>
To: Bridge Test <bridgetest@pm.test>
Subject: Hello
Hello
"""
Then IMAP response is "OK"
And API mailbox "INBOX" for "user" has 0 message
And API mailbox "Sent" for "user" has 1 message
Scenario Outline: Import message without sender
When IMAP client imports message to "<mailbox>"
"""
To: Lionel Richie <lionel@richie.com>
Subject: RE: Hello, is it me you looking for?
Nope.
"""
Then IMAP response is "OK"
And API mailbox "<mailbox>" for "user" has 1 message
Examples:
| mailbox |
| Drafts |
| Archive |
| Sent |
Scenario: Import embedded message
When IMAP client imports message to "INBOX"
"""
From: Foo <foo@example.com>
To: Bridge Test <bridgetest@pm.test>
Subject: Embedded message
Content-Type: multipart/mixed; boundary="boundary"
Received: by 2002:0:0:0:0:0:0:0 with SMTP id 0123456789abcdef; Wed, 30 Dec 2020 01:23:45 0000
This is a multi-part message in MIME format.
--boundary
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
--boundary
Content-Type: message/rfc822; name="embedded.eml"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="embedded.eml"
From: Bar <bar@example.com>
To: Bridge Test <bridgetest@pm.test>
Subject: (No Subject)
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
hello
--boundary--
"""
Then IMAP response is "OK"
# We cannot control internal IDs on live server.
@ignore-live
Scenario: Import existing message
When IMAP client imports message to "INBOX"
"""
From: Foo <foo@example.com>
To: Bridge Test <bridgetest@pm.test>
Subject: Hello
Received: by 2002:0:0:0:0:0:0:0 with SMTP id 0123456789abcdef; Wed, 30 Dec 2020 01:23:45 0000
X-Pm-Internal-Id: 1
Hello
"""
Then IMAP response is "OK \[APPENDUID \d 1\] APPEND completed"
When IMAP client imports message to "INBOX"
"""
From: Foo <foo@example.com>
To: Bridge Test <bridgetest@pm.test>
Subject: Hello
Received: by 2002:0:0:0:0:0:0:0 with SMTP id 0123456789abcdef; Wed, 30 Dec 2020 01:23:45 0000
X-Pm-Internal-Id: 1
Hello
"""
Then IMAP response is "OK \[APPENDUID \d 1\] APPEND completed"
Scenario: Import message to All Mail
When IMAP client imports message to "All Mail"
"""
From: Foo <from1@pm.me>
To: Bridge Test <to1@pm.me>
Subject: subj1
Received: by 2002:0:0:0:0:0:0:0 with SMTP id 0123456789abcdef; Wed, 30 Dec 2020 01:23:45 0000
body1
"""
Then IMAP response is "OK \[APPENDUID \d 1\] APPEND completed"
Then mailbox "Archive" for "user" has messages
| from | to | subject | body
| from1@pm.me | to1@pm.me | subj1 | body1
And API mailbox "Archive" for "user" has 1 message
And mailbox "All Mail" for "user" has messages
| from | to | subject | body
| from1@pm.me | to1@pm.me | subj1 | body1
And API mailbox "All Mail" for "user" has 1 message

View File

@ -0,0 +1,98 @@
Feature: IMAP move messages
Background:
Given there is connected user "user"
And there is "user" with mailbox "Folders/folder"
And there is "user" with mailbox "Labels/label"
And there is "user" with mailbox "Labels/label2"
And there are messages in mailbox "INBOX" for "user"
| from | to | subject | body |
| john.doe@mail.com | user@pm.me | foo | hello |
| jane.doe@mail.com | name@pm.me | bar | world |
And there are messages in mailbox "Sent" for "user"
| from | to | subject | body |
| john.doe@mail.com | user@pm.me | response | hello |
And there are messages in mailbox "Labels/label2" for "user"
| from | to | subject | body |
| john.doe@mail.com | user@pm.me | baz | hello |
And there is IMAP client logged in as "user"
Scenario: Move message from inbox (folder) to folder
Given there is IMAP client selected in "INBOX"
When IMAP client moves message seq "1" to "Folders/folder"
Then IMAP response is "OK"
And mailbox "INBOX" for "user" has messages
| from | to | subject |
| jane.doe@mail.com | name@pm.me | bar |
And mailbox "Folders/folder" for "user" has messages
| from | to | subject |
| john.doe@mail.com | user@pm.me | foo |
And API endpoint "PUT /mail/v4/messages/label" is called
And API endpoint "PUT /mail/v4/messages/unlabel" is not called
Scenario: Move all messages from inbox to folder
Given there is IMAP client selected in "INBOX"
When IMAP client moves message seq "1:*" to "Folders/folder"
Then IMAP response is "OK"
And mailbox "INBOX" for "user" has 0 messages
And mailbox "Folders/folder" for "user" has messages
| from | to | subject |
| john.doe@mail.com | user@pm.me | foo |
| jane.doe@mail.com | name@pm.me | bar |
And API endpoint "PUT /mail/v4/messages/label" is called
And API endpoint "PUT /mail/v4/messages/unlabel" is not called
Scenario: Move message from folder to label (keeps in folder)
Given there is IMAP client selected in "INBOX"
When IMAP client moves message seq "1" to "Labels/label"
Then IMAP response is "OK"
And mailbox "INBOX" for "user" has messages
| from | to | subject |
| john.doe@mail.com | user@pm.me | foo |
| jane.doe@mail.com | name@pm.me | bar |
And mailbox "Labels/label" for "user" has messages
| from | to | subject |
| john.doe@mail.com | user@pm.me | foo |
And API endpoint "PUT /mail/v4/messages/label" is called
And API endpoint "PUT /mail/v4/messages/unlabel" is not called
Scenario: Move message from label to folder
Given there is IMAP client selected in "Labels/label2"
When IMAP client moves message seq "1" to "Folders/folder"
Then IMAP response is "OK"
And mailbox "Labels/label2" for "user" has 0 messages
And mailbox "Folders/folder" for "user" has messages
| from | to | subject |
| john.doe@mail.com | user@pm.me | baz |
And API endpoint "PUT /mail/v4/messages/label" is called
And API endpoint "PUT /mail/v4/messages/unlabel" is called
Scenario: Move message from label to label
Given there is IMAP client selected in "Labels/label2"
When IMAP client moves message seq "1" to "Labels/label"
Then IMAP response is "OK"
And mailbox "Labels/label2" for "user" has 0 messages
And mailbox "Labels/label" for "user" has messages
| from | to | subject |
| john.doe@mail.com | user@pm.me | baz |
And API endpoint "PUT /mail/v4/messages/label" is called
And API endpoint "PUT /mail/v4/messages/unlabel" is called
Scenario: Move message from All Mail is not possible
Given there is IMAP client selected in "All Mail"
When IMAP client moves message seq "1" to "Folders/folder"
Then IMAP response is "NO move from All Mail is not allowed"
And mailbox "All Mail" for "user" has messages
| from | to | subject |
| john.doe@mail.com | user@pm.me | foo |
| jane.doe@mail.com | name@pm.me | bar |
And mailbox "Folders/folder" for "user" has 0 messages
Scenario: Move message from Inbox to Sent is not possible
Given there is IMAP client selected in "INBOX"
When IMAP client moves message seq "1" to "Sent"
Then IMAP response is "move from Inbox to Sent is not allowed"
Scenario: Move message from Sent to Inbox is not possible
Given there is IMAP client selected in "Sent"
When IMAP client moves message seq "1" to "INBOX"
Then IMAP response is "move from Sent to Inbox is not allowed"

View File

@ -0,0 +1,80 @@
# IMAP clients can move message to local folder (setting \Deleted flag)
# and then move it back (IMAP client does not remember the message,
# so instead removing the flag it imports duplicate message).
# Regular IMAP server would keep the message twice and later EXPUNGE would
# not delete the message (EXPUNGE would delete the original message and
# the new duplicate one would stay). Both Bridge and API detects duplicates;
# therefore we need to remove \Deleted flag if IMAP client re-imports.
Feature: IMAP move message out to and back from local folder
Background:
Given there is connected user "user"
Given there is IMAP client logged in as "user"
And there is IMAP client selected in "INBOX"
Scenario: Mark message as deleted and re-append again
When IMAP client imports message to "INBOX"
"""
From: <john.doe@mail.com>
To: <user@pm.me>
Subject: foo
Date: Mon, 02 Jan 2006 15:04:05 +0000
Message-Id: <msgID>
Received: by 2002:0:0:0:0:0:0:0 with SMTP id 0123456789abcdef; Wed, 30 Dec 2020 01:23:45 0000
hello
"""
Then IMAP response is "OK"
When IMAP client marks message seq "1" as deleted
Then IMAP response is "OK"
When IMAP client imports message to "INBOX"
"""
From: <john.doe@mail.com>
To: <user@pm.me>
Subject: foo
Date: Mon, 02 Jan 2006 15:04:05 +0000
Message-Id: <msgID>
Received: by 2002:0:0:0:0:0:0:0 with SMTP id 0123456789abcdef; Wed, 30 Dec 2020 01:23:45 0000
hello
"""
Then IMAP response is "OK"
And mailbox "INBOX" for "user" has 1 message
And mailbox "INBOX" for "user" has messages
| from | to | subject | deleted |
| john.doe@mail.com | user@pm.me | foo | false |
# We cannot control ID generation on API.
@ignore-live
Scenario: Mark internal message as deleted and re-append again
# Each message has different subject so if the ID generations on fake API
# changes, test will fail because not even external ID mechanism will work.
When IMAP client imports message to "INBOX"
"""
From: <john.doe@mail.com>
To: <user@pm.me>
Subject: foo
Date: Mon, 02 Jan 2006 15:04:05 +0000
Received: by 2002:0:0:0:0:0:0:0 with SMTP id 0123456789abcdef; Wed, 30 Dec 2020 01:23:45 0000
hello
"""
Then IMAP response is "OK"
When IMAP client marks message seq "1" as deleted
Then IMAP response is "OK"
# Fake API generates for the first message simple ID 1.
When IMAP client imports message to "INBOX"
"""
From: <john.doe@mail.com>
To: <user@pm.me>
Subject: bar
Date: Mon, 02 Jan 2006 15:04:05 +0000
X-Pm-Internal-Id: 1
Received: by 2002:0:0:0:0:0:0:0 with SMTP id 0123456789abcdef; Wed, 30 Dec 2020 01:23:45 0000
hello
"""
Then IMAP response is "OK"
And mailbox "INBOX" for "user" has 1 message
And mailbox "INBOX" for "user" has messages
| from | to | subject | deleted |
| john.doe@mail.com | user@pm.me | foo | false |

View File

@ -0,0 +1,77 @@
Feature: IMAP move messages by append and delete (without MOVE support, e.g., Outlook)
Background:
Given there is connected user "user"
And there is "user" with mailbox "Folders/mbox"
And there is IMAP client "source" logged in as "user"
And there is IMAP client "target" logged in as "user"
Scenario Outline: Move message from <srcMailbox> to <dstMailbox> by <order>
Given there are messages in mailbox "<srcMailbox>" for "user"
| id | from | to | subject | body |
| 1 | sndr1@pm.me | rcvr1@pm.me | subj1 | body1 |
| 2 | sndr2@pm.me | rcvr2@pm.me | subj2 | body2 |
And there is IMAP client "source" selected in "<srcMailbox>"
And there is IMAP client "target" selected in "<dstMailbox>"
When IMAP clients "source" and "target" move message seq "2" of "user" to "<dstMailbox>" by <order>
Then IMAP response to "source" is "OK"
Then IMAP response to "target" is "OK"
And mailbox "<dstMailbox>" for "user" has 1 messages
And mailbox "<dstMailbox>" for "user" has messages
| from | to | subject |
| sndr2@pm.me | rcvr2@pm.me | subj2 |
And mailbox "<srcMailbox>" for "user" has 1 messages
And mailbox "<srcMailbox>" for "user" has messages
| from | to | subject |
| sndr1@pm.me | rcvr1@pm.me | subj1 |
Examples:
| srcMailbox | dstMailbox | order |
| Trash | INBOX | APPEND DELETE EXPUNGE |
| Spam | INBOX | APPEND DELETE EXPUNGE |
| INBOX | Archive | APPEND DELETE EXPUNGE |
| INBOX | Folders/mbox | APPEND DELETE EXPUNGE |
| INBOX | Spam | APPEND DELETE EXPUNGE |
| INBOX | Trash | APPEND DELETE EXPUNGE |
| Trash | INBOX | DELETE APPEND EXPUNGE |
| Spam | INBOX | DELETE APPEND EXPUNGE |
| INBOX | Archive | DELETE APPEND EXPUNGE |
| INBOX | Folders/mbox | DELETE APPEND EXPUNGE |
| INBOX | Spam | DELETE APPEND EXPUNGE |
| INBOX | Trash | DELETE APPEND EXPUNGE |
| Trash | INBOX | DELETE EXPUNGE APPEND |
| Spam | INBOX | DELETE EXPUNGE APPEND |
| INBOX | Archive | DELETE EXPUNGE APPEND |
| INBOX | Folders/mbox | DELETE EXPUNGE APPEND |
| INBOX | Spam | DELETE EXPUNGE APPEND |
| INBOX | Trash | DELETE EXPUNGE APPEND |
Scenario Outline: Move message from <mailbox> to All Mail by <order>
Given there are messages in mailbox "<mailbox>" for "user"
| id | from | to | subject | body |
| 1 | john.doe@mail.com | user@pm.me | subj1 | body1 |
| 2 | john.doe@mail.com | name@pm.me | subj2 | body2 |
And there is IMAP client "source" selected in "<mailbox>"
And there is IMAP client "target" selected in "All Mail"
When IMAP clients "source" and "target" move message seq "2" of "user" to "All Mail" by <order>
Then IMAP response to "source" is "OK"
Then IMAP response to "target" is "OK"
And mailbox "<mailbox>" for "user" has messages
| from | to | subject |
| john.doe@mail.com | user@pm.me | subj1 |
And mailbox "All Mail" for "user" has messages
| from | to | subject |
| john.doe@mail.com | user@pm.me | subj1 |
| john.doe@mail.com | name@pm.me | subj2 |
Examples:
| mailbox | order |
| INBOX | APPEND DELETE EXPUNGE |
| Archive | APPEND DELETE EXPUNGE |
| Trash | APPEND DELETE EXPUNGE |
| Spam | APPEND DELETE EXPUNGE |
| INBOX | DELETE APPEND EXPUNGE |
| Archive | DELETE APPEND EXPUNGE |
| Trash | DELETE APPEND EXPUNGE |
| Spam | DELETE APPEND EXPUNGE |
| INBOX | DELETE EXPUNGE APPEND |
| Archive | DELETE EXPUNGE APPEND |
| Trash | DELETE EXPUNGE APPEND |
| Spam | DELETE EXPUNGE APPEND |

View File

@ -0,0 +1,90 @@
Feature: IMAP search messages
Background:
Given there is connected user "user"
Given there are messages in mailbox "INBOX" for "user"
| from | to | cc | subject | read | starred | deleted | body |
| john.doe@email.com | user@pm.me | | foo | false | false | false | hello |
| jane.doe@email.com | user@pm.me | name@pm.me | bar | true | true | false | world |
| jane.doe@email.com | name@pm.me | | baz | true | false | true | bye |
And there is IMAP client logged in as "user"
And there is IMAP client selected in "INBOX"
Scenario: Search by Sequence numbers
When IMAP client searches for "1"
Then IMAP response is "OK"
And IMAP response contains "SEARCH 1[^0-9]*$"
Scenario: Search by UID
When IMAP client searches for "UID 2"
Then IMAP response is "OK"
And IMAP response contains "SEARCH 2[^0-9]*$"
Scenario: Search by Sequence numbers and UID
When IMAP client searches for "1 UID 1"
Then IMAP response is "OK"
And IMAP response contains "SEARCH 1[^0-9]*$"
Scenario: Search by Sequence numbers and UID without match
When IMAP client searches for "1 UID 2"
Then IMAP response is "OK"
And IMAP response contains "SEARCH[^0-9]*$"
Scenario: Search by Subject
When IMAP client searches for "SUBJECT foo"
Then IMAP response is "OK"
And IMAP response contains "SEARCH 1[^0-9]*$"
Scenario: Search by From
When IMAP client searches for "FROM jane.doe@email.com"
Then IMAP response is "OK"
And IMAP response contains "SEARCH 2 3[^0-9]*$"
Scenario: Search by To
When IMAP client searches for "TO user@pm.me"
Then IMAP response is "OK"
And IMAP response contains "SEARCH 1 2[^0-9]*$"
Scenario: Search by CC
When IMAP client searches for "CC name@pm.me"
Then IMAP response is "OK"
And IMAP response contains "SEARCH 2[^0-9]*$"
Scenario: Search flagged messages
When IMAP client searches for "FLAGGED"
Then IMAP response is "OK"
And IMAP response contains "SEARCH 2[^0-9]*$"
Scenario: Search not flagged messages
When IMAP client searches for "UNFLAGGED"
Then IMAP response is "OK"
And IMAP response contains "SEARCH 1 3[^0-9]*$"
Scenario: Search seen messages
When IMAP client searches for "SEEN"
Then IMAP response is "OK"
And IMAP response contains "SEARCH 2 3[^0-9]*$"
Scenario: Search unseen messages
When IMAP client searches for "UNSEEN"
Then IMAP response is "OK"
And IMAP response contains "SEARCH 1[^0-9]*$"
Scenario: Search deleted messages
When IMAP client searches for "DELETED"
Then IMAP response is "OK"
And IMAP response contains "SEARCH 3[^0-9]*$"
Scenario: Search undeleted messages
When IMAP client searches for "UNDELETED"
Then IMAP response is "OK"
And IMAP response contains "SEARCH 1 2[^0-9]*$"
Scenario: Search recent messages
When IMAP client searches for "RECENT"
Then IMAP response is "OK"
And IMAP response contains "SEARCH 1 2 3[^0-9]*$"
Scenario: Search by more criterias
When IMAP client searches for "SUBJECT baz TO name@pm.me SEEN UNFLAGGED"
Then IMAP response is "OK"
And IMAP response contains "SEARCH 3[^0-9]*$"

View File

@ -0,0 +1,81 @@
Feature: IMAP update messages
Background:
Given there is connected user "user"
And there are messages in mailbox "INBOX" for "user"
| id | from | to | subject | body | read | starred | deleted |
| 1 | john.doe@mail.com | user@pm.me | foo | hello | false | false | false |
| 2 | jane.doe@mail.com | name@pm.me | bar | world | true | true | false |
And there is IMAP client logged in as "user"
And there is IMAP client selected in "INBOX"
Scenario: Mark message as read
When IMAP client marks message seq "1" as read
Then IMAP response is "OK"
And message "1" in "INBOX" for "user" is marked as read
And message "1" in "INBOX" for "user" is marked as unstarred
Scenario: Mark message as unread
When IMAP client marks message seq "2" as unread
Then IMAP response is "OK"
And message "2" in "INBOX" for "user" is marked as unread
And message "2" in "INBOX" for "user" is marked as starred
Scenario: Mark message as starred
Then message "1" in "INBOX" for "user" is marked as unread
And message "1" in "INBOX" for "user" is marked as unstarred
When IMAP client marks message seq "1" as starred
Then IMAP response is "OK"
And message "1" in "INBOX" for "user" is marked as unread
And message "1" in "INBOX" for "user" is marked as starred
Scenario: Mark message as unstarred
When IMAP client marks message seq "2" as unstarred
Then IMAP response is "OK"
And message "2" in "INBOX" for "user" is marked as read
And message "2" in "INBOX" for "user" is marked as unstarred
Scenario: Mark message as read and starred
When IMAP client marks message seq "1" with "\Seen \Flagged"
Then IMAP response is "OK"
And message "1" in "INBOX" for "user" is marked as read
And message "1" in "INBOX" for "user" is marked as starred
Scenario: Mark message as read only
When IMAP client marks message seq "2" with "\Seen"
Then IMAP response is "OK"
And message "2" in "INBOX" for "user" is marked as read
# Unstarred because we set flags without \Starred.
And message "2" in "INBOX" for "user" is marked as unstarred
Scenario: Mark message as spam only
When IMAP client marks message seq "2" with "Junk"
Then IMAP response is "OK"
# Unread and unstarred because we set flags without \Seen and \Starred.
And message "1" in "Spam" for "user" is marked as unread
And message "1" in "Spam" for "user" is marked as unstarred
Scenario: Mark message as deleted
# Mark message as Starred so we can check that mark as Deleted is not
# tempering with Starred flag
When IMAP client marks message seq "2" as starred
Then IMAP response is "OK"
When IMAP client marks message seq "2" as deleted
Then IMAP response is "OK"
And message "2" in "INBOX" for "user" is marked as read
And message "2" in "INBOX" for "user" is marked as starred
And message "2" in "INBOX" for "user" is marked as deleted
Scenario: Mark message as undeleted
When IMAP client marks message seq "2" as undeleted
Then IMAP response is "OK"
And message "2" in "INBOX" for "user" is marked as read
And message "2" in "INBOX" for "user" is marked as starred
And message "2" in "INBOX" for "user" is marked as undeleted
Scenario: Mark message as deleted only
When IMAP client marks message seq "2" with "\Deleted"
Then IMAP response is "OK"
And message "2" in "INBOX" for "user" is marked as unread
And message "2" in "INBOX" for "user" is marked as unstarred
And message "2" in "INBOX" for "user" is marked as deleted

View File

@ -0,0 +1,62 @@
Feature: IMAP update messages in Spam folder
Background:
Given there is connected user "user"
# Messages are inserted in opposite way to keep increasing ID.
# Sequence numbers are then opposite than listed above.
And there are messages in mailbox "Spam" for "user"
| id | from | to | subject | body | read | starred | deleted |
| 1 | john.doe@mail.com | user@pm.me | foo | hello | false | false | false |
| 2 | jane.doe@mail.com | name@pm.me | bar | world | true | true | false |
And there is IMAP client logged in as "user"
And there is IMAP client selected in "Spam"
Scenario: Mark message as read only
When IMAP client marks message seq "1" with "\Seen"
Then IMAP response is "OK"
And message "1" in "Spam" for "user" is marked as read
And message "1" in "Spam" for "user" is marked as unstarred
And API mailbox "Spam" for "user" has messages
| from | to | subject |
| john.doe@mail.com | user@pm.me | foo |
| jane.doe@mail.com | name@pm.me | bar |
Scenario Outline: Move from Spam to INBOX when client <operation> <flag>
When IMAP client <operation> flags "<flag>" <suffix> message seq "1"
Then IMAP response is "OK"
And mailbox "INBOX" for "user" has 1 messages
And mailbox "INBOX" for "user" has messages
| from | to | subject |
| john.doe@mail.com | user@pm.me | foo |
And mailbox "Spam" for "user" has 1 messages
And mailbox "Spam" for "user" has messages
| from | to | subject |
| jane.doe@mail.com | name@pm.me | bar |
Examples:
| operation | suffix | flag |
| adds | to | nojunk |
| adds | to | NoJunk |
| removes | from | junk |
| removes | from | Junk |
| removes | from | $Junk |
Scenario Outline: Do not move from Archive to INBOX when client <operation> <flag>
Given there are messages in mailbox "Archive" for "user"
| id | from | to | subject | body | read | starred | deleted |
| 1 | john.doe@mail.com | user@pm.me | Archived | hello | false | false | false |
And there is IMAP client selected in "Archive"
When IMAP client <operation> flags "<flag>" <suffix> message seq "1"
Then IMAP response is "OK"
And mailbox "INBOX" for "user" has 0 messages
And mailbox "Archive" for "user" has 1 messages
And mailbox "Archive" for "user" has messages
| from | to | subject |
| john.doe@mail.com | user@pm.me | Archived |
Examples:
| operation | suffix | flag |
| adds | to | nojunk |
| adds | to | NoJunk |
| removes | from | junk |
| removes | from | Junk |
| removes | from | $Junk |

View File

@ -0,0 +1,26 @@
Feature: User agent
Background:
Given there is connected user "user"
Scenario: Get user agent
Given there is IMAP client logged in as "user"
Then API user-agent is "UnknownClient/0.0.1 ([GOOS])"
When IMAP client sends ID with argument:
"""
"name" "Foo" "version" "1.4.0"
"""
Then API user-agent is "Foo/1.4.0 ([GOOS])"
Scenario: Update user agent
Given there is IMAP client logged in as "user"
Then API user-agent is "UnknownClient/0.0.1 ([GOOS])"
When IMAP client sends ID with argument:
"""
"name" "Foo" "version" "1.4.0"
"""
Then API user-agent is "Foo/1.4.0 ([GOOS])"
When IMAP client sends ID with argument:
"""
"name" "Bar" "version" "4.2.0"
"""
Then API user-agent is "Bar/4.2.0 ([GOOS])"

View File

@ -0,0 +1,65 @@
Feature: SMTP auth
Scenario: Ask EHLO
Given there is connected user "user"
When SMTP client sends "EHLO example.com"
Then SMTP response is "OK"
Scenario: Authenticates successfully and EHLO successfully
Given there is connected user "user"
When SMTP client authenticates "user"
Then SMTP response is "OK"
When SMTP client sends "EHLO example.com"
Then SMTP response is "OK"
Scenario: Authenticates with bad password
Given there is connected user "user"
When SMTP client authenticates "user" with bad password
Then SMTP response is "SMTP error: 454 4.7.0 backend/credentials: incorrect password"
Scenario: Authenticates with disconnected user
Given there is disconnected user "user"
When SMTP client authenticates "user"
Then SMTP response is "SMTP error: 454 4.7.0 account is logged out, use the app to login again"
Scenario: Authenticates with no user
When SMTP client authenticates with username "user@pm.me" and password "bridgepassword"
Then SMTP response is "SMTP error: 454 4.7.0 user user@pm.me not found"
Scenario: Authenticates with capital letter
Given there is connected user "userAddressWithCapitalLetter"
When SMTP client authenticates "userAddressWithCapitalLetter"
Then SMTP response is "OK"
Scenario: Authenticates with more addresses - primary one
Given there is connected user "userMoreAddresses"
When SMTP client authenticates "userMoreAddresses" with address "primary"
Then SMTP response is "OK"
Scenario: Authenticates with more addresses - secondary one
Given there is connected user "userMoreAddresses"
When SMTP client authenticates "userMoreAddresses" with address "secondary"
Then SMTP response is "OK"
Scenario: Authenticates with more addresses - disabled address
Given there is connected user "userMoreAddresses"
When SMTP client authenticates "userMoreAddresses" with address "disabled"
Then SMTP response is "SMTP error: 454 4.7.0 user .* not found"
@ignore-live
Scenario: Authenticates with secondary address of account with disabled primary address
Given there is connected user "userDisabledPrimaryAddress"
When SMTP client authenticates "userDisabledPrimaryAddress" with address "secondary"
Then SMTP response is "OK"
Scenario: Authenticates two users
Given there is connected user "user"
And there is connected user "userMoreAddresses"
When SMTP client "smtp1" authenticates "user"
Then SMTP response to "smtp1" is "OK"
When SMTP client "smtp2" authenticates "userMoreAddresses" with address "primary"
Then SMTP response to "smtp2" is "OK"
Scenario: Logs out user
Given there is connected user "user"
When SMTP client logs out
Then SMTP response is "OK"

View File

@ -0,0 +1,90 @@
Feature: SMTP initiation
Scenario: Empty FROM
Given there is connected user "user"
When SMTP client authenticates "user"
Then SMTP response is "OK"
When SMTP client sends "MAIL FROM:<>"
Then SMTP response is "OK"
Scenario: Send without FROM and TO
Given there is connected user "user"
When SMTP client authenticates "user"
Then SMTP response is "OK"
When SMTP client sends "DATA"
Then SMTP response is "SMTP error: 502 5.5.1 Missing RCPT TO command."
Scenario: Reset is the same as without FROM and TO
Given there is connected user "user"
When SMTP client authenticates "user"
Then SMTP response is "OK"
When SMTP client sends "MAIL FROM:<[userAddress]>"
Then SMTP response is "OK"
When SMTP client sends "RCPT TO:<user@pm.me>"
Then SMTP response is "OK"
When SMTP client sends "RSET"
Then SMTP response is "OK"
When SMTP client sends "DATA"
Then SMTP response is "SMTP error: 502 5.5.1 Missing RCPT TO command"
Scenario: Send without FROM
Given there is connected user "user"
When SMTP client authenticates "user"
Then SMTP response is "OK"
When SMTP client sends "RCPT TO:<user@pm.me>"
Then SMTP response is "SMTP error: 502 5.5.1 Missing MAIL FROM command."
Scenario: Send without TO
Given there is connected user "user"
When SMTP client authenticates "user"
Then SMTP response is "OK"
When SMTP client sends "MAIL FROM:<[userAddress]>"
Then SMTP response is "OK"
When SMTP client sends "DATA"
Then SMTP response is "SMTP error: 502 5.5.1 Missing RCPT TO command."
Scenario: Send with empty FROM
Given there is connected user "user"
When SMTP client authenticates "user"
Then SMTP response is "OK"
When SMTP client sends "MAIL FROM:<>"
Then SMTP response is "OK"
When SMTP client sends "RCPT TO:<user@pm.me>"
Then SMTP response is "OK"
When SMTP client sends "DATA"
Then SMTP response is "OK"
When SMTP client sends "hello\r\n."
Then SMTP response is "SMTP error: 554 5.0.0 Error: transaction failed, blame it on the weather: missing return path"
Scenario: Send with empty TO
Given there is connected user "user"
When SMTP client authenticates "user"
Then SMTP response is "OK"
When SMTP client sends "MAIL FROM:<[userAddress]>"
Then SMTP response is "OK"
When SMTP client sends "RCPT TO:<>"
Then SMTP response is "OK"
When SMTP client sends "DATA"
Then SMTP response is "OK"
When SMTP client sends "hello\r\n."
Then SMTP response is "SMTP error: 554 5.0.0 Error: transaction failed, blame it on the weather: missing recipient"
Scenario: Allow BODY parameter of MAIL FROM command
Given there is connected user "user"
When SMTP client authenticates "user"
Then SMTP response is "OK"
When SMTP client sends "MAIL FROM:<[userAddress]> BODY=7BIT"
Then SMTP response is "OK"
Scenario: Allow AUTH parameter of MAIL FROM command
Given there is connected user "user"
When SMTP client authenticates "user"
Then SMTP response is "OK"
When SMTP client sends "MAIL FROM:<[userAddress]> AUTH=<>"
Then SMTP response is "OK"
Scenario: FROM not owned by user
Given there is connected user "user"
When SMTP client authenticates "user"
Then SMTP response is "OK"
When SMTP client sends "MAIL FROM:<user@pm.test>"
Then SMTP response is "SMTP error: 451 4.0.0 backend: invalid return path: not owned by user"

View File

@ -0,0 +1,69 @@
Feature: SMTP with bcc
Background:
Given there is connected user "user"
And there is SMTP client logged in as "user"
Scenario: Send message to address in to and bcc
When SMTP client sends message with bcc "bridgetest2@protonmail.com"
"""
Subject: hello
From: Bridge Test <[userAddress]>
To: Internal Bridge <bridgetest@protonmail.com>
hello
"""
Then SMTP response is "OK"
And mailbox "Sent" for "user" has messages
| from | to | subject |
| [userAddress] | bridgetest@protonmail.com | hello |
And message is sent with API call
"""
{
"Message": {
"Subject": "hello",
"ToList": [
{
"Address": "bridgetest@protonmail.com",
"Name": "Internal Bridge"
}
],
"CCList": [],
"BCCList": [
{
"Address": "bridgetest2@protonmail.com"
}
]
}
}
"""
Scenario: Send message only to bcc
When SMTP client sends message with bcc "bridgetest@protonmail.com"
"""
Subject: hello
From: Bridge Test <[userAddress]>
hello
"""
Then SMTP response is "OK"
And mailbox "Sent" for "user" has messages
| from | to | subject |
| [userAddress] | | hello |
And message is sent with API call
"""
{
"Message": {
"Subject": "hello",
"ToList": [],
"CCList": [],
"BCCList": [
{
"Address": "bridgetest@protonmail.com"
}
]
}
}
"""

View File

@ -0,0 +1,38 @@
Feature: SMTP sending embedded message
Scenario: Send it
Given there is connected user "user"
And there is SMTP client logged in as "user"
When SMTP client sends message
"""
From: Bridge Test <[userAddress]>
To: Internal Bridge <bridgetest@protonmail.com>
Subject: Embedded message
Content-Type: multipart/mixed; boundary="boundary"
This is a multi-part message in MIME format.
--boundary
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
--boundary
Content-Type: message/rfc822; name="embedded.eml"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="embedded.eml"
From: Bar <bar@example.com>
To: Bridge Test <bridgetest@pm.test>
Subject: (No Subject)
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
hello
--boundary--
"""
Then SMTP response is "OK"
And mailbox "Sent" for "user" has messages
| from | to | subject |
| [userAddress] | bridgetest@protonmail.com | Embedded message |

View File

@ -0,0 +1,52 @@
Feature: SMTP wrong messages
Background:
Given there is connected user "user"
And there is SMTP client logged in as "user"
Scenario: Message with attachment and wrong boundaries
When SMTP client sends message
"""
From: Bridge Test <[userAddress]>
To: Internal Bridge <bridgetest@protonmail.com>
Subject: With attachment (wrong boundaries)
Content-Type: multipart/related; boundary=bc5bd30245232f31b6c976adcd59bb0069c9b13f986f9e40c2571bb80aa16606
--bc5bd30245232f31b6c976adcd59bb0069c9b13f986f9e40c2571bb80aa16606
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=utf-8
This is body of mail with attachment
--bc5bd30245232f31b6c976adcd59bb0069c9b13f986f9e40c2571bb80aa16606
Content-Disposition: attachment; filename=outline-light-instagram-48.png
Content-Id: <9114fe6f0adfaf7fdf7a@protonmail.com>
Content-Transfer-Encoding: base64
Content-Type: image/png
iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAALVBMVEUAAAD/////////////////
//////////////////////////////////////+hSKubAAAADnRSTlMAgO8QQM+/IJ9gj1AwcIQd
OXUAAAGdSURBVDjLXJC9SgNBFIVPXDURTYhgIQghINgowyLYCAYtRFAIgtYhpAjYhC0srCRW6YIg
WNpoHVSsg/gEii+Qnfxq4DyDc3cyMfrBwl2+O+fOHTi8p7LS5RUf/9gpMKL7iT9sK47Q95ggpkzv
1cvRcsGYNMYsmP+zKN27NR2vcDyTNVdfkOuuniNPMWafvIbljt+YoMEvW8y7lt+ARwhvrgPjhA0I
BTng7S1GLPlypBvtIBPidY4YBDJFdtnkscQ5JGaGqxC9i7jSDwcwnB8qHWBaQjw1ABI8wYgtVoG6
9pFkH8iZIiJeulFt4JLvJq8I5N2GMWYbHWDWzM3JZTMdeSWla0kW86FcuI0mfStiNKQ/AhEeh8h0
YUTffFwrMTT5oSwdojIQ0UKcocgAKRH1HiqhFQmmJa5qRaYHNbRiSsOgslY0NdixItUTUWlZkedP
HXVyAgAIA1F0wP5btQZPIyTwvAqa/Fl4oacuP+e4XHAjSYpkQkxSiMX+T7FPoZJToSStzED70HCy
KE3NGCg4jJrC6Ti7AFwZLhnW0gMbzFZc0RmmeAAAAABJRU5ErkJggg==
--bc5bd30245232f31b6c976adcd59bb0069c9b13f986f9e40c2571bb80aa16606
"""
Then SMTP response is "SMTP error: 554 5.0.0 Error: transaction failed, blame it on the weather: failed to create new parser: unexpected EOF"
Scenario: Invalid from
When SMTP client sends message
"""
From: Bridge Test <bridgetest@pm.test>
To: Internal Bridge <bridgetest@protonmail.com>
hello
"""
Then SMTP response is "SMTP error: 554 5.0.0 Error: transaction failed, blame it on the weather: backend: invalid email address: not owned by user"

View File

@ -0,0 +1,335 @@
Feature: SMTP sending of HTML messages
Background:
Given there is connected user "user"
And there is SMTP client logged in as "user"
Scenario: HTML message to external account
When SMTP client sends message
"""
From: Bridge Test <[userAddress]>
To: External Bridge <pm.bridge.qa@gmail.com>
Subject: HTML text external
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=utf-8
In-Reply-To: <base64hashOfSomeMessage@protonmail.internalid>
<html><body>This is body of <b>HTML mail</b> without attachment<body></html>
"""
Then SMTP response is "OK"
And mailbox "Sent" for "user" has messages
| from | to | subject |
| [userAddress] | pm.bridge.qa@gmail.com | HTML text external |
And message is sent with API call
"""
{
"Message": {
"Subject": "HTML text external",
"Sender": {
"Name": "Bridge Test"
},
"ToList": [
{
"Address": "pm.bridge.qa@gmail.com",
"Name": "External Bridge"
}
],
"CCList": [],
"BCCList": [],
"MIMEType": "text/html"
}
}
"""
Scenario: HTML message with inline image to external account
When SMTP client sends message
"""
From: Bridge Test <[userAddress]>
To: External Bridge <pm.bridge.qa@gmail.com>
Subject: Html Inline External
Content-Disposition: inline
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0
MIME-Version: 1.0
Content-Language: en-US
Content-Type: multipart/related; boundary="------------61FA22A41A3F46E8E90EF528"
This is a multi-part message in MIME format.
--------------61FA22A41A3F46E8E90EF528
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p><br>
</p>
<p>Behold! An inline <img moz-do-not-send="false"
src="cid:part1.D96BFAE9.E2E1CAE3@protonmail.com" alt=""
width="24" height="24"><br>
</p>
</body>
</html>
--------------61FA22A41A3F46E8E90EF528
Content-Type: image/gif; name="email-action-left.gif"
Content-Transfer-Encoding: base64
Content-ID: <part1.D96BFAE9.E2E1CAE3@protonmail.com>
Content-Disposition: inline; filename="email-action-left.gif"
R0lGODlhGAAYANUAACcsKOHs4kppTH6tgYWxiIq0jTVENpG5lDI/M7bRuEaJSkqOTk2RUU+P
U16lYl+lY2iva262cXS6d3rDfYLNhWeeamKTZGSVZkNbRGqhbOPt4////+7u7qioqFZWVlNT
UyIiIgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAGAAYAAAG
/8CNcLjRJAqVRqNSSGiI0GFgoKhar4NAdHioMhyRCYUyiTgY1cOWUH1ILgIDAGAQXCSPKgHa
XUAyGCCCg4IYGRALCmpCAVUQFgiEkiAIFhBVWhtUDxmRk5IIGXkDRQoMEoGfHpIYEmhGCg4X
nyAdHB+SFw4KRwoRArQdG7eEAhEKSAoTBoIdzs/Cw7iCBhMKSQoUAIJbQ8QgABQKStnbIN1C
3+HjFcrMtdDO6dMg1dcFvsCfwt+CxsgJYs3a10+QLl4aTKGitYpQq1eaFHDyREtQqFGMHEGq
SMkSJi4K/ACiZQiRIihsJL6JM6fOnTwK9kTpYgqMGDJm0JzsNuWKTw0FWdANMYJECRMnW4IA
ADs=
--------------61FA22A41A3F46E8E90EF528--
"""
Then SMTP response is "OK"
And mailbox "Sent" for "user" has messages
| from | to | subject |
| [userAddress] | pm.bridge.qa@gmail.com | Html Inline External |
And message is sent with API call
"""
{
"Message": {
"Subject": "Html Inline External",
"Sender": {
"Name": "Bridge Test"
},
"ToList": [
{
"Address": "pm.bridge.qa@gmail.com",
"Name": "External Bridge"
}
],
"CCList": [],
"BCCList": [],
"MIMEType": "text/html"
}
}
"""
Scenario: HTML message with alternative inline to internal account
When SMTP client sends message
"""
From: Bridge Test <[userAddress]>
To: Internal Bridge <bridgetest@protonmail.com>
Subject: Html Inline Alternative Internal
Content-Disposition: inline
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="------------5A259F4DE164B5ADA313F644"
Content-Language: en-US
This is a multi-part message in MIME format.
--------------5A259F4DE164B5ADA313F644
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Behold! An inline
--------------5A259F4DE164B5ADA313F644
Content-Type: multipart/related; boundary="------------61FA22A41A3F46E8E90EF528"
--------------61FA22A41A3F46E8E90EF528
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p><br>
</p>
<p>Behold! An inline <img moz-do-not-send="false"
src="cid:part1.D96BFAE9.E2E1CAE3@protonmail.com" alt=""
width="24" height="24"><br>
</p>
</body>
</html>
--------------61FA22A41A3F46E8E90EF528
Content-Type: image/gif; name="email-action-left.gif"
Content-Transfer-Encoding: base64
Content-ID: <part1.D96BFAE9.E2E1CAE3@protonmail.com>
Content-Disposition: inline; filename="email-action-left.gif"
R0lGODlhGAAYANUAACcsKOHs4kppTH6tgYWxiIq0jTVENpG5lDI/M7bRuEaJSkqOTk2RUU+P
U16lYl+lY2iva262cXS6d3rDfYLNhWeeamKTZGSVZkNbRGqhbOPt4////+7u7qioqFZWVlNT
UyIiIgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAGAAYAAAG
/8CNcLjRJAqVRqNSSGiI0GFgoKhar4NAdHioMhyRCYUyiTgY1cOWUH1ILgIDAGAQXCSPKgHa
XUAyGCCCg4IYGRALCmpCAVUQFgiEkiAIFhBVWhtUDxmRk5IIGXkDRQoMEoGfHpIYEmhGCg4X
nyAdHB+SFw4KRwoRArQdG7eEAhEKSAoTBoIdzs/Cw7iCBhMKSQoUAIJbQ8QgABQKStnbIN1C
3+HjFcrMtdDO6dMg1dcFvsCfwt+CxsgJYs3a10+QLl4aTKGitYpQq1eaFHDyREtQqFGMHEGq
SMkSJi4K/ACiZQiRIihsJL6JM6fOnTwK9kTpYgqMGDJm0JzsNuWKTw0FWdANMYJECRMnW4IA
ADs=
--------------61FA22A41A3F46E8E90EF528--
--------------5A259F4DE164B5ADA313F644--
"""
Then SMTP response is "OK"
And mailbox "Sent" for "user" has messages
| from | to | subject |
| [userAddress] | bridgetest@protonmail.com | Html Inline Alternative Internal |
And message is sent with API call
"""
{
"Message": {
"Subject": "Html Inline Alternative Internal",
"Sender": {
"Name": "Bridge Test"
},
"ToList": [
{
"Address": "bridgetest@protonmail.com",
"Name": "Internal Bridge"
}
],
"CCList": [],
"BCCList": [],
"MIMEType": "text/html"
}
}
"""
Scenario: HTML message with alternative inline to external account
When SMTP client sends message
"""
From: Bridge Test <[userAddress]>
To: External Bridge <pm.bridge.qa@gmail.com>
Subject: Html Inline Alternative External
Content-Disposition: inline
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="------------5A259F4DE164B5ADA313F644"
Content-Language: en-US
This is a multi-part message in MIME format.
--------------5A259F4DE164B5ADA313F644
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Behold! An inline
--------------5A259F4DE164B5ADA313F644
Content-Type: multipart/related; boundary="------------61FA22A41A3F46E8E90EF528"
--------------61FA22A41A3F46E8E90EF528
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p><br>
</p>
<p>Behold! An inline <img moz-do-not-send="false"
src="cid:part1.D96BFAE9.E2E1CAE3@protonmail.com" alt=""
width="24" height="24"><br>
</p>
</body>
</html>
--------------61FA22A41A3F46E8E90EF528
Content-Type: image/gif; name="email-action-left.gif"
Content-Transfer-Encoding: base64
Content-ID: <part1.D96BFAE9.E2E1CAE3@protonmail.com>
Content-Disposition: inline; filename="email-action-left.gif"
R0lGODlhGAAYANUAACcsKOHs4kppTH6tgYWxiIq0jTVENpG5lDI/M7bRuEaJSkqOTk2RUU+P
U16lYl+lY2iva262cXS6d3rDfYLNhWeeamKTZGSVZkNbRGqhbOPt4////+7u7qioqFZWVlNT
UyIiIgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAGAAYAAAG
/8CNcLjRJAqVRqNSSGiI0GFgoKhar4NAdHioMhyRCYUyiTgY1cOWUH1ILgIDAGAQXCSPKgHa
XUAyGCCCg4IYGRALCmpCAVUQFgiEkiAIFhBVWhtUDxmRk5IIGXkDRQoMEoGfHpIYEmhGCg4X
nyAdHB+SFw4KRwoRArQdG7eEAhEKSAoTBoIdzs/Cw7iCBhMKSQoUAIJbQ8QgABQKStnbIN1C
3+HjFcrMtdDO6dMg1dcFvsCfwt+CxsgJYs3a10+QLl4aTKGitYpQq1eaFHDyREtQqFGMHEGq
SMkSJi4K/ACiZQiRIihsJL6JM6fOnTwK9kTpYgqMGDJm0JzsNuWKTw0FWdANMYJECRMnW4IA
ADs=
--------------61FA22A41A3F46E8E90EF528--
--------------5A259F4DE164B5ADA313F644--
"""
Then SMTP response is "OK"
And mailbox "Sent" for "user" has messages
| from | to | subject |
| [userAddress] | pm.bridge.qa@gmail.com | Html Inline Alternative External |
And message is sent with API call
"""
{
"Message": {
"Subject": "Html Inline Alternative External",
"Sender": {
"Name": "Bridge Test"
},
"ToList": [
{
"Address": "pm.bridge.qa@gmail.com",
"Name": "External Bridge"
}
],
"CCList": [],
"BCCList": [],
"MIMEType": "text/html"
}
}
"""
Scenario: HTML message with extremely long line (greater than default 2000 line limit) to external account
When SMTP client sends message
"""
From: Bridge Test <[userAddress]>
To: External Bridge <pm.bridge.qa@gmail.com>
Subject: HTML text external
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=utf-8
In-Reply-To: <base64hashOfSomeMessage@protonmail.internalid>
<html><body>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa<body></html>
"""
Then SMTP response is "OK"
And mailbox "Sent" for "user" has messages
| from | to | subject |
| [userAddress] | pm.bridge.qa@gmail.com | HTML text external |
And message is sent with API call
"""
{
"Message": {
"Subject": "HTML text external",
"Sender": {
"Name": "Bridge Test"
},
"ToList": [
{
"Address": "pm.bridge.qa@gmail.com",
"Name": "External Bridge"
}
],
"CCList": [],
"BCCList": [],
"MIMEType": "text/html"
}
}
"""

View File

@ -0,0 +1,210 @@
Feature: SMTP sending of HTML messages with attachments
Background:
Given there is connected user "user"
And there is SMTP client logged in as "user"
Scenario: HTML message with attachment to internal account
When SMTP client sends message
"""
From: Bridge Test <[userAddress]>
To: Internal Bridge <bridgetest@protonmail.com>
Subject: HTML with attachment internal
Content-Type: multipart/related; boundary=bc5bd30245232f31b6c976adcd59bb0069c9b13f986f9e40c2571bb80aa16606
--bc5bd30245232f31b6c976adcd59bb0069c9b13f986f9e40c2571bb80aa16606
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=utf-8
<html><body>This is body of <b>HTML mail</b> with attachment<body></html>
--bc5bd30245232f31b6c976adcd59bb0069c9b13f986f9e40c2571bb80aa16606
Content-Disposition: attachment; filename=outline-light-instagram-48.png
Content-Id: <9114fe6f0adfaf7fdf7a@protonmail.com>
Content-Transfer-Encoding: base64
Content-Type: image/png
iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAALVBMVEUAAAD/////////////////
//////////////////////////////////////+hSKubAAAADnRSTlMAgO8QQM+/IJ9gj1AwcIQd
OXUAAAGdSURBVDjLXJC9SgNBFIVPXDURTYhgIQghINgowyLYCAYtRFAIgtYhpAjYhC0srCRW6YIg
WNpoHVSsg/gEii+Qnfxq4DyDc3cyMfrBwl2+O+fOHTi8p7LS5RUf/9gpMKL7iT9sK47Q95ggpkzv
1cvRcsGYNMYsmP+zKN27NR2vcDyTNVdfkOuuniNPMWafvIbljt+YoMEvW8y7lt+ARwhvrgPjhA0I
BTng7S1GLPlypBvtIBPidY4YBDJFdtnkscQ5JGaGqxC9i7jSDwcwnB8qHWBaQjw1ABI8wYgtVoG6
9pFkH8iZIiJeulFt4JLvJq8I5N2GMWYbHWDWzM3JZTMdeSWla0kW86FcuI0mfStiNKQ/AhEeh8h0
YUTffFwrMTT5oSwdojIQ0UKcocgAKRH1HiqhFQmmJa5qRaYHNbRiSsOgslY0NdixItUTUWlZkedP
HXVyAgAIA1F0wP5btQZPIyTwvAqa/Fl4oacuP+e4XHAjSYpkQkxSiMX+T7FPoZJToSStzED70HCy
KE3NGCg4jJrC6Ti7AFwZLhnW0gMbzFZc0RmmeAAAAABJRU5ErkJggg==
--bc5bd30245232f31b6c976adcd59bb0069c9b13f986f9e40c2571bb80aa16606--
"""
Then SMTP response is "OK"
And mailbox "Sent" for "user" has messages
| from | to | subject |
| [userAddress] | bridgetest@protonmail.com | HTML with attachment internal |
And message is sent with API call
"""
{
"Message": {
"Subject": "HTML with attachment internal",
"Sender": {
"Name": "Bridge Test"
},
"ToList": [
{
"Address": "bridgetest@protonmail.com",
"Name": "Internal Bridge"
}
],
"CCList": [],
"BCCList": [],
"MIMEType": "text/html"
}
}
"""
Scenario: HTML message with attachment to external account
When SMTP client sends message
"""
From: Bridge Test <[userAddress]>
To: External Bridge <pm.bridge.qa@gmail.com>
Subject: HTML with attachment external PGP
Content-Type: multipart/mixed; boundary=bc5bd30245232f31b6c976adcd59bb0069c9b13f986f9e40c2571bb80aa16606
--bc5bd30245232f31b6c976adcd59bb0069c9b13f986f9e40c2571bb80aa16606
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=utf-8
<html><body>This is body of <b>HTML mail</b> with attachment<body></html>
--bc5bd30245232f31b6c976adcd59bb0069c9b13f986f9e40c2571bb80aa16606
Content-Disposition: attachment; filename=outline-light-instagram-48.png
Content-Id: <9114fe6f0adfaf7fdf7a@protonmail.com>
Content-Transfer-Encoding: base64
Content-Type: image/png
iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAALVBMVEUAAAD/////////////////
//////////////////////////////////////+hSKubAAAADnRSTlMAgO8QQM+/IJ9gj1AwcIQd
OXUAAAGdSURBVDjLXJC9SgNBFIVPXDURTYhgIQghINgowyLYCAYtRFAIgtYhpAjYhC0srCRW6YIg
WNpoHVSsg/gEii+Qnfxq4DyDc3cyMfrBwl2+O+fOHTi8p7LS5RUf/9gpMKL7iT9sK47Q95ggpkzv
1cvRcsGYNMYsmP+zKN27NR2vcDyTNVdfkOuuniNPMWafvIbljt+YoMEvW8y7lt+ARwhvrgPjhA0I
BTng7S1GLPlypBvtIBPidY4YBDJFdtnkscQ5JGaGqxC9i7jSDwcwnB8qHWBaQjw1ABI8wYgtVoG6
9pFkH8iZIiJeulFt4JLvJq8I5N2GMWYbHWDWzM3JZTMdeSWla0kW86FcuI0mfStiNKQ/AhEeh8h0
YUTffFwrMTT5oSwdojIQ0UKcocgAKRH1HiqhFQmmJa5qRaYHNbRiSsOgslY0NdixItUTUWlZkedP
HXVyAgAIA1F0wP5btQZPIyTwvAqa/Fl4oacuP+e4XHAjSYpkQkxSiMX+T7FPoZJToSStzED70HCy
KE3NGCg4jJrC6Ti7AFwZLhnW0gMbzFZc0RmmeAAAAABJRU5ErkJggg==
--bc5bd30245232f31b6c976adcd59bb0069c9b13f986f9e40c2571bb80aa16606--
"""
Then SMTP response is "OK"
And mailbox "Sent" for "user" has messages
| from | to | subject |
| [userAddress] | pm.bridge.qa@gmail.com | HTML with attachment external PGP |
And message is sent with API call
"""
{
"Message": {
"Subject": "HTML with attachment external PGP",
"Sender": {
"Name": "Bridge Test"
},
"ToList": [
{
"Address": "pm.bridge.qa@gmail.com",
"Name": "External Bridge"
}
],
"CCList": [],
"BCCList": [],
"MIMEType": "text/html"
}
}
"""
Scenario: Alternative plain and HTML message with rfc822 attachment
When SMTP client sends message
"""
From: Bridge Test <[userAddress]>
To: External Bridge <pm.bridge.qa@gmail.com>
Subject: Alternative plain and HTML with rfc822 attachment
Content-Type: multipart/mixed; boundary=main-parts
This is a multipart message in MIME format
--main-parts
Content-Type: multipart/alternative; boundary=alternatives
--alternatives
Content-Type: text/plain
There is an attachment
--alternatives
Content-Type: text/html
<html><body>There <b>is</b> an attachment<body></html>
--alternatives--
--main-parts
Content-Type: message/rfc822
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment
Received: from mx1.opensuse.org (mx1.infra.opensuse.org [192.168.47.95]) by
mailman3.infra.opensuse.org (Postfix) with ESMTP id 38BE2AC3 for
<factory@lists.opensuse.org>; Sun, 11 Jul 2021 19:50:34 +0000 (UTC)
From: "Bob " <Bob@something.net>
Sender: "Bob" <Bob@gmail.com>
To: "opensuse-factory" <opensuse-factory@opensuse.org>
Cc: "Bob" <Bob@something.net>
References: <y6ZUV5yEyOVQHETZRmi1GFe-Xumzct7QcLpGoSsi1MefGaoovfrUqdkmQ5gM6uySZ7JPIJhDkPJFDqHS1fb_mQ==@protonmail.internalid>
Subject: VirtualBox problems with kernel 5.13
Date: Sun, 11 Jul 2021 21:50:25 +0200
Message-ID: <71672e5f-24a2-c79f-03cc-4c923eb1790b@lwfinger.net>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-Mailer: Microsoft Outlook 16.0
List-Unsubscribe: <mailto:factory-leave@lists.opensuse.org>
Content-Language: en-us
List-Help: <mailto:factory-request@lists.opensuse.org?subject=help>
List-Subscribe: <mailto:factory-join@lists.opensuse.org>
Thread-Index: AQFWvbNSAqFOch49YPlLU4eJWPObaQK2iKDq
I am writing this message as openSUSE's maintainer of VirtualBox.
Nearly every update of the Linux kernel to a new 5.X version breaks =
VirtualBox.
Bob
--main-parts--
"""
Then SMTP response is "OK"
And mailbox "Sent" for "user" has messages
| from | to | subject |
| [userAddress] | pm.bridge.qa@gmail.com | Alternative plain and HTML with rfc822 attachment |
And message is sent with API call
"""
{
"Message": {
"Subject": "Alternative plain and HTML with rfc822 attachment",
"Sender": {
"Name": "Bridge Test"
},
"ToList": [
{
"Address": "pm.bridge.qa@gmail.com",
"Name": "External Bridge"
}
],
"CCList": [],
"BCCList": [],
"MIMEType": "text/html"
}
}
"""

View File

@ -0,0 +1,38 @@
Feature: SMTP sending with mixed case address
Background:
Given there is connected user "user"
And there is SMTP client logged in as "user"
Scenario: Mixed sender case in sender address
When SMTP client sends message
"""
From: Bridge Test <[userAddress|capitalize]>
To: Internal Bridge <bridgetest@protonmail.com>
hello
"""
Then SMTP response is "OK"
And mailbox "Sent" for "user" has messages
| from | to | subject |
| [userAddress] | bridgetest@protonmail.com | |
And message is sent with API call
"""
{
"Message": {
"Subject": "",
"Sender": {
"Name": "Bridge Test"
},
"ToList": [
{
"Address": "bridgetest@protonmail.com",
"Name": "Internal Bridge"
}
],
"CCList": [],
"BCCList": [],
"MIMEType": "text/plain"
}
}
"""

View File

@ -0,0 +1,324 @@
Feature: SMTP sending of plain messages
Background:
Given there is connected user "user"
And there is SMTP client logged in as "user"
Scenario: Only from and to headers to internal account
When SMTP client sends message
"""
From: Bridge Test <[userAddress]>
To: Internal Bridge <bridgetest@protonmail.com>
hello
"""
Then SMTP response is "OK"
And mailbox "Sent" for "user" has messages
| from | to | subject |
| [userAddress] | bridgetest@protonmail.com | |
And message is sent with API call
"""
{
"Message": {
"Subject": "",
"Sender": {
"Name": "Bridge Test"
},
"ToList": [
{
"Address": "bridgetest@protonmail.com",
"Name": "Internal Bridge"
}
],
"CCList": [],
"BCCList": [],
"MIMEType": "text/plain"
}
}
"""
Scenario: Only from and to headers to external account
When SMTP client sends message
"""
From: Bridge Test <[userAddress]>
To: External Bridge <pm.bridge.qa@gmail.com>
hello
"""
Then SMTP response is "OK"
And mailbox "Sent" for "user" has messages
| from | to | subject |
| [userAddress] | pm.bridge.qa@gmail.com | |
And message is sent with API call
"""
{
"Message": {
"Subject": "",
"Sender": {
"Name": "Bridge Test"
},
"ToList": [
{
"Address": "pm.bridge.qa@gmail.com",
"Name": "External Bridge"
}
],
"CCList": [],
"BCCList": [],
"MIMEType": "text/plain"
}
}
"""
Scenario: Basic message to internal account
When SMTP client sends message
"""
From: Bridge Test <[userAddress]>
To: Internal Bridge <bridgetest@protonmail.com>
Subject: Plain text internal
Content-Disposition: inline
Content-Type: text/plain; charset=utf-8
This is body of mail 👋
"""
Then SMTP response is "OK"
And mailbox "Sent" for "user" has messages
| from | to | subject |
| [userAddress] | bridgetest@protonmail.com | Plain text internal |
And message is sent with API call
"""
{
"Message": {
"Subject": "Plain text internal",
"Sender": {
"Name": "Bridge Test"
},
"ToList": [
{
"Address": "bridgetest@protonmail.com",
"Name": "Internal Bridge"
}
],
"CCList": [],
"BCCList": [],
"MIMEType": "text/plain"
}
}
"""
Scenario: Basic message to external account
When SMTP client sends message
"""
From: Bridge Test <[userAddress]>
To: External Bridge <pm.bridge.qa@gmail.com>
Subject: Plain text external
Content-Disposition: inline
Content-Type: text/plain; charset=utf-8
This is body of mail 👋
"""
Then SMTP response is "OK"
And mailbox "Sent" for "user" has messages
| from | to | subject |
| [userAddress] | pm.bridge.qa@gmail.com | Plain text external |
And message is sent with API call
"""
{
"Message": {
"Subject": "Plain text external",
"Sender": {
"Name": "Bridge Test"
},
"ToList": [
{
"Address": "pm.bridge.qa@gmail.com",
"Name": "External Bridge"
}
],
"CCList": [],
"BCCList": [],
"MIMEType": "text/plain"
}
}
"""
Scenario: Message without charset is utf8
When SMTP client sends message
"""
From: Bridge Test <[userAddress]>
To: External Bridge <pm.bridge.qa@gmail.com>
Subject: Plain text no charset external
Content-Disposition: inline
Content-Type: text/plain;
This is body of mail without charset. Please assume utf8
"""
Then SMTP response is "OK"
And mailbox "Sent" for "user" has messages
| from | to | subject |
| [userAddress] | pm.bridge.qa@gmail.com | Plain text no charset external |
And message is sent with API call
"""
{
"Message": {
"Subject": "Plain text no charset external",
"Sender": {
"Name": "Bridge Test"
},
"ToList": [
{
"Address": "pm.bridge.qa@gmail.com",
"Name": "External Bridge"
}
],
"CCList": [],
"BCCList": [],
"MIMEType": "text/plain"
}
}
"""
Scenario: Message without charset is base64-encoded latin1
When SMTP client sends message
"""
From: Bridge Test <[userAddress]>
To: External Bridge <pm.bridge.qa@gmail.com>
Subject: Plain text no charset external
Content-Disposition: inline
Content-Type: text/plain;
Content-Transfer-Encoding: base64
dGhpcyBpcyBpbiBsYXRpbjEgYW5kIHRoZXJlIGFyZSBsb3RzIG9mIGVzIHdpdGggYWNjZW50czog
6enp6enp6enp6enp6enp
"""
Then SMTP response is "OK"
And mailbox "Sent" for "user" has messages
| from | to | subject |
| [userAddress] | pm.bridge.qa@gmail.com | Plain text no charset external |
And message is sent with API call
"""
{
"Message": {
"Subject": "Plain text no charset external",
"Sender": {
"Name": "Bridge Test"
},
"ToList": [
{
"Address": "pm.bridge.qa@gmail.com",
"Name": "External Bridge"
}
],
"CCList": [],
"BCCList": [],
"MIMEType": "text/plain"
}
}
"""
Scenario: Message without charset and content is detected as HTML
When SMTP client sends message
"""
From: Bridge Test <[userAddress]>
To: External Bridge <pm.bridge.qa@gmail.com>
Subject: Plain, no charset, no content, external
Content-Disposition: inline
Content-Type: text/plain;
"""
Then SMTP response is "OK"
And mailbox "Sent" for "user" has messages
| from | to | subject |
| [userAddress] | pm.bridge.qa@gmail.com | Plain, no charset, no content, external |
And message is sent with API call
"""
{
"Message": {
"Subject": "Plain, no charset, no content, external",
"Sender": {
"Name": "Bridge Test"
},
"ToList": [
{
"Address": "pm.bridge.qa@gmail.com",
"Name": "External Bridge"
}
],
"CCList": [],
"BCCList": [],
"MIMEType": "text/plain"
}
}
"""
Scenario: RCPT does not contain all CC
When SMTP client sends "MAIL FROM:<[userAddress]>"
Then SMTP response is "OK"
When SMTP client sends "RCPT TO:<bridgetest@protonmail.com>"
Then SMTP response is "OK"
When SMTP client sends "DATA"
Then SMTP response is "OK"
When SMTP client sends
"""
From: Bridge Test <[userAddress]>
To: Internal Bridge <bridgetest@protonmail.com>
CC: Internal Bridge 2 <bridgetest2@protonmail.com>
Content-Type: text/plain
Subject: RCPT-CC test
This is CC missing in RCPT test. Have a nice day!
.
"""
Then SMTP response is "OK"
And mailbox "Sent" for "user" has messages
| from | to | cc | subject |
| [userAddress] | bridgetest@protonmail.com | bridgetest2@protonmail.com | RCPT-CC test |
And message is sent with API call
"""
{
"Message": {
"Subject": "RCPT-CC test",
"Sender": {
"Name": "Bridge Test"
},
"ToList": [
{
"Address": "bridgetest@protonmail.com",
"Name": "Internal Bridge"
}
],
"CCList": [
{
"Address": "bridgetest2@protonmail.com",
"Name": "Internal Bridge 2"
}
],
"BCCList": []
}
}
"""
And packages are sent with API call
"""
{
"Packages":[
{
"Addresses":{
"bridgetest@protonmail.com":{
"Type":1
},
"bridgetest2@protonmail.com":{
"Type":1
}
},
"Type":1,
"MIMEType":"text/plain"
}
]
}
"""

View File

@ -0,0 +1,187 @@
Feature: SMTP sending of plain messages with attachments
Background:
Given there is connected user "user"
And there is SMTP client logged in as "user"
Scenario: Basic message with attachment to internal account
When SMTP client sends message
"""
From: Bridge Test <[userAddress]>
To: Internal Bridge <bridgetest@protonmail.com>
Subject: Plain with attachment
Content-Type: multipart/related; boundary=bc5bd30245232f31b6c976adcd59bb0069c9b13f986f9e40c2571bb80aa16606
--bc5bd30245232f31b6c976adcd59bb0069c9b13f986f9e40c2571bb80aa16606
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=utf-8
This is body of mail with attachment
--bc5bd30245232f31b6c976adcd59bb0069c9b13f986f9e40c2571bb80aa16606
Content-Disposition: attachment; filename=outline-light-instagram-48.png
Content-Id: <9114fe6f0adfaf7fdf7a@protonmail.com>
Content-Transfer-Encoding: base64
Content-Type: image/png
iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAALVBMVEUAAAD/////////////////
//////////////////////////////////////+hSKubAAAADnRSTlMAgO8QQM+/IJ9gj1AwcIQd
OXUAAAGdSURBVDjLXJC9SgNBFIVPXDURTYhgIQghINgowyLYCAYtRFAIgtYhpAjYhC0srCRW6YIg
WNpoHVSsg/gEii+Qnfxq4DyDc3cyMfrBwl2+O+fOHTi8p7LS5RUf/9gpMKL7iT9sK47Q95ggpkzv
1cvRcsGYNMYsmP+zKN27NR2vcDyTNVdfkOuuniNPMWafvIbljt+YoMEvW8y7lt+ARwhvrgPjhA0I
BTng7S1GLPlypBvtIBPidY4YBDJFdtnkscQ5JGaGqxC9i7jSDwcwnB8qHWBaQjw1ABI8wYgtVoG6
9pFkH8iZIiJeulFt4JLvJq8I5N2GMWYbHWDWzM3JZTMdeSWla0kW86FcuI0mfStiNKQ/AhEeh8h0
YUTffFwrMTT5oSwdojIQ0UKcocgAKRH1HiqhFQmmJa5qRaYHNbRiSsOgslY0NdixItUTUWlZkedP
HXVyAgAIA1F0wP5btQZPIyTwvAqa/Fl4oacuP+e4XHAjSYpkQkxSiMX+T7FPoZJToSStzED70HCy
KE3NGCg4jJrC6Ti7AFwZLhnW0gMbzFZc0RmmeAAAAABJRU5ErkJggg==
--bc5bd30245232f31b6c976adcd59bb0069c9b13f986f9e40c2571bb80aa16606--
"""
Then SMTP response is "OK"
And mailbox "Sent" for "user" has messages
| from | to | subject |
| [userAddress] | bridgetest@protonmail.com | Plain with attachment |
And message is sent with API call
"""
{
"Message": {
"Subject": "Plain with attachment",
"Sender": {
"Name": "Bridge Test"
},
"ToList": [
{
"Address": "bridgetest@protonmail.com",
"Name": "Internal Bridge"
}
],
"CCList": [],
"BCCList": [],
"MIMEType": "text/plain"
}
}
"""
Scenario: Plain message with attachment to external account
When SMTP client sends message
"""
From: Bridge Test <[userAddress]>
To: External Bridge <pm.bridge.qa@gmail.com>
Subject: Plain with attachment external
Content-Type: multipart/related; boundary=bc5bd30245232f31b6c976adcd59bb0069c9b13f986f9e40c2571bb80aa16606
--bc5bd30245232f31b6c976adcd59bb0069c9b13f986f9e40c2571bb80aa16606
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=utf-8
This is body of mail with attachment
--bc5bd30245232f31b6c976adcd59bb0069c9b13f986f9e40c2571bb80aa16606
Content-Disposition: attachment; filename=outline-light-instagram-48.png
Content-Id: <9114fe6f0adfaf7fdf7a@protonmail.com>
Content-Transfer-Encoding: base64
Content-Type: image/png
iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAALVBMVEUAAAD/////////////////
//////////////////////////////////////+hSKubAAAADnRSTlMAgO8QQM+/IJ9gj1AwcIQd
OXUAAAGdSURBVDjLXJC9SgNBFIVPXDURTYhgIQghINgowyLYCAYtRFAIgtYhpAjYhC0srCRW6YIg
WNpoHVSsg/gEii+Qnfxq4DyDc3cyMfrBwl2+O+fOHTi8p7LS5RUf/9gpMKL7iT9sK47Q95ggpkzv
1cvRcsGYNMYsmP+zKN27NR2vcDyTNVdfkOuuniNPMWafvIbljt+YoMEvW8y7lt+ARwhvrgPjhA0I
BTng7S1GLPlypBvtIBPidY4YBDJFdtnkscQ5JGaGqxC9i7jSDwcwnB8qHWBaQjw1ABI8wYgtVoG6
9pFkH8iZIiJeulFt4JLvJq8I5N2GMWYbHWDWzM3JZTMdeSWla0kW86FcuI0mfStiNKQ/AhEeh8h0
YUTffFwrMTT5oSwdojIQ0UKcocgAKRH1HiqhFQmmJa5qRaYHNbRiSsOgslY0NdixItUTUWlZkedP
HXVyAgAIA1F0wP5btQZPIyTwvAqa/Fl4oacuP+e4XHAjSYpkQkxSiMX+T7FPoZJToSStzED70HCy
KE3NGCg4jJrC6Ti7AFwZLhnW0gMbzFZc0RmmeAAAAABJRU5ErkJggg==
--bc5bd30245232f31b6c976adcd59bb0069c9b13f986f9e40c2571bb80aa16606--
"""
Then SMTP response is "OK"
And mailbox "Sent" for "user" has messages
| from | to | subject |
| [userAddress] | pm.bridge.qa@gmail.com | Plain with attachment external |
And message is sent with API call
"""
{
"Message": {
"Subject": "Plain with attachment external",
"Sender": {
"Name": "Bridge Test"
},
"ToList": [
{
"Address": "pm.bridge.qa@gmail.com",
"Name": "External Bridge"
}
],
"CCList": [],
"BCCList": [],
"MIMEType": "text/plain"
}
}
"""
Scenario: Plain message with attachment to two external accounts
When SMTP client sends message
"""
From: Bridge Test <[userAddress]>
To: External Bridge 1 <pm.bridge.qa@gmail.com>
CC: External Bridge 2 <bridgeqa@seznam.cz>
Subject: Plain with attachment external PGP and external CC
Content-Type: multipart/mixed; boundary=bc5bd30245232f31b6c976adcd59bb0069c9b13f986f9e40c2571bb80aa16606
--bc5bd30245232f31b6c976adcd59bb0069c9b13f986f9e40c2571bb80aa16606
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=utf-8
This is body of mail with attachment
--bc5bd30245232f31b6c976adcd59bb0069c9b13f986f9e40c2571bb80aa16606
Content-Disposition: attachment; filename=outline-light-instagram-48.png
Content-Id: <9114fe6f0adfaf7fdf7a@protonmail.com>
Content-Transfer-Encoding: base64
Content-Type: image/png
iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAALVBMVEUAAAD/////////////////
//////////////////////////////////////+hSKubAAAADnRSTlMAgO8QQM+/IJ9gj1AwcIQd
OXUAAAGdSURBVDjLXJC9SgNBFIVPXDURTYhgIQghINgowyLYCAYtRFAIgtYhpAjYhC0srCRW6YIg
WNpoHVSsg/gEii+Qnfxq4DyDc3cyMfrBwl2+O+fOHTi8p7LS5RUf/9gpMKL7iT9sK47Q95ggpkzv
1cvRcsGYNMYsmP+zKN27NR2vcDyTNVdfkOuuniNPMWafvIbljt+YoMEvW8y7lt+ARwhvrgPjhA0I
BTng7S1GLPlypBvtIBPidY4YBDJFdtnkscQ5JGaGqxC9i7jSDwcwnB8qHWBaQjw1ABI8wYgtVoG6
9pFkH8iZIiJeulFt4JLvJq8I5N2GMWYbHWDWzM3JZTMdeSWla0kW86FcuI0mfStiNKQ/AhEeh8h0
YUTffFwrMTT5oSwdojIQ0UKcocgAKRH1HiqhFQmmJa5qRaYHNbRiSsOgslY0NdixItUTUWlZkedP
HXVyAgAIA1F0wP5btQZPIyTwvAqa/Fl4oacuP+e4XHAjSYpkQkxSiMX+T7FPoZJToSStzED70HCy
KE3NGCg4jJrC6Ti7AFwZLhnW0gMbzFZc0RmmeAAAAABJRU5ErkJggg==
--bc5bd30245232f31b6c976adcd59bb0069c9b13f986f9e40c2571bb80aa16606--
"""
Then SMTP response is "OK"
And mailbox "Sent" for "user" has messages
| from | to | cc | subject |
| [userAddress] | pm.bridge.qa@gmail.com | bridgeqa@seznam.cz | Plain with attachment external PGP and external CC |
And message is sent with API call
"""
{
"Message": {
"Subject": "Plain with attachment external PGP and external CC",
"Sender": {
"Name": "Bridge Test"
},
"ToList": [
{
"Address": "pm.bridge.qa@gmail.com",
"Name": "External Bridge 1"
}
],
"CCList": [
{
"Address": "bridgeqa@seznam.cz",
"Name": "External Bridge 2"
}
],
"BCCList": [],
"MIMEType": "text/plain"
}
}
"""

View File

@ -0,0 +1,45 @@
Feature: SMTP sending the same message twice
Background:
Given there is connected user "user"
And there is SMTP client logged in as "user"
When SMTP client sends message
"""
From: Bridge Test <[userAddress]>
To: Internal Bridge <bridgetest@protonmail.com>
Subject: Hello
World
"""
Then SMTP response is "OK"
Scenario: The exact same message is not sent twice
When SMTP client sends message
"""
From: Bridge Test <[userAddress]>
To: Internal Bridge <bridgetest@protonmail.com>
Subject: Hello
World
"""
Then SMTP response is "OK"
And mailbox "Sent" for "user" has messages
| from | to | subject |
| [userAddress] | bridgetest@protonmail.com | Hello |
Scenario: Slight change means different message and is sent twice
When SMTP client sends message
"""
From: Bridge Test <[userAddress]>
To: Internal Bridge <bridgetest@protonmail.com>
Subject: Hello.
World
"""
Then SMTP response is "OK"
And mailbox "Sent" for "user" has messages
| from | to | subject |
| [userAddress] | bridgetest@protonmail.com | Hello |
| [userAddress] | bridgetest@protonmail.com | Hello. |

View File

@ -0,0 +1,50 @@
Feature: SMTP sending with APPENDing to Sent
Background:
Given there is connected user "user"
And there is IMAP client logged in as "user"
And there is IMAP client selected in "Sent"
And there is SMTP client logged in as "user"
Scenario: Send message and append to Sent
# First do sending.
When SMTP client sends message
"""
To: Internal Bridge <bridgetest@protonmail.com>
Subject: Manual send and append
Message-ID: bridgemessage42
hello
"""
Then SMTP response is "OK"
And mailbox "Sent" for "user" has 1 messages
And mailbox "Sent" for "user" has messages
| externalid | from | to | subject |
| bridgemessage42 | [userAddress] | bridgetest@protonmail.com | Manual send and append |
And message is sent with API call
"""
{
"Message": {
"Subject": "Manual send and append",
"ExternalID": "bridgemessage42"
}
}
"""
# Then simulate manual append to Sent mailbox - message should be detected as a duplicate.
When IMAP client imports message to "Sent"
"""
To: Internal Bridge <bridgetest@protonmail.com>
Subject: Manual send and append
Message-ID: bridgemessage42
hello
"""
Then IMAP response is "OK"
And mailbox "Sent" for "user" has 1 messages
# Check that the external ID was not lost in the process.
When IMAP client sends command "FETCH 1 body.peek[header]"
Then IMAP response is "OK"
And IMAP response contains "bridgemessage42"

View File

@ -0,0 +1,71 @@
Feature: SMTP sending two messages
Scenario: Send two messages in one connection
Given there is connected user "user"
And there is SMTP client logged in as "user"
When SMTP client sends message
"""
From: Bridge Test <[userAddress]>
To: Internal Bridge <bridgetest@protonmail.com>
hello
"""
Then SMTP response is "OK"
When SMTP client sends message
"""
From: Bridge Test <[userAddress]>
To: Internal Bridge <bridgetest@protonmail.com>
world
"""
Then SMTP response is "OK"
Scenario: Send to two addresses
Given there is connected user "userMoreAddresses"
And there is "userMoreAddresses" in "split" address mode
And there is SMTP client "smtp1" logged in as "userMoreAddresses" with address "primary"
And there is SMTP client "smtp2" logged in as "userMoreAddresses" with address "secondary"
When SMTP client "smtp1" sends message
"""
From: Bridge Test <[userAddress]>
To: Internal Bridge <bridgetest@protonmail.com>
hello
"""
Then SMTP response to "smtp1" is "OK"
When SMTP client "smtp2" sends message
"""
From: Bridge Test <[userAddress]>
To: Internal Bridge <bridgetest@protonmail.com>
world
"""
Then SMTP response to "smtp2" is "OK"
Scenario: Send to two users
Given there is connected user "user"
And there is connected user "userMoreAddresses"
And there is SMTP client "smtp1" logged in as "user"
And there is SMTP client "smtp2" logged in as "userMoreAddresses"
When SMTP client "smtp1" sends message
"""
From: Bridge Test <[userAddress]>
To: Internal Bridge <bridgetest@protonmail.com>
hello
"""
Then SMTP response to "smtp1" is "OK"
When SMTP client "smtp2" sends message
"""
From: Bridge Test <[userAddress]>
To: Internal Bridge <bridgetest@protonmail.com>
world
"""
Then SMTP response to "smtp2" is "OK"

View File

@ -0,0 +1,90 @@
Feature: Start bridge
Scenario: Start with connected user, database file and internet connection
Given there is user "user" which just logged in
And there is database file for "user"
When bridge starts
Then "user" is connected
And "user" has loaded store
And "user" has running event loop
And "user" has non-zero space
Scenario: Start with connected user, database file and no internet connection
Given there is user "user" which just logged in
And there is database file for "user"
And there is no internet connection
When bridge starts
Then "user" is connected
And "user" has loaded store
And "user" has running event loop
And "user" has zero space
Scenario: Start with connected user, no database file and internet connection
Given there is user "user" which just logged in
And there is no database file for "user"
When bridge starts
Then "user" is connected
And "user" has loaded store
And "user" has running event loop
And "user" has non-zero space
Scenario: Start with connected user, no database file and no internet connection
Given there is user "user" which just logged in
And there is no database file for "user"
And there is no internet connection
When bridge starts
Then "user" is connected
And "user" does not have loaded store
And "user" does not have running event loop
And the internet connection is restored
And 5 seconds pass
Then "user" is connected
And "user" has loaded store
And "user" has running event loop
And "user" has non-zero space
Scenario: Start with disconnected user, database file and internet connection
Given there is disconnected user "user"
And there is database file for "user"
When bridge starts
Then "user" is disconnected
And "user" has loaded store
And "user" does not have running event loop
And "user" has zero space
Scenario: Start with disconnected user, database file and no internet connection
Given there is disconnected user "user"
And there is database file for "user"
And there is no internet connection
When bridge starts
Then "user" is disconnected
And "user" has loaded store
And "user" does not have running event loop
And "user" has zero space
Scenario: Start with disconnected user, no database file and internet connection
Given there is disconnected user "user"
And there is no database file for "user"
When bridge starts
Then "user" is disconnected
And "user" does not have loaded store
And "user" does not have running event loop
And "user" has zero space
Scenario: Start with disconnected user, no database file and no internet connection
Given there is disconnected user "user"
And there is no database file for "user"
And there is no internet connection
When bridge starts
Then "user" is disconnected
And "user" does not have loaded store
And "user" does not have running event loop
And "user" has zero space
Scenario: Start with connected user, database file and internet connection, but no write access to credentials
Given there is user "user" which just logged in
And credentials are locked
And there is database file for "user"
When bridge starts
Then "user" is connected
When IMAP client authenticates "user"
Then IMAP response is "NO"

View File

@ -0,0 +1,76 @@
Feature: Address mode
Background:
Given there is connected user "userMoreAddresses"
And there is "userMoreAddresses" with mailbox "Folders/mbox"
And there are messages in mailbox "Folders/mbox" for "userMoreAddresses"
| from | to | subject |
| john.doe@mail.com | [primary] | foo |
| jane.doe@mail.com | [secondary] | bar |
Scenario: All messages in one mailbox with combined mode
Given there is "userMoreAddresses" in "combined" address mode
Then mailbox "Folders/mbox" for address "primary" of "userMoreAddresses" has messages
| from | to | subject |
| john.doe@mail.com | [primary] | foo |
| jane.doe@mail.com | [secondary] | bar |
Scenario: Messages separated in more mailboxes with split mode
Given there is "userMoreAddresses" in "split" address mode
Then mailbox "Folders/mbox" for address "primary" of "userMoreAddresses" has messages
| from | to | subject |
| john.doe@mail.com | [primary] | foo |
And mailbox "Folders/mbox" for address "secondary" of "userMoreAddresses" has messages
| from | to | subject |
| jane.doe@mail.com | [secondary] | bar |
Scenario: Switch address mode from combined to split mode
Given there is "userMoreAddresses" in "combined" address mode
When "userMoreAddresses" changes the address mode
Then last response is "OK"
And "userMoreAddresses" has address mode in "split" mode
And mailbox "Folders/mbox" for address "primary" of "userMoreAddresses" has messages
| from | to | subject |
| john.doe@mail.com | [primary] | foo |
And mailbox "Folders/mbox" for address "secondary" of "userMoreAddresses" has messages
| from | to | subject |
| jane.doe@mail.com | [secondary] | bar |
Scenario: Switch address mode from split to combined mode
Given there is "userMoreAddresses" in "split" address mode
When "userMoreAddresses" changes the address mode
Then last response is "OK"
And "userMoreAddresses" has address mode in "combined" mode
And mailbox "Folders/mbox" for address "primary" of "userMoreAddresses" has messages
| from | to | subject |
| john.doe@mail.com | [primary] | foo |
| jane.doe@mail.com | [secondary] | bar |
Scenario: Make secondary address primary in combined mode
Given there is "userMoreAddresses" in "combined" address mode
Then mailbox "Folders/mbox" for address "primary" of "userMoreAddresses" has messages
| from | to | subject |
| john.doe@mail.com | [primary] | foo |
| jane.doe@mail.com | [secondary] | bar |
When "userMoreAddresses" swaps address "primary" with address "secondary"
And "userMoreAddresses" receives an address event
Then mailbox "Folders/mbox" for address "primary" of "userMoreAddresses" has messages
| from | to | subject |
| john.doe@mail.com | [secondary] | foo |
| jane.doe@mail.com | [primary] | bar |
Scenario: Make secondary address primary in split mode
Given there is "userMoreAddresses" in "split" address mode
Then mailbox "Folders/mbox" for address "primary" of "userMoreAddresses" has messages
| from | to | subject |
| john.doe@mail.com | [primary] | foo |
And mailbox "Folders/mbox" for address "secondary" of "userMoreAddresses" has messages
| from | to | subject |
| jane.doe@mail.com | [secondary] | bar |
When "userMoreAddresses" swaps address "primary" with address "secondary"
And "userMoreAddresses" receives an address event
Then mailbox "Folders/mbox" for address "primary" of "userMoreAddresses" has messages
| from | to | subject |
| jane.doe@mail.com | [primary] | bar |
And mailbox "Folders/mbox" for address "secondary" of "userMoreAddresses" has messages
| from | to | subject |
| john.doe@mail.com | [secondary] | foo |

View File

@ -0,0 +1,45 @@
Feature: Delete user
@ignore-live-auth
Scenario: Deleting connected user
Given there is user "user" which just logged in
When user deletes "user"
Then last response is "OK"
And "user" has database file
@ignore-live-auth
Scenario: Deleting connected user with cache
Given there is user "user" which just logged in
When user deletes "user" with cache
Then last response is "OK"
And "user" does not have database file
@ignore-live-auth
Scenario: Deleting connected user without database file
Given there is user "user" which just logged in
And there is no database file for "user"
When user deletes "user" with cache
Then last response is "OK"
# THIS IS BLOCKED BY ANTI-ABUSE
@ignore-live
Scenario: Deleting disconnected user
Given there is disconnected user "user"
When user deletes "user"
Then last response is "OK"
And "user" has database file
# THIS IS BLOCKED BY ANTI-ABUSE
@ignore-live
Scenario: Deleting disconnected user with cache
Given there is disconnected user "user"
When user deletes "user" with cache
Then last response is "OK"
And "user" does not have database file
# THIS IS BLOCKED BY ANTI-ABUSE
@ignore-live
Scenario: Deleting disconnected user without database file
Given there is disconnected user "user"
And there is no database file for "user"
When user deletes "user" with cache
Then last response is "OK"

View File

@ -0,0 +1,78 @@
Feature: Login for the first time
@ignore-live-auth
Scenario: Normal login
Given there is user "user"
When "user" logs in
Then last response is "OK"
And "user" is connected
And "user" has database file
And "user" has running event loop
And "user" has non-zero space
@ignore-live
Scenario: Login with bad username
When "user" logs in with bad password
Then last response is "failed to login: Incorrect login credentials. Please try again"
@ignore-live
Scenario: Login with bad password
Given there is user "user"
When "user" logs in with bad password
Then last response is "failed to login: Incorrect login credentials. Please try again"
@ignore-live-auth
Scenario: Login without internet connection
Given there is no internet connection
When "user" logs in
Then last response is "failed to login: no internet connection"
@ignore-live
Scenario: Login user with 2FA
Given there is user "user2fa"
When "user2fa" logs in
Then last response is "OK"
And "user2fa" is connected
And "user2fa" has database file
And "user2fa" has running event loop
And "user2fa" has non-zero space
@ignore-live-auth
Scenario: Login user with capital letters in address
Given there is user "userAddressWithCapitalLetter"
When "userAddressWithCapitalLetter" logs in
Then last response is "OK"
And "userAddressWithCapitalLetter" is connected
And "userAddressWithCapitalLetter" has database file
And "userAddressWithCapitalLetter" has running event loop
And "userAddressWithCapitalLetter" has non-zero space
@ignore-live-auth
Scenario: Login user with more addresses
Given there is user "userMoreAddresses"
When "userMoreAddresses" logs in
Then last response is "OK"
And "userMoreAddresses" is connected
And "userMoreAddresses" has database file
And "userMoreAddresses" has running event loop
And "userMoreAddresses" has non-zero space
@ignore-live
Scenario: Login user with disabled primary address
Given there is user "userDisabledPrimaryAddress"
When "userDisabledPrimaryAddress" logs in
Then last response is "OK"
And "userDisabledPrimaryAddress" is connected
And "userDisabledPrimaryAddress" has database file
And "userDisabledPrimaryAddress" has running event loop
And "userDisabledPrimaryAddress" has non-zero space
@ignore-live-auth
Scenario: Login two users
Given there is user "user"
And there is user "userMoreAddresses"
When "user" logs in
Then last response is "OK"
And "user" is connected
When "userMoreAddresses" logs in
Then last response is "OK"
And "userMoreAddresses" is connected

View File

@ -0,0 +1,41 @@
Feature: Re-login
@ignore-live-auth
Scenario: Re-login with connected user and database file
Given there is user "user" which just logged in
And there is database file for "user"
When "user" logs in
Then last response is "failed to finish login: user is already connected"
And "user" is connected
And "user" has running event loop
And "user" has non-zero space
@ignore
Scenario: Re-login with connected user and no database file
Given there is user "user" which just logged in
And there is no database file for "user"
When "user" logs in
Then last response is "failed to finish login: user is already connected"
And "user" is connected
And "user" has database file
And "user" has running event loop
@ignore-live-auth
Scenario: Re-login with disconnected user and database file
Given there is disconnected user "user"
And there is database file for "user"
When "user" logs in
Then last response is "OK"
And "user" is connected
And "user" has running event loop
And "user" has non-zero space
@ignore-live-auth
Scenario: Re-login with disconnected user and no database file
Given there is disconnected user "user"
And there is no database file for "user"
When "user" logs in
Then last response is "OK"
And "user" is connected
And "user" has database file
And "user" has running event loop
And "user" has non-zero space

View File

@ -0,0 +1,17 @@
Feature: Session deleted on API
@ignore-live
Scenario: Session revoked after start
Given there is connected user "user"
When session was revoked for "user"
And the event loop of "user" loops once
Then "user" is disconnected
@ignore-live
Scenario: Starting with revoked session
Given there is user "user" which just logged in
And session was revoked for "user"
When bridge starts
Then "user" is disconnected

View File

@ -0,0 +1,60 @@
Feature: Sync bridge
Background:
Given there is connected user "userMoreAddresses"
And there is "userMoreAddresses" with mailboxes
| Folders/one |
| Folders/two |
| Labels/three |
| Labels/four |
And there are messages for "userMoreAddresses" as follows
| address | mailboxes | messages |
| primary | INBOX,Folders/one | 1 |
| primary | Archive,Labels/three | 2 |
| primary | INBOX | 1000 |
| primary | Archive | 1200 |
| primary | Folders/one | 1400 |
| primary | Folders/two | 1600 |
| primary | Labels/three | 1800 |
| primary | Labels/four | 2000 |
| secondary | INBOX | 100 |
| secondary | Archive | 120 |
| secondary | Folders/one | 140 |
| secondary | Folders/two | 160 |
| secondary | Labels/three | 180 |
| secondary | Labels/four | 200 |
# Too heavy for live.
@ignore-live
Scenario: Sync in combined mode
And there is "userMoreAddresses" in "combined" address mode
When bridge syncs "userMoreAddresses"
Then last response is "OK"
And "userMoreAddresses" has the following messages
| mailboxes | messages |
| INBOX | 1101 |
| Archive | 1322 |
| Folders/one | 1541 |
| Folders/two | 1760 |
| Labels/three | 1982 |
| Labels/four | 2200 |
# Too heavy for live.
@ignore-live
Scenario: Sync in split mode
And there is "userMoreAddresses" in "split" address mode
When bridge syncs "userMoreAddresses"
Then last response is "OK"
And "userMoreAddresses" has the following messages
| address | mailboxes | messages |
| primary | INBOX | 1001 |
| primary | Archive | 1202 |
| primary | Folders/one | 1401 |
| primary | Folders/two | 1600 |
| primary | Labels/three | 1802 |
| primary | Labels/four | 2000 |
| secondary | INBOX | 100 |
| secondary | Archive | 120 |
| secondary | Folders/one | 140 |
| secondary | Folders/two | 160 |
| secondary | Labels/three | 180 |
| secondary | Labels/four | 200 |