The task contains two part:
- Unit testing
- E2e Testing
Approximate time for completing the task: 2 hours.
Make sure to run your tests before you submit to see that you pass all of them
Before you begin, please read the following:
post-1
post-2
post-3
- We strongly suggest that your implementation should take into account TDD approach.
- Replace duplicate resource definitions with
DRY
* code*DRY
= don't repeat yourself, which just means that code should try to avoid duplications as far as possible
Product requests a new feature called AMY. It intercepts emails coming in and prioritizing them according to a predefined metric.
The developer struggles with the requirements and implementation, so after reading about the TDD approach you suggest that you will translate product's requirements into unit tests.
You wrote the following notes to yourself:
-
Each email coming into the system should have a priority, indicating the index of the message.
-
Index 0 is the most important email
-
N-1 is the least important email
-
You may assume that your inbox might contain up to N emails
-
If another email arrives, when the box is already full, and incoming email's priority is higher than least important email one, than the least important email is dropped and email box is reorganized.
-
Priority is a number in the range [0,1] (including 0 and 1)
-
Email box should be always reorganized according to the priority metric
-
You can calculate the prioiry of an email depending on 3 different characteristics. You are allowed to use the email subject as input.
-
Here are some ideas what might be considered as a good characteristics:
a. Title contains the word "priority:<PRIORITY_LEVEL>". PRIORITY_LEVEL might be one of the following: [low | medium | high]
b. Number of attached files in the email
-
The priority is a weighted sum of the characteristics.
Todo (Each section is dependent on the previous one)
-
Suggest 3 proper characteristics (you can use section 9)
-
Provide a test suite for amy.py
-
The provided test suite didn't help the developer. Use the test suite that you provided and implement AMY
Steps 1-4 do not require any automation - you can do them manually
Steps 5-10 require automation - you should implement this in code
- Open a browser of your choice say Mozilla Firefox
- Navigate to Gmail (https://www.gmail.com)
- Create a gmail account
- Using this account, subscribe to multiple services so that the inbox will be filled with promotion emails.
- Please provide credentials in your solution for this account, so we will be able to access it.
- Login to this Gmail with correct credentials.
- Verify that “Promotion” section is selected.
- If not click on the Primary tab.
- Get the count of the total number of emails in the Primary tab.
- Get the name of the sender and subject of Nth Email of your inbox.
- Write a method to get the name of the sender and subject of email of your inbox.