Blocks E2E: Fix flaky block insertion tests (#47213)

This commit is contained in:
Bart Kalisz 2024-05-08 10:13:30 +02:00 committed by GitHub
parent 2296e45d33
commit 2936c4eac8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 12 additions and 74 deletions

View File

@ -25,24 +25,6 @@ test.describe( `${ blockData.slug } Block`, () => {
); );
} ); } );
test( 'block should be already added in the Product Catalog Template', async ( {
editorUtils,
admin,
} ) => {
await admin.visitSiteEditor( {
postId: 'woocommerce/woocommerce//archive-product',
postType: 'wp_template',
} );
await editorUtils.enterEditMode();
const alreadyPresentBlock = await editorUtils.getBlockByName(
blockData.slug
);
await expect( alreadyPresentBlock ).toHaveText(
'Breadcrumbs / Navigation / Path'
);
} );
test( 'block can be inserted in the Site Editor', async ( { test( 'block can be inserted in the Site Editor', async ( {
admin, admin,
requestUtils, requestUtils,
@ -58,9 +40,10 @@ test.describe( `${ blockData.slug } Block`, () => {
await admin.visitSiteEditor( { await admin.visitSiteEditor( {
postId: template.id, postId: template.id,
postType: 'wp_template', postType: 'wp_template',
canvas: 'edit',
} ); } );
await editorUtils.enterEditMode(); await expect( editor.canvas.getByText( 'howdy' ) ).toBeVisible();
await editor.insertBlock( { await editor.insertBlock( {
name: blockData.slug, name: blockData.slug,

View File

@ -22,22 +22,6 @@ test.describe( `${ blockData.slug } Block`, () => {
); );
} ); } );
test( 'block should be already added in the Product Catalog Template', async ( {
editorUtils,
admin,
} ) => {
await admin.visitSiteEditor( {
postId: 'woocommerce/woocommerce//archive-product',
postType: 'wp_template',
} );
await editorUtils.enterEditMode();
const alreadyPresentBlock = await editorUtils.getBlockByName(
blockData.slug
);
await expect( alreadyPresentBlock ).toHaveText( 'Default sorting' );
} );
test( 'block can be inserted in the Site Editor', async ( { test( 'block can be inserted in the Site Editor', async ( {
admin, admin,
requestUtils, requestUtils,
@ -53,9 +37,10 @@ test.describe( `${ blockData.slug } Block`, () => {
await admin.visitSiteEditor( { await admin.visitSiteEditor( {
postId: template.id, postId: template.id,
postType: 'wp_template', postType: 'wp_template',
canvas: 'edit',
} ); } );
await editorUtils.enterEditMode(); await expect( editor.canvas.getByText( 'howdy' ) ).toBeVisible();
await editor.insertBlock( { await editor.insertBlock( {
name: blockData.slug, name: blockData.slug,

View File

@ -22,24 +22,6 @@ test.describe( `${ blockData.slug } Block`, () => {
); );
} ); } );
test( 'block should be already added in the Product Catalog Template', async ( {
editorUtils,
admin,
} ) => {
await admin.visitSiteEditor( {
postId: 'woocommerce/woocommerce//archive-product',
postType: 'wp_template',
} );
await editorUtils.enterEditMode();
const alreadyPresentBlock = await editorUtils.getBlockByName(
blockData.slug
);
await expect( alreadyPresentBlock ).toHaveText(
'Showing 1-X of X results'
);
} );
test( 'block can be inserted in the Site Editor', async ( { test( 'block can be inserted in the Site Editor', async ( {
admin, admin,
requestUtils, requestUtils,
@ -55,9 +37,10 @@ test.describe( `${ blockData.slug } Block`, () => {
await admin.visitSiteEditor( { await admin.visitSiteEditor( {
postId: template.id, postId: template.id,
postType: 'wp_template', postType: 'wp_template',
canvas: 'edit',
} ); } );
await editorUtils.enterEditMode(); await expect( editor.canvas.getByText( 'howdy' ) ).toBeVisible();
await editor.insertBlock( { await editor.insertBlock( {
name: blockData.slug, name: blockData.slug,

View File

@ -25,24 +25,6 @@ test.describe( `${ blockData.slug } Block`, () => {
); );
} ); } );
test( 'block should be already added in the Single Product Template', async ( {
editorUtils,
admin,
} ) => {
await admin.visitSiteEditor( {
postId: 'woocommerce/woocommerce//single-product',
postType: 'wp_template',
} );
await editorUtils.enterEditMode();
const alreadyPresentBlock = await editorUtils.getBlockByName(
blockData.slug
);
await expect( alreadyPresentBlock ).toHaveText(
/This block lists description, attributes and reviews for a single product./
);
} );
test( 'block can be inserted in the Site Editor', async ( { test( 'block can be inserted in the Site Editor', async ( {
admin, admin,
requestUtils, requestUtils,
@ -59,9 +41,10 @@ test.describe( `${ blockData.slug } Block`, () => {
await admin.visitSiteEditor( { await admin.visitSiteEditor( {
postId: template.id, postId: template.id,
postType: 'wp_template', postType: 'wp_template',
canvas: 'edit',
} ); } );
await editorUtils.enterEditMode(); await expect( editor.canvas.getByText( 'howdy' ) ).toBeVisible();
await editor.insertBlock( { await editor.insertBlock( {
name: blockData.slug, name: blockData.slug,

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Blocks E2E: Fix flaky block insertion tests