Skip to content
This repository has been archived by the owner on Jun 2, 2022. It is now read-only.

Commit

Permalink
Fix PLP test
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfp13 committed Feb 10, 2022
1 parent 5982db7 commit 9c3fc37
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
14 changes: 8 additions & 6 deletions cypress/integration/plp.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,15 @@ describe('Search page Filters and Sorting options', () => {
// Check if the filter applied actually brought the number of products it said it would

cy.waitUntil(() => {
return cy.get('.product-grid').should('exist')
return cy.getById('total-product-count').should('exist')
}).then(() => {
cy.getById('total-product-count').then(($countDiv) => {
expect(Number($countDiv.attr('data-count'))).to.eq(
Number(quantity)
)
})
cy.getById('total-product-count')
.parent()
.then(($countDiv) => {
expect(Number($countDiv.attr('data-count'))).to.eq(
Number(quantity)
)
})
})
})
})
Expand Down
8 changes: 2 additions & 6 deletions src/components/sections/ProductGallery/ProductGallery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,9 @@ function ProductGallery({ title, slug }: Props) {
)}
</div>

<div
className="product-listing__results-count"
data-testid="total-product-count"
data-count={totalCount}
>
<div className="product-listing__results-count" data-count={totalCount}>
{data ? (
<h2>{totalCount} Results</h2>
<h2 data-testid="total-product-count">{totalCount} Results</h2>
) : (
<ElementSkeleton shimmer type="text" />
)}
Expand Down

0 comments on commit 9c3fc37

Please sign in to comment.