From 85e21c2914b76c2ba502162ebb602533c7476030 Mon Sep 17 00:00:00 2001 From: Luigi Teschio Date: Tue, 17 Oct 2023 09:46:25 +0200 Subject: [PATCH] Archive Templates - Compatibility Layer: fix E2E tests (#11273) * Archive Templates - Compatibility Layer: fix E2E tests * remove unecessary step --- ...ity-layer.block_theme.side_effects.spec.ts | 56 +++++++++---------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/tests/e2e/tests/product-collection/compatibility-layer.block_theme.side_effects.spec.ts b/tests/e2e/tests/product-collection/compatibility-layer.block_theme.side_effects.spec.ts index 419a6989bd5..2113402e218 100644 --- a/tests/e2e/tests/product-collection/compatibility-layer.block_theme.side_effects.spec.ts +++ b/tests/e2e/tests/product-collection/compatibility-layer.block_theme.side_effects.spec.ts @@ -2,7 +2,6 @@ * External dependencies */ import { test as base, expect } from '@woocommerce/e2e-playwright-utils'; -import { deleteAllTemplates } from '@wordpress/e2e-test-utils'; import { installPluginFromPHPFile, uninstallPluginFromPHPFile, @@ -115,39 +114,40 @@ test.describe( 'Compatibility Layer with Product Collection block', () => { await pageObject.goToProductCatalogFrontend(); } ); - // eslint-disable-next-line playwright/no-skipped-test - test.skip( 'Hooks are attached to the page', async ( { - pageObject, - } ) => { - singleOccurranceScenarios.forEach( - async ( { title, dataTestId, content, amount } ) => { - await test.step( title, async () => { - const hooks = - pageObject.locateByTestId( dataTestId ); - await expect( hooks ).toHaveCount( amount ); - await expect( hooks ).toHaveText( content ); - } ); - } - ); + for ( const scenario of singleOccurranceScenarios ) { + test( `${ scenario.title } is attached to the page`, async ( { + pageObject, + } ) => { + const hooks = pageObject.locateByTestId( + scenario.dataTestId + ); - multipleOccurranceScenarios.forEach( - async ( { title, dataTestId, content, amount } ) => { - await test.step( title, async () => { - const hooks = - pageObject.locateByTestId( dataTestId ); - await expect( hooks ).toHaveCount( amount ); - await expect( hooks.first() ).toHaveText( content ); - } ); - } - ); - } ); + await expect( hooks ).toHaveCount( scenario.amount ); + await expect( hooks ).toHaveText( scenario.content ); + } ); + } + + for ( const scenario of multipleOccurranceScenarios ) { + test( `${ scenario.title } is attached to the page`, async ( { + pageObject, + } ) => { + const hooks = pageObject.locateByTestId( + scenario.dataTestId + ); + + await expect( hooks ).toHaveCount( scenario.amount ); + await expect( hooks.first() ).toHaveText( + scenario.content + ); + } ); + } } ); - test.afterAll( async () => { + test.afterAll( async ( { requestUtils } ) => { await uninstallPluginFromPHPFile( `${ __dirname }/${ compatiblityPluginFileName }` ); - await deleteAllTemplates( 'wp_template' ); + await requestUtils.deleteAllTemplates( 'wp_template' ); } ); } );