PHP Classes

File: tests/e2e/specs/spacex-data.spec.tsx

Recommend this page to a friend!
  Classes of Maniruzzaman Akash   Maniruzzaman WordPress Frontend Editor   tests/e2e/specs/spacex-data.spec.tsx   Download  
File: tests/e2e/specs/spacex-data.spec.tsx
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Maniruzzaman WordPress Frontend Editor
WordPress plugin for visual front-end development
Author: By
Last change:
Date: 8 months ago
Size: 1,431 bytes
 

Contents

Class file image Download
const { clickButton, createNewPost, getEditedPostContent, insertBlock } = require( '@wordpress/e2e-test-utils' ); const blockTitle = 'Spacex Data'; describe( 'Spacex Data block', () => { beforeEach( async () => { jest.setTimeout( 100 * 1000 ); await createNewPost(); } ); it( 'should be able to add the block', async () => { await insertBlock( blockTitle ); const blockContent = await getEditedPostContent(); expect( blockContent ).toMatchSnapshot(); } ); it( 'should display the correct content on the frontend', async () => { await insertBlock( blockTitle ); await clickButton( 'Publish' ); const pageContent = await page.evaluate( () => document.body.innerHTML ); expect( pageContent ).toMatchSnapshot(); } ); it('should change the button colors', async () => { await insertBlock(blockTitle); // Change the button colors await page.evaluate( ( newButtonColorBg, newButtonColorText ) => { wp.data.dispatch( 'core/block-editor' ).updateBlockAttributes( wp.data.select( 'core/block-editor' ).getSelectedBlockClientId(), { buttonColorBg: newButtonColorBg, buttonColorText: newButtonColorText, } ); }, '#ff0000', '#ffffff' ); await clickButton( 'Publish' ); // Get the frontend HTML and compare it against the expected HTML const pageContent = await page.evaluate( () => document.body.innerHTML ); expect( pageContent ).toMatchSnapshot(); }); } );