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

Commit

Permalink
fix: improve check for the Product Collection block
Browse files Browse the repository at this point in the history
  • Loading branch information
gigitux committed Dec 4, 2023
1 parent 3038db6 commit c71aa6a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions tests/e2e/tests/product-collection/product-collection.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ class ProductCollectionPage {
* Private methods to be used by the class.
*/
private async refreshLocators( currentUI: 'editor' | 'frontend' ) {
await this.waitForProductsToLoad();
await this.waitForProductsToLoad( currentUI );

if ( currentUI === 'editor' ) {
await this.initializeLocatorsForEditor();
Expand Down Expand Up @@ -417,11 +417,15 @@ class ProductCollectionPage {
this.pagination = this.page.locator( SELECTORS.pagination.onFrontend );
}

private async waitForProductsToLoad() {
private async waitForProductsToLoad( currentUI: 'editor' | 'frontend' ) {
// Wait for the product blocks to be loaded.
await this.page.waitForSelector( SELECTORS.product );
// Wait for the loading spinner to be detached.
await this.page.waitForSelector( '.is-loading', { state: 'detached' } );
if ( currentUI === 'editor' ) {
// Wait for the loading spinner to be detached.
await this.page.waitForSelector( '.is-loading', {
state: 'detached',
} );
}
}
}

Expand Down

0 comments on commit c71aa6a

Please sign in to comment.