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

Commit

Permalink
fix E2E tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gigitux committed Oct 19, 2023
1 parent 18d416e commit b6d0088
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,7 @@ test.describe( `${ blockData.name }`, () => {
} );

// img[style] is the selector because the style attribute is Interactivity API.
const imgElement = blockFrontend.locator(
'img[style]:not([hidden])'
);
const imgElement = blockFrontend.locator( 'img' ).first();
const style = await imgElement.evaluate( ( el ) => el.style );

await expect( style.transform ).toBe( 'scale(1)' );
Expand Down Expand Up @@ -137,14 +135,18 @@ test.describe( `${ blockData.name }`, () => {
page: 'frontend',
} );

// img[style] is the selector because the style attribute is added by Interactivity API. In this case, the style attribute should not be added.
const imgElement = blockFrontend.locator(
'img[style]:not([hidden])'
const imgElement = blockFrontend.locator( 'img' ).first();
const style = await imgElement.evaluate( ( el ) => el.style );

await expect( style.transform ).toBe( '' );

await imgElement.hover();

const styleOnHover = await imgElement.evaluate(
( el ) => el.style
);
await expect( imgElement ).toBeHidden();
await expect(
blockFrontend.locator( 'img:not([hidden])' )
).toBeVisible();

await expect( styleOnHover.transform ).toBe( '' );
} );
} );
} );
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ const test = base.extend< { pageObject: ProductGalleryPage } >( {
export const getVisibleLargeImageId = async (
mainImageBlockLocator: Locator
) => {
const mainImage = mainImageBlockLocator.locator(
'img:not([hidden])'
) as Locator;
const mainImage = mainImageBlockLocator.locator( 'img' ).first() as Locator;

const mainImageContext = ( await mainImage.getAttribute(
'data-wc-context'
Expand Down

0 comments on commit b6d0088

Please sign in to comment.