woocommerce/plugins/woocommerce-blocks/tests/e2e-jest/specs/backend/all-reviews.test.js

36 lines
906 B
JavaScript

/**
* External dependencies
*/
import { switchUserToAdmin } from '@wordpress/e2e-test-utils';
import { visitBlockPage } from '@woocommerce/blocks-test-utils';
const block = {
name: 'All Reviews',
slug: 'woocommerce/all-reviews',
class: '.wc-block-all-reviews',
};
describe( `${ block.name } Block`, () => {
beforeAll( async () => {
await switchUserToAdmin();
await visitBlockPage( `${ block.name } Block` );
} );
it( 'renders without crashing', async () => {
await expect( page ).toRenderBlock( block );
} );
it.skip( 'shows reviews', async () => {
await page.waitForSelector(
'.wc-block-review-list .wc-block-review-list-item__item:not(.is-loading)'
);
expect(
await page.$$eval(
'.wc-block-review-list .wc-block-review-list-item__item',
( reviews ) => reviews.length
)
).toBeGreaterThanOrEqual( 6 ); // Fixture data has three reviews per product.
} );
} );