Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Scenarios that requires the creation of an account where the email confirmation is required does not deletes the user after the test was executed.
Scenario: Register an account
Given I am an anonymous user
Given I am at "/"
When I click "Log in"
And I click "Create new account"
And I enter "email@test.com" for "Email address"
And I enter "myuser" for "Username"
And I press "Create new account"
Then I should see the text "A welcome message with further instructions has been sent to your email address."
Comments
Comment #2
jcandan CreditAttribution: jcandan commentedI can confirm this is an issue for me as well.
[edit]
I just realized that we're not using DrupalExtension to create the user, but instead simply filling out and submitting a form. Of course it wouldn't delete the user, right? Think we need to go another route on this, no?
Comment #3
jcandan CreditAttribution: jcandan at Code Journeymen commentedSee the related issue (#2304315) for the solution.
[edit]
I spoke too soon. Didn't think through this enough. In our case, we want to ensure a specific success message after the registration form is submitted, to ensure that the email confirmation is required. I'll be back with a solution for that. Something to the effect of checking the associated site settings variable.
Comment #4
jcandan CreditAttribution: jcandan at Code Journeymen commentedThanks to the comment of @larowlan at https://www.metaltoad.com/blog/what-i-learned-today-drupal-behat-scenari..., I was able to put together a solution.
And now you can include a "Given I intend to create a user named "myuser", Example:
Basically, by letting behat know what user you intend to create, it can go back and remove it after the scenario is complete.