WordPress.org

Make WordPress Core

Ticket #45165: login-e2e-test.patch

File login-e2e-test.patch, 1.7 KB (added by herregroen, 14 months ago)
  • new file tests/e2e/specs/login.test.js

    commit 9b21e3740b45d96b3df9d1ac9d993236d9c5d4a6
    Author: Herre Groen <herre@yoast.com>
    Date:   Sat Jun 22 10:12:43 2019 +0200
    
        Add e2e tests setup
    
    diff --git a/tests/e2e/specs/login.test.js b/tests/e2e/specs/login.test.js
    new file mode 100644
    index 0000000000..8ee191ee2f
    - +  
     1import { createURL } from '@wordpress/e2e-test-utils';
     2
     3describe( 'The login form', () => {
     4        it( 'Should contain a username input', async () => {
     5                await page.goto( createURL( 'wp-login.php' ) );
     6                const usernameInput = await page.$( 'input[type="text"][name="log"]' );
     7                expect( usernameInput ).not.toBeNull();
     8        } );
     9
     10        it( 'Should contain a password input', async () => {
     11                await page.goto( createURL( 'wp-login.php' ) );
     12                const passwordInput = await page.$( 'input[type="password"][name="pwd"]' );
     13                expect( passwordInput ).not.toBeNull();
     14        } );
     15
     16        it( 'Should contain a submit button', async () => {
     17                await page.goto( createURL( 'wp-login.php' ) );
     18                const submitButton = await page.$( 'input[type="submit"][name="wp-submit"]' );
     19                expect( submitButton ).not.toBeNull();
     20        } );
     21
     22        it( 'Should contain a rememberme checkbox', async () => {
     23                await page.goto( createURL( 'wp-login.php' ) );
     24                const rembembermeCheckbox = await page.$( 'input[type="checkbox"][name="rememberme"]' );
     25                expect( rembembermeCheckbox ).not.toBeNull();
     26        } );
     27
     28        it( 'Should contain a lost your password link', async () => {
     29                await page.goto( createURL( 'wp-login.php' ) );
     30                const lostPasswordUrl = createURL( 'wp-login.php' ) + '?action=lostpassword';
     31                const lostPasswordLink = await page.$( `a[href="${ lostPasswordUrl }"]` );
     32                expect( lostPasswordLink ).not.toBeNull();
     33        } );
     34} );