mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
Modifies the cache control headers tests to prevent 404 errors for each of the tests. Props costdev. Fixes #58777. git-svn-id: https://develop.svn.wordpress.org/trunk@56197 602fd350-edb4-49c9-b593-d223f7449a82
39 lines
1.1 KiB
JavaScript
39 lines
1.1 KiB
JavaScript
import {
|
|
visitAdminPage,
|
|
createNewPost,
|
|
publishPost,
|
|
trashAllPosts,
|
|
createURL,
|
|
logout,
|
|
} from "@wordpress/e2e-test-utils";
|
|
|
|
describe( 'Cache Control header directives', () => {
|
|
|
|
beforeEach( async () => {
|
|
await trashAllPosts();
|
|
} );
|
|
|
|
it( 'No private directive present in cache control when user not logged in.', async () => {
|
|
await createNewPost( { title: 'Hello World' } );
|
|
await publishPost();
|
|
await logout();
|
|
|
|
const response = await page.goto( createURL( '/hello-world/' ) );
|
|
const responseHeaders = response.headers();
|
|
|
|
expect( responseHeaders ).toEqual( expect.not.objectContaining( { "cache-control": "no-store" } ) );
|
|
expect( responseHeaders ).toEqual( expect.not.objectContaining( { "cache-control": "private" } ) );
|
|
} );
|
|
|
|
it( 'Private directive header present in cache control when logged in.', async () => {
|
|
await visitAdminPage( '/' );
|
|
|
|
const response = await page.goto( createURL( '/wp-admin' ) );
|
|
const responseHeaders = response.headers();
|
|
|
|
expect( responseHeaders[ 'cache-control' ] ).toContain( 'no-store' );
|
|
expect( responseHeaders[ 'cache-control' ] ).toContain( 'private' );
|
|
} );
|
|
|
|
} );
|