MDL-29320 admin: Improve test for multiple accounts with same email
[moodle.git] / admin / tests / behat / enable_multiple_accounts_use_same_email.feature
CommitLineData
5a158f82
JP
1@core @core_admin @core_user
2Feature: Allowing multiple accounts to have the same email address
3 In order to manage user accounts
4d08decb 4 As an admin
5a158f82 5 I need to be able to set whether to allow multiple accounts with the same email or not
4d08decb 6
5a158f82 7 Scenario Outline: Create a user with the same email as an existing user
4d08decb 8 Given the following config values are set as admin:
5a158f82
JP
9 | allowaccountssameemail | <allowsameemail> |
10 And the following "users" exist:
11 | username | firstname | lastname | email |
12 | s1 | John | Doe | s1@example.com |
13 When I log in as "admin"
14 And I navigate to "Users > Accounts > Add a new user" in site administration
4d08decb 15 And I set the following fields to these values:
5a158f82
JP
16 | Username | s2 |
17 | First name | Jane |
18 | Surname | Doe |
19 | Email address | <email> |
20 | New password | test |
4d08decb 21 And I press "Create user"
5a158f82 22 Then I should <expect> "This email address is already registered."
4d08decb 23
5a158f82
JP
24 Examples:
25 | allowsameemail | email | expect |
26 | 0 | s1@example.com | see |
27 | 0 | S1@EXAMPLE.COM | see |
28 | 1 | s1@example.com | not see |
29 | 1 | S1@EXAMPLE.COM | not see |
30
31 Scenario Outline: Update a user with the same email as an existing user
4d08decb 32 Given the following config values are set as admin:
5a158f82
JP
33 | allowaccountssameemail | <allowsameemail> |
34 And the following "users" exist:
35 | username | firstname | lastname | email |
36 | s1 | John | Doe | s1@example.com |
37 | s2 | Jane | Doe | s2@example.com |
38 When I log in as "admin"
39 And I navigate to "Users > Accounts > Browse list of users" in site administration
40 And I click on "Edit" "link" in the "Jane Doe" "table_row"
41 And I set the field "Email address" to "<email>"
42 And I press "Update profile"
43 Then I should <expect> "This email address is already registered."
44
45 Examples:
46 | allowsameemail | email | expect |
47 | 0 | s1@example.com | see |
48 | 0 | S1@EXAMPLE.COM | see |
49 | 1 | s1@example.com | not see |
50 | 1 | S1@EXAMPLE.COM | not see |
51 | 0 | S2@EXAMPLE.COM | not see |
52 | 1 | S2@EXAMPLE.COM | not see |
53
54 Scenario Outline: Update own user profile with the same email as an existing user
55 Given the following config values are set as admin:
56 | allowaccountssameemail | <allowsameemail> |
57 And the following "users" exist:
58 | username | firstname | lastname | email |
59 | s1 | John | Doe | s1@example.com |
60 | s2 | Jane | Doe | s2@example.com |
61 When I log in as "s2"
62 And I open my profile in edit mode
63 And I set the field "Email address" to "<email>"
64 And I press "Update profile"
65 Then I should <expect> "This email address is already registered."
66
67 Examples:
68 | allowsameemail | email | expect |
69 | 0 | s1@example.com | see |
70 | 0 | S1@EXAMPLE.COM | see |
71 | 1 | s1@example.com | not see |
72 | 1 | S1@EXAMPLE.COM | not see |
73 | 0 | S2@EXAMPLE.COM | not see |
74 | 1 | S2@EXAMPLE.COM | not see |