Skip to content
This repository was archived by the owner on Feb 23, 2024. It is now read-only.

Commit 10aa9c5

Browse files
authored
Product Gallery Large Image: Add E2E test (#10482)
1 parent de5c3e0 commit 10aa9c5

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/**
2+
* External dependencies
3+
*/
4+
import { test, expect } from '@woocommerce/e2e-playwright-utils';
5+
6+
/**
7+
* Internal dependencies
8+
*/
9+
const blockData = {
10+
name: 'woocommerce/product-gallery-large-image',
11+
selectors: {
12+
frontend: {},
13+
editor: {},
14+
},
15+
slug: 'single-product',
16+
productPage: '/product/v-neck-t-shirt/',
17+
};
18+
19+
test.describe( `${ blockData.name }`, () => {
20+
test.beforeEach( async ( { requestUtils, admin, editorUtils } ) => {
21+
await requestUtils.deleteAllTemplates( 'wp_template' );
22+
await requestUtils.deleteAllTemplates( 'wp_template_part' );
23+
await admin.visitSiteEditor( {
24+
postId: `woocommerce/woocommerce//${ blockData.slug }`,
25+
postType: 'wp_template',
26+
} );
27+
await editorUtils.enterEditMode();
28+
} );
29+
30+
test( 'Renders Product Gallery Large Image block on the editor and frontend side', async ( {
31+
page,
32+
editor,
33+
editorUtils,
34+
frontendUtils,
35+
} ) => {
36+
await editor.insertBlock( {
37+
name: 'woocommerce/product-gallery',
38+
} );
39+
40+
const block = await editorUtils.getBlockByName( blockData.name );
41+
42+
await expect( block ).toBeVisible();
43+
44+
await Promise.all( [
45+
editor.saveSiteEditorEntities(),
46+
page.waitForResponse( ( response ) =>
47+
response.url().includes( 'wp-json/wp/v2/templates/' )
48+
),
49+
] );
50+
51+
await page.goto( blockData.productPage, {
52+
waitUntil: 'networkidle',
53+
} );
54+
55+
const blockFrontend = await frontendUtils.getBlockByName(
56+
blockData.name
57+
);
58+
59+
await expect( blockFrontend ).toBeVisible();
60+
} );
61+
} );

0 commit comments

Comments
 (0)