Clean up block templates after running e2e tests (#44600)

* Clean up block templates after running e2e tests

* Add changelog entry

* Fix linting
This commit is contained in:
Albert Juhé Lluveras 2024-02-15 08:17:12 +01:00 committed by GitHub
parent 49557b3229
commit dd56a3ba61
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 22 additions and 4 deletions

View File

@ -17,7 +17,7 @@ type TemplateCustomizationTest = {
} ) => Promise< void | Response | null >;
templateName: string;
templatePath: string;
templateType: string;
templateType: 'wp_template' | 'wp_template_part';
fallbackTemplate?: {
templateName: string;
templatePath: string;

View File

@ -4,6 +4,10 @@
import { test, expect } from '@woocommerce/e2e-playwright-utils';
test.describe( 'Single Product template', async () => {
test.afterAll( async ( { requestUtils } ) => {
await requestUtils.deleteAllTemplates( 'wp_template' );
} );
test( 'shows password form in products protected with password', async ( {
page,
} ) => {

View File

@ -15,6 +15,10 @@ const userText = 'Hello World in the Belt template';
const themeTemplateText = 'Single Product Belt template loaded from theme';
test.describe( 'Single Product Template', async () => {
test.afterAll( async ( { requestUtils } ) => {
await requestUtils.deleteAllTemplates( 'wp_template' );
} );
test( 'loads the theme template for a specific product using the product slug and it can be customized', async ( {
admin,
editorUtils,

View File

@ -2,7 +2,6 @@
* External dependencies
*/
import { test, expect } from '@woocommerce/e2e-playwright-utils';
import { deleteAllTemplates } from '@wordpress/e2e-test-utils';
import {
BLOCK_THEME_SLUG,
BLOCK_THEME_WITH_TEMPLATES_SLUG,
@ -22,8 +21,8 @@ CUSTOMIZABLE_WC_TEMPLATES.forEach( ( testData ) => {
const woocommerceTemplateUserText = `Hello World in the WooCommerce ${ testData.templateName } template`;
test.describe( `${ testData.templateName } template`, async () => {
test.afterAll( async () => {
await deleteAllTemplates( 'wp_template' );
test.afterAll( async ( { requestUtils } ) => {
await requestUtils.deleteAllTemplates( testData.templateType );
} );
test( `user-modified ${ testData.templateName } template based on the theme template has priority over the user-modified template based on the default WooCommerce template`, async ( {

View File

@ -15,6 +15,10 @@ CUSTOMIZABLE_WC_TEMPLATES.forEach( ( testData ) => {
testData.templateType === 'wp_template' ? 'template' : 'template part';
test.describe( `${ testData.templateName } template`, async () => {
test.afterAll( async ( { requestUtils } ) => {
await requestUtils.deleteAllTemplates( testData.templateType );
} );
test( 'can be modified and reverted', async ( {
admin,
frontendUtils,

View File

@ -19,6 +19,10 @@ CUSTOMIZABLE_WC_TEMPLATES.forEach( ( testData ) => {
testData.templateType === 'wp_template' ? 'template' : 'template part';
test.describe( `${ testData.templateName } template`, async () => {
test.afterAll( async ( { requestUtils } ) => {
await requestUtils.deleteAllTemplates( testData.templateType );
} );
test( "theme template has priority over WooCommerce's and can be modified", async ( {
admin,
editorUtils,

View File

@ -0,0 +1,3 @@
Significance: patch
Type: update
Comment: Clean up block templates after running e2e tests.