2021-09-17 12:07:26 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import { getAllBlocks, switchUserToAdmin } from '@wordpress/e2e-test-utils';
|
|
|
|
|
|
|
|
import { visitBlockPage } from '@woocommerce/blocks-test-utils';
|
|
|
|
|
2022-05-23 12:05:30 +00:00
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
2021-09-17 12:07:26 +00:00
|
|
|
import { insertBlockDontWaitForInsertClose } from '../../utils.js';
|
|
|
|
|
|
|
|
const block = {
|
|
|
|
name: 'Featured Product',
|
|
|
|
slug: 'woocommerce/featured-product',
|
|
|
|
class: '.wc-block-featured-product',
|
|
|
|
};
|
|
|
|
|
|
|
|
describe( `${ block.name } Block`, () => {
|
|
|
|
beforeAll( async () => {
|
|
|
|
await switchUserToAdmin();
|
|
|
|
await visitBlockPage( `${ block.name } Block` );
|
|
|
|
} );
|
|
|
|
|
|
|
|
it( 'can be inserted more than once', async () => {
|
|
|
|
await insertBlockDontWaitForInsertClose( block.name );
|
|
|
|
expect( await getAllBlocks() ).toHaveLength( 2 );
|
|
|
|
} );
|
|
|
|
|
|
|
|
it( 'renders without crashing', async () => {
|
|
|
|
await expect( page ).toRenderBlock( block );
|
|
|
|
} );
|
|
|
|
} );
|