Skip to content

Commit

Permalink
feat: add basic e2e test case to filter category
Browse files Browse the repository at this point in the history
  • Loading branch information
maxiroellplenty committed Oct 6, 2023
1 parent fd383c3 commit 976d445
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
9 changes: 9 additions & 0 deletions apps/web/__tests__/support/pageObjects/CategoryObject.ts
Original file line number Diff line number Diff line change
@@ -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;
}
}
13 changes: 13 additions & 0 deletions apps/web/__tests__/test/smoke/categoryPage.cy.ts
Original file line number Diff line number Diff line change
@@ -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;
})
});
1 change: 1 addition & 0 deletions apps/web/components/CategoryFilters/Filter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
:key="index"
tag="label"
size="sm"
:data-testid="'category-filter-' + index"
:class="['px-1.5 bg-transparent hover:bg-transparent']"
>
<template #prefix>
Expand Down

0 comments on commit 976d445

Please sign in to comment.