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

Commit

Permalink
Archive Templates - Compatibility Layer: fix E2E tests (#11273)
Browse files Browse the repository at this point in the history
* Archive Templates - Compatibility Layer: fix E2E tests

* remove unecessary step
  • Loading branch information
gigitux authored Oct 17, 2023
1 parent 34af3bf commit 85e21c2
Showing 1 changed file with 28 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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' );
} );
} );

0 comments on commit 85e21c2

Please sign in to comment.