2020-07-02 10:32:42 +00:00
|
|
|
/**
|
|
|
|
* 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( '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
|
|
|
|
)
|
2020-07-06 18:48:39 +00:00
|
|
|
).toBeGreaterThanOrEqual( 6 ); // Fixture data has three reviews per product.
|
2020-07-02 10:32:42 +00:00
|
|
|
} );
|
|
|
|
} );
|