WordPress.org

Make WordPress Core

Ticket #48977: 48977.patch

File 48977.patch, 1.1 KB (added by hideokamoto, 2 years ago)

E2E test code for the ticket

  • tests/e2e/specs/hello.test.js

    diff --git tests/e2e/specs/hello.test.js tests/e2e/specs/hello.test.js
    index 038957883b..7f0114ac1f 100644
     
    1 import { visitAdminPage } from '@wordpress/e2e-test-utils';
     1import { visitAdminPage,createURL } from '@wordpress/e2e-test-utils';
    22
    33describe( 'Hello World', () => {
    44        it( 'Should load properly', async () => {
    describe( 'Hello World', () => { 
    99                expect( nodes.length ).not.toEqual( 0 );
    1010        } );
    1111} );
     12describe( 'Default Contents' , () => {
     13        it( 'Should return HTTP 200 when user goto the "Hello world" post.' , async () => {
     14                const response = await page.goto(createURL( '/' , 'p=1') )
     15                expect( response._status ).toEqual( 200 )
     16        } )
     17        it( 'Should return HTTP 200 when user goto the "Sample Page" page.' , async () => {
     18                const response = await page.goto(createURL( '/' , 'p=2') )
     19                expect( response._status ).toEqual( 200 )
     20        } )
     21        it( 'Should return HTTP 404 when user goto unknown page' , async () => {
     22                const response = await page.goto(createURL( '/' , 'p=404') )
     23                expect( response._status ).toEqual( 404 )
     24        } )
     25} )
     26 No newline at end of file