diff --git a/tests/e2e/specs/profile/username.test.js b/tests/e2e/specs/profile/username.test.js
new file mode 100644
index 000000000000..4ce1afcce03c
-
|
+
|
|
| 1 | import { |
| 2 | visitAdminPage, |
| 3 | createUser, |
| 4 | } from '@wordpress/e2e-test-utils'; |
| 5 | |
| 6 | describe( 'User Profile', () => { |
| 7 | it( 'Should not allow new user username as the email address of another profile', async () => { |
| 8 | |
| 9 | // Creates a user `user1@example.com`. |
| 10 | await createUser('user1'); |
| 11 | |
| 12 | await visitAdminPage('user-new.php'); |
| 13 | await page.waitForSelector('#user_login', { |
| 14 | visible: true |
| 15 | }); |
| 16 | await page.$eval('#user_login', (el, value) => el.value = value, 'user1@example.com'); |
| 17 | await page.$eval('#email', (el, value) => el.value = value, 'user2@example.com'); |
| 18 | |
| 19 | await page.click('#send_user_notification'); |
| 20 | |
| 21 | await Promise.all([page.click('#createusersub'), page.waitForNavigation({ |
| 22 | waitUntil: 'networkidle0' |
| 23 | })]); |
| 24 | |
| 25 | let adminNoticeErrors = await page.waitForSelector('.error'); |
| 26 | |
| 27 | expect( |
| 28 | await adminNoticeErrors.evaluate((element) => element.textContent) |
| 29 | ).toContain('This username is not available. Please choose another one.'); |
| 30 | } ); |
| 31 | } ); |