Add e2e tests to verify Products by Category/Tag/Attribute templates default to Product Catalog template (#43471)

* Add e2e tests to verify Products by Category/Tag/Attribute templates default to Product Catalog template

* Add changefile(s) from automation for the following project(s): woocommerce-blocks

---------

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Albert Juhé Lluveras 2024-01-11 12:47:56 +01:00 committed by GitHub
parent 5fdbe63530
commit 67fb8d7511
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 118 additions and 0 deletions

View File

@ -42,4 +42,42 @@ test.describe( 'Products by Attribute template', async () => {
page.getByText( 'Hello World in the template' )
).toHaveCount( 0 );
} );
test( 'defaults to the Product Catalog template', async ( {
admin,
editorUtils,
page,
} ) => {
// Edit Product Catalog template and verify changes are visible.
await admin.visitSiteEditor( {
postId: 'woocommerce/woocommerce//archive-product',
postType: 'wp_template',
} );
await editorUtils.enterEditMode();
await editorUtils.closeWelcomeGuideModal();
await editorUtils.editor.insertBlock( {
name: 'core/paragraph',
attributes: {
content: 'Hello World in the Product Catalog template',
},
} );
await editorUtils.saveTemplate();
await page.goto( permalink );
await expect(
page
.getByText( 'Hello World in the Product Catalog template' )
.first()
).toBeVisible();
// Verify the edition can be reverted.
await admin.visitAdminPage(
'site-editor.php',
`path=/wp_template/all`
);
await editorUtils.revertTemplateCustomizations( 'Product Catalog' );
await page.goto( permalink );
await expect(
page.getByText( 'Hello World in the Product Catalog template' )
).toHaveCount( 0 );
} );
} );

View File

@ -42,4 +42,42 @@ test.describe( 'Products by Category template', async () => {
page.getByText( 'Hello World in the template' )
).toHaveCount( 0 );
} );
test( 'defaults to the Product Catalog template', async ( {
admin,
editorUtils,
page,
} ) => {
// Edit Product Catalog template and verify changes are visible.
await admin.visitSiteEditor( {
postId: 'woocommerce/woocommerce//archive-product',
postType: 'wp_template',
} );
await editorUtils.enterEditMode();
await editorUtils.closeWelcomeGuideModal();
await editorUtils.editor.insertBlock( {
name: 'core/paragraph',
attributes: {
content: 'Hello World in the Product Catalog template',
},
} );
await editorUtils.saveTemplate();
await page.goto( permalink );
await expect(
page
.getByText( 'Hello World in the Product Catalog template' )
.first()
).toBeVisible();
// Verify the edition can be reverted.
await admin.visitAdminPage(
'site-editor.php',
`path=/wp_template/all`
);
await editorUtils.revertTemplateCustomizations( 'Product Catalog' );
await page.goto( permalink );
await expect(
page.getByText( 'Hello World in the Product Catalog template' )
).toHaveCount( 0 );
} );
} );

View File

@ -42,4 +42,42 @@ test.describe( 'Products by Tag template', async () => {
page.getByText( 'Hello World in the template' )
).toHaveCount( 0 );
} );
test( 'defaults to the Product Catalog template', async ( {
admin,
editorUtils,
page,
} ) => {
// Edit Product Catalog template and verify changes are visible.
await admin.visitSiteEditor( {
postId: 'woocommerce/woocommerce//archive-product',
postType: 'wp_template',
} );
await editorUtils.enterEditMode();
await editorUtils.closeWelcomeGuideModal();
await editorUtils.editor.insertBlock( {
name: 'core/paragraph',
attributes: {
content: 'Hello World in the Product Catalog template',
},
} );
await editorUtils.saveTemplate();
await page.goto( permalink );
await expect(
page
.getByText( 'Hello World in the Product Catalog template' )
.first()
).toBeVisible();
// Verify the edition can be reverted.
await admin.visitAdminPage(
'site-editor.php',
`path=/wp_template/all`
);
await editorUtils.revertTemplateCustomizations( 'Product Catalog' );
await page.goto( permalink );
await expect(
page.getByText( 'Hello World in the Product Catalog template' )
).toHaveCount( 0 );
} );
} );

View File

@ -0,0 +1,4 @@
Significance: patch
Type: add
Comment: Add e2e tests to verify Products by Category/Tag/Attribute templates default to Product Catalog template