2020-06-15 14:59:18 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
2021-07-26 14:05:09 +00:00
|
|
|
import { getAllBlocks, switchUserToAdmin } from '@wordpress/e2e-test-utils';
|
2020-06-15 14:59:18 +00:00
|
|
|
import { visitBlockPage } from '@woocommerce/blocks-test-utils';
|
|
|
|
|
2022-05-23 12:05:30 +00:00
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
|
|
|
import { insertBlockDontWaitForInsertClose } from '../../utils.js';
|
|
|
|
|
2020-12-09 16:09:45 +00:00
|
|
|
if ( process.env.WOOCOMMERCE_BLOCKS_PHASE < 3 )
|
2022-05-23 12:05:30 +00:00
|
|
|
// eslint-disable-next-line jest/no-focused-tests, jest/expect-expect
|
2020-06-16 12:18:34 +00:00
|
|
|
test.only( 'skipping all other things', () => {} );
|
|
|
|
|
2020-06-15 14:59:18 +00:00
|
|
|
const block = {
|
|
|
|
name: 'Single Product',
|
|
|
|
slug: 'woocommerce/single-product',
|
|
|
|
class: '.wc-block-single-product',
|
|
|
|
};
|
|
|
|
|
|
|
|
describe( `${ block.name } Block`, () => {
|
|
|
|
beforeAll( async () => {
|
|
|
|
await switchUserToAdmin();
|
|
|
|
await visitBlockPage( `${ block.name } Block` );
|
|
|
|
} );
|
|
|
|
|
|
|
|
it( 'can be inserted more than once', async () => {
|
2021-07-26 14:05:09 +00:00
|
|
|
await insertBlockDontWaitForInsertClose( block.name );
|
2020-06-15 14:59:18 +00:00
|
|
|
expect( await getAllBlocks() ).toHaveLength( 2 );
|
|
|
|
} );
|
|
|
|
|
|
|
|
it( 'renders without crashing', async () => {
|
2020-06-25 13:00:27 +00:00
|
|
|
await expect( page ).toRenderBlock( block );
|
2020-06-15 14:59:18 +00:00
|
|
|
} );
|
|
|
|
} );
|