Remove class scoping and just use text to find elements (#44289)
This commit is contained in:
parent
24ea7a1848
commit
497d4b8a25
|
@ -28,9 +28,8 @@ test.describe( 'Product Filter: Active Filters Block', async () => {
|
|||
'/product-filters-active-block/?rating_filter=1,2,5'
|
||||
);
|
||||
|
||||
const listLocator = page.locator( '.filter-list' );
|
||||
const hasTitle =
|
||||
( await listLocator.locator( 'text=Rating:' ).count() ) === 1;
|
||||
( await page.locator( 'text=Rating:' ).count() ) === 1;
|
||||
|
||||
expect( hasTitle ).toBe( true );
|
||||
|
||||
|
@ -40,9 +39,7 @@ test.describe( 'Product Filter: Active Filters Block', async () => {
|
|||
'Rated 5 out of 5',
|
||||
] ) {
|
||||
const hasFilter =
|
||||
( await listLocator
|
||||
.locator( `text=${ text }` )
|
||||
.count() ) === 1;
|
||||
( await page.locator( `text=${ text }` ).count() ) === 1;
|
||||
expect( hasFilter ).toBe( true );
|
||||
}
|
||||
} );
|
||||
|
@ -54,19 +51,14 @@ test.describe( 'Product Filter: Active Filters Block', async () => {
|
|||
'/product-filters-active-block/?filter_stock_status=instock,onbackorder'
|
||||
);
|
||||
|
||||
const listLocator = page.locator( '.filter-list' );
|
||||
const hasTitle =
|
||||
( await listLocator
|
||||
.locator( 'text=Stock Status:' )
|
||||
.count() ) === 1;
|
||||
( await page.locator( 'text=Stock Status:' ).count() ) === 1;
|
||||
|
||||
expect( hasTitle ).toBe( true );
|
||||
|
||||
for ( const text of [ 'In stock', 'On backorder' ] ) {
|
||||
const hasFilter =
|
||||
( await listLocator
|
||||
.locator( `text=${ text }` )
|
||||
.count() ) === 1;
|
||||
( await page.locator( `text=${ text }` ).count() ) === 1;
|
||||
expect( hasFilter ).toBe( true );
|
||||
}
|
||||
} );
|
||||
|
@ -78,17 +70,14 @@ test.describe( 'Product Filter: Active Filters Block', async () => {
|
|||
'/product-filters-active-block/?filter_color=blue,gray&query_type_color=or'
|
||||
);
|
||||
|
||||
const listLocator = page.locator( '.filter-list' );
|
||||
const hasTitle =
|
||||
( await listLocator.locator( 'text=Color:' ).count() ) === 1;
|
||||
( await page.locator( 'text=Color:' ).count() ) === 1;
|
||||
|
||||
expect( hasTitle ).toBe( true );
|
||||
|
||||
for ( const text of [ 'Blue', 'Gray' ] ) {
|
||||
const hasFilter =
|
||||
( await listLocator
|
||||
.locator( `text=${ text }` )
|
||||
.count() ) === 1;
|
||||
( await page.locator( `text=${ text }` ).count() ) === 1;
|
||||
expect( hasFilter ).toBe( true );
|
||||
}
|
||||
} );
|
||||
|
@ -100,16 +89,14 @@ test.describe( 'Product Filter: Active Filters Block', async () => {
|
|||
'/product-filters-active-block/?min_price=17&max_price=71'
|
||||
);
|
||||
|
||||
const listLocator = page.locator( '.filter-list' );
|
||||
const hasTitle =
|
||||
( await listLocator.locator( 'text=Price:' ).count() ) === 1;
|
||||
( await page.locator( 'text=Price:' ).count() ) === 1;
|
||||
|
||||
expect( hasTitle ).toBe( true );
|
||||
|
||||
const hasFilter =
|
||||
( await listLocator
|
||||
.locator( `text=Between $17 and $71` )
|
||||
.count() ) === 1;
|
||||
( await page.locator( `text=Between $17 and $71` ).count() ) ===
|
||||
1;
|
||||
expect( hasFilter ).toBe( true );
|
||||
} );
|
||||
} );
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: dev
|
||||
Comment: Refactor e2e tests for new interactivity active filter block
|
||||
|
Loading…
Reference in New Issue