diff --git a/apps/web/__tests__/support/pageObjects/CategoryObject.ts b/apps/web/__tests__/support/pageObjects/CategoryObject.ts new file mode 100644 index 000000000..f59c3a6a8 --- /dev/null +++ b/apps/web/__tests__/support/pageObjects/CategoryObject.ts @@ -0,0 +1,9 @@ + +export class CategoryPageObject { + get filterClickShouldReloadCategory() { + cy.intercept('http://localhost:8181/plentysystems/getFacet').as('getFacet'); + cy.getByTestId('category-filter-0').first().click(); + cy.wait('@getFacet').its('response.statusCode').should('eq', 200) + return this; + } +} diff --git a/apps/web/__tests__/test/smoke/categoryPage.cy.ts b/apps/web/__tests__/test/smoke/categoryPage.cy.ts new file mode 100644 index 000000000..0795cec7e --- /dev/null +++ b/apps/web/__tests__/test/smoke/categoryPage.cy.ts @@ -0,0 +1,13 @@ +import { CategoryPageObject } from '../../support/pageObjects/CategoryObject'; + +const category = new CategoryPageObject(); + +describe('Smoke: Category Page', () => { + it('[smoke] Category filters should trigger a product data reload', () => { + // We should configure the system so that the first category is set up with filters. + // This way we are independet from the language and the url. + cy.visitAndHydrate('/c/living-room'); + + category.filterClickShouldReloadCategory; + }) +}); diff --git a/apps/web/components/CategoryFilters/Filter.vue b/apps/web/components/CategoryFilters/Filter.vue index 838f4813c..bcb886ca8 100644 --- a/apps/web/components/CategoryFilters/Filter.vue +++ b/apps/web/components/CategoryFilters/Filter.vue @@ -57,6 +57,7 @@ :key="index" tag="label" size="sm" + :data-testid="'category-filter-' + index" :class="['px-1.5 bg-transparent hover:bg-transparent']" >