I don't think there's an issue yet, but we do need to learn how to test that a user receives e-mail when requesting a new password, creating an account, etc.

We can test with a feature like:

Feature: Retrieve password
  In order to participate efficiently and not to be a bother to administrators
  As a site user
  I need to be able to automatically retrieve my password if I've forgotten it

  Scenario: User knows user name
    Given I am at "/user"
    And I follow "Request new password"
    When I enter "site user"
    And I press "E-mail new password" 
    Then I should see "Further instructions have been sent to your e-mail address."
    And I should receive an e-mail

I misunderstood some symfony documentation here,
Docs are here: http://docs.behat.org/cookbook/intercepting_the_redirections.html. That dead end means we still need a strategy for testing e-mail functionality.

Comments

halstead’s picture

After reading the documents at the link above it seems we cannot use the Symfony2 profiler until Symfony2 is part of Drupal.

In the future, when the tests are pointed at a server that can send mail, we could test that password resets are working by taking advantage of a public mail receiving service such as Mailinator. The steps would be:

Log in as "User".
Change e-mail address to random-string@mailinator.com.
Log out
Request new password
Wait several seconds
Visit http://mailinator.com/maildir.jsp?email=random-string%40mailinator.com&x=0&y=0
Follow message link
Follow one time reset link
Change e-mail address back to the original.
eliza411’s picture

Title: Learn how to use Symfony WebKit to intercept redirects » Decide how to test e-mail functionality

Updating title

eliza411’s picture

Issue summary: View changes

Retaining spaces with code tag

eliza411’s picture

Component: Feature/Scenarios » Environment setup

This is more about the test environment, methinks.

eliza411’s picture

Version: » 7.x-1.x-dev
Component: Environment setup » Feature/Scenarios
Status: Active » Needs work

A few things that we've realized working on mail tests:

It's totally fine to test mail just to the point where Drupal prints the message that an e-mail has been sent on account creation.

There is only value in testing that mail is sent and received against the production site, as far as I can see, because at that point we're not testing the code base, we're testing the server configuration.

In the process of thinking about this only one test really needs to be added:

Feature: Block anonymous mail services
  In order to prevent boatloads of spam and maintain high-quality content for everyone
  As an anonymous user
  I should not be allowed to sign up for an account using the domain of an anonymous e-mail service
kssundar’s picture

Assigned: Unassigned » sachin2dhoni

I think we can add one or two scenarios related to #6 in user_registration.feature

sachin2dhoni’s picture

Status: Needs work » Needs review
Issue tags: +sprint 19

Added the scenario in user_profile_contact.feature as per comment #7

Please check the commit log
http://drupalcode.org/project/doobie.git/commit/f92be18

eliza411’s picture

Assigned: sachin2dhoni » tvn

I'm not sure that the new test belongs in this feature, but I can see reasons for including it here, too. It just doesn't seem to fit the business value.

tvn, your thoughts?

eliza411’s picture

Status: Needs review » Reviewed & tested by the community

With short deadlines to finish up actual work on tests, I'm going to set this as RTBC. The scenario is fine and functional, and we're just discussing its location.

tvn’s picture

Assigned: tvn » Unassigned

I think this new test belongs to user_registration.feature
http://drupalcode.org/project/doobie.git/blob/HEAD:/features/drupalorg/u...
which is exactly about site behavior when registering new account with different types of emails/names.

pradeeprkara’s picture

eliza411’s picture

Status: Reviewed & tested by the community » Closed (fixed)
eliza411’s picture

Issue summary: View changes

Rewrote feature and noted that we can't use the docs originally proposed.