From 8c905e4f4279fefdbf6928b43d62f4df38170d97 Mon Sep 17 00:00:00 2001 From: Leander Beernaert Date: Mon, 2 Jan 2023 10:53:20 +0100 Subject: [PATCH] GODT-1817: Port missing IMAP create feature test --- tests/_features/imap/message/create.feature | 78 --------------------- tests/features/imap/message/create.feature | 18 +++++ 2 files changed, 18 insertions(+), 78 deletions(-) delete mode 100644 tests/_features/imap/message/create.feature diff --git a/tests/_features/imap/message/create.feature b/tests/_features/imap/message/create.feature deleted file mode 100644 index f3e014ca..00000000 --- a/tests/_features/imap/message/create.feature +++ /dev/null @@ -1,78 +0,0 @@ -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 diff --git a/tests/features/imap/message/create.feature b/tests/features/imap/message/create.feature index 37b07565..733c26c7 100644 --- a/tests/features/imap/message/create.feature +++ b/tests/features/imap/message/create.feature @@ -79,3 +79,21 @@ Feature: IMAP create messages And IMAP client "1" sees the following messages in "All Mail": | from | to | subject | body | | john.doe@email.com | john.doe2@[domain] | foo | bar | + + Scenario: Imports a similar (duplicate) message to sent + When IMAP client "1" appends the following messages to "Sent": + | from | to | subject | body | + | john.doe@email.com | john.doe2@[domain] | foo | bar | + And it succeeds + And IMAP client "1" sees the following messages in "Sent": + | from | to | subject | body | + | john.doe@email.com | john.doe2@[domain] | foo | bar | + And it succeeds + And IMAP client "1" appends the following messages to "Sent": + | from | to | subject | body | + | john.doe@email.com | john.doe2@[domain] | foo | bar | + And it succeeds + And IMAP client "1" sees the following messages in "Sent": + | from | to | subject | body | + | john.doe@email.com | john.doe2@[domain] | foo | bar | + | john.doe@email.com | john.doe2@[domain] | foo | bar |