Files
proton-bridge/test/features/bridge/imap/message/search.feature
2020-08-24 10:11:51 +02:00

83 lines
3.0 KiB
Gherkin

Feature: IMAP search messages
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.
Given there are messages in mailbox "INBOX" for "user"
| from | to | cc | subject | read | starred | body |
| john.doe@email.com | user@pm.me | | foo | false | false | hello |
| jane.doe@email.com | user@pm.me | name@pm.me | bar | true | true | world |
| jane.doe@email.com | name@pm.me | | baz | true | false | 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 3[^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 1 2[^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 2 3[^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 1 2[^0-9]*$"
Scenario: Search unseen messages
When IMAP client searches for "UNSEEN"
Then IMAP response is "OK"
And IMAP response contains "SEARCH 3[^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 1[^0-9]*$"