forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDL-29320 admin: Improve test for multiple accounts with same email
* Use Scenario Outlines * More coverage: - Test for email case-sensitivity - Updating user profile as admin - Updating own user profile
- Loading branch information
1 parent
feb154d
commit 5a158f8
Showing
1 changed file
with
67 additions
and
50 deletions.
There are no files selected for viewing
117 changes: 67 additions & 50 deletions
117
admin/tests/behat/enable_multiple_accounts_use_same_email.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,74 @@ | ||
@core @core_admin | ||
Feature: Enable multiple accounts to have the same email address | ||
In order to have multiple accounts registerd on the system with the same email address | ||
@core @core_admin @core_user | ||
Feature: Allowing multiple accounts to have the same email address | ||
In order to manage user accounts | ||
As an admin | ||
I need to enable multiple accounts to be registered with the same email address and verify it is applied | ||
I need to be able to set whether to allow multiple accounts with the same email or not | ||
|
||
Background: | ||
Given I log in as "admin" | ||
|
||
Scenario: Enable registration of multiple accounts with the same email address | ||
Scenario Outline: Create a user with the same email as an existing user | ||
Given the following config values are set as admin: | ||
| allowaccountssameemail | 1 | | ||
When I navigate to "Users > Accounts > Add a new user" in site administration | ||
And I set the following fields to these values: | ||
| Username | testmultiemailuser1 | | ||
| Choose an authentication method | Manual accounts | | ||
| New password | test@User1 | | ||
| First name | Test | | ||
| Surname | Multi1 | | ||
| Email address | testmultiemailuser@example.com | | ||
And I press "Create user" | ||
And I should see "Test Multi1" | ||
And I press "Add a new user" | ||
| allowaccountssameemail | <allowsameemail> | | ||
And the following "users" exist: | ||
| username | firstname | lastname | email | | ||
| s1 | John | Doe | s1@example.com | | ||
When I log in as "admin" | ||
And I navigate to "Users > Accounts > Add a new user" in site administration | ||
And I set the following fields to these values: | ||
| Username | testmultiemailuser2 | | ||
| Choose an authentication method | Manual accounts | | ||
| New password | test@User2 | | ||
| First name | Test | | ||
| Surname | Multi2 | | ||
| Email address | testmultiemailuser@example.com | | ||
| Username | s2 | | ||
| First name | Jane | | ||
| Surname | Doe | | ||
| Email address | <email> | | ||
| New password | test | | ||
And I press "Create user" | ||
Then I should see "Test Multi2" | ||
And I should not see "This email address is already registered" | ||
Then I should <expect> "This email address is already registered." | ||
|
||
Scenario: Disable registration of multiple accounts with the same email address | ||
Examples: | ||
| allowsameemail | email | expect | | ||
| 0 | s1@example.com | see | | ||
| 0 | S1@EXAMPLE.COM | see | | ||
| 1 | s1@example.com | not see | | ||
| 1 | S1@EXAMPLE.COM | not see | | ||
|
||
Scenario Outline: Update a user with the same email as an existing user | ||
Given the following config values are set as admin: | ||
| allowaccountssameemail | 0 | | ||
When I navigate to "Users > Accounts > Add a new user" in site administration | ||
And I set the following fields to these values: | ||
| Username | testmultiemailuser1 | | ||
| Choose an authentication method | Manual accounts | | ||
| New password | test@User1 | | ||
| First name | Test | | ||
| Surname | Multi1 | | ||
| Email address | testmultiemailuser@example.com | | ||
And I press "Create user" | ||
And I should see "Test Multi1" | ||
And I press "Add a new user" | ||
And I set the following fields to these values: | ||
| Username | testmultiemailuser2 | | ||
| Choose an authentication method | Manual accounts | | ||
| New password | test@User2 | | ||
| First name | Test | | ||
| Surname | Multi2 | | ||
| Email address | testmultiemailuser@example.com | | ||
And I press "Create user" | ||
Then I should see "This email address is already registered" | ||
| allowaccountssameemail | <allowsameemail> | | ||
And the following "users" exist: | ||
| username | firstname | lastname | email | | ||
| s1 | John | Doe | s1@example.com | | ||
| s2 | Jane | Doe | s2@example.com | | ||
When I log in as "admin" | ||
And I navigate to "Users > Accounts > Browse list of users" in site administration | ||
And I click on "Edit" "link" in the "Jane Doe" "table_row" | ||
And I set the field "Email address" to "<email>" | ||
And I press "Update profile" | ||
Then I should <expect> "This email address is already registered." | ||
|
||
Examples: | ||
| allowsameemail | email | expect | | ||
| 0 | s1@example.com | see | | ||
| 0 | S1@EXAMPLE.COM | see | | ||
| 1 | s1@example.com | not see | | ||
| 1 | S1@EXAMPLE.COM | not see | | ||
| 0 | S2@EXAMPLE.COM | not see | | ||
| 1 | S2@EXAMPLE.COM | not see | | ||
|
||
Scenario Outline: Update own user profile with the same email as an existing user | ||
Given the following config values are set as admin: | ||
| allowaccountssameemail | <allowsameemail> | | ||
And the following "users" exist: | ||
| username | firstname | lastname | email | | ||
| s1 | John | Doe | s1@example.com | | ||
| s2 | Jane | Doe | s2@example.com | | ||
When I log in as "s2" | ||
And I open my profile in edit mode | ||
And I set the field "Email address" to "<email>" | ||
And I press "Update profile" | ||
Then I should <expect> "This email address is already registered." | ||
|
||
Examples: | ||
| allowsameemail | email | expect | | ||
| 0 | s1@example.com | see | | ||
| 0 | S1@EXAMPLE.COM | see | | ||
| 1 | s1@example.com | not see | | ||
| 1 | S1@EXAMPLE.COM | not see | | ||
| 0 | S2@EXAMPLE.COM | not see | | ||
| 1 | S2@EXAMPLE.COM | not see | |