There is nothing in email standards indicating that the email will show up right away. On a real mail server you could be looking at minutes, hours or even days before the email arrives from a mail server.
For this reason I usually have a mail server setup for test purposes. Look for something like "SMTP server with web interface". The full set up is to have the forgot password service setup to point at my test SMTP mail server. So when you send a 'forgot password' it goes to the backend service. The backend service should be configurable. It will be configured to send the email to the user via my SMTP mail server (rather than a real SMTP mail server). I then configure the test mail server to leave the email in a queue. If the test mail server has a web interface I can get the email (and the link) via the mail server's web interface. I can then launch a new Appium session using the web browser on the device with the link from the email.
The test would be:
- Open Appium instance with the app you are testing
- Go to Forgot Password page
- Enter an email (can be anything because we are using a fake email server, including timestamp@fake.com)
- Open the SMTP mail server web interface with a second Appium instance (or I could use the desktop browser)
- Find the forgot password email (it should be there almost instantly)
- Click the forgot password link in the email
- Reset your password
- Close second Appium instance
- Using first Appium instance, go to Login page and use new password
This tends to be more reliable than using a real mail server. Also the fake SMTP mail servers are REALLY easy to setup. You can have everything running locally.
Darrell