Skip to content

Commit 962b3a2

Browse files
committed
draft
1 parent f22ea52 commit 962b3a2

File tree

5 files changed

+25
-334
lines changed

5 files changed

+25
-334
lines changed

front/e2e/src/helper/filter.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,6 @@ export type FilterValue<T extends FilterType> =
2323
? [number, number]
2424
: never;
2525

26-
// value: TFilters[Name] extends FilterType.BOOLEAN
27-
// ? boolean
28-
// : TFilters[Name] extends FilterType.TEXT
29-
// ? string
30-
// : TFilters[Name] extends FilterType.DROPDOWN
31-
// ? string
32-
// : TFilters[Name] extends FilterType.RANGE
33-
// ? [number, number]
34-
// : never
35-
36-
3726
export type FilterValues<TFilters extends Record<string, FilterType>> = {
3827
[K in keyof TFilters]?: FilterValue<TFilters[K]>;
3928
};
@@ -207,7 +196,7 @@ export class Filter<TFilters extends Record<string, FilterType>> {
207196
for (const name in filters) {
208197
const value = filters[name];
209198

210-
// If it's an array (only for DROPDOWN), iterate
199+
// If it's an array (only for DROPDOWN), iterate.
211200
if (Array.isArray(value) && this.filters[name] !== FilterType.RANGE) {
212201
for (const item of value) {
213202
await this.removeFilter(name as keyof TFilters & string, item);

front/e2e/src/tests/pages/admin/merchandising/recommenders/recommenderType.spec.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,17 @@ test('Pages > Merchandising > Recommenders > Recommender Types', {tag: ['@premiu
7373

7474
await test.step('Add some filters and remove them', async () => {
7575
const defaultRowCount = await grid.getCountLines()
76+
const applicableFilters = {
77+
[testIds.filter.name]: texts.filtersToApply.name,
78+
[testIds.filter.code]: texts.filtersToApply.code,
79+
}
7680

7781
await test.step('Apply all filters available', async () => {
78-
await filter.addFilters({
79-
[testIds.filter.name]: texts.filtersToApply.name,
80-
[testIds.filter.code]: texts.filtersToApply.code,
81-
})
82+
await filter.addFilters(applicableFilters)
8283
})
8384

8485
await test.step('Remove applied filters one by one', async () => {
85-
await filter.removeFilters({
86-
[testIds.filter.name]: texts.filtersToApply.name,
87-
[testIds.filter.code]: texts.filtersToApply.code,
88-
})
86+
await filter.removeFilters(applicableFilters)
8987
})
9088

9189
await test.step('Apply a filter and compare the grid to see if it works', async () => {

front/e2e/src/tests/pages/admin/search/facets.spec.ts.orig

Lines changed: 0 additions & 286 deletions
This file was deleted.

front/e2e/src/tests/pages/admin/search/thesaurus.spec.ts

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -121,25 +121,20 @@ test('Pages > Search > Thésaurus', {tag: ['@premium']}, async ({page}) => {
121121

122122
await test.step('Add some filters and remove them', async () => {
123123
const defaultRowCount = await grid.getCountLines()
124+
const applicableFilters = {
125+
[testIds.filter.name]: texts.filtersToApply.name,
126+
[testIds.filter.type]: texts.filtersToApply.type,
127+
[testIds.filter.terms]: texts.filtersToApply.terms,
128+
[testIds.filter.isActive]: texts.filtersToApply.isActive,
129+
[testIds.filter.context]: texts.filtersToApply.context,
130+
}
124131

125132
await test.step('Apply all filters available', async () => {
126-
await filter.addFilters({
127-
[testIds.filter.name]: texts.filtersToApply.name,
128-
[testIds.filter.type]: texts.filtersToApply.type,
129-
[testIds.filter.terms]: texts.filtersToApply.terms,
130-
[testIds.filter.isActive]: texts.filtersToApply.isActive,
131-
[testIds.filter.context]: texts.filtersToApply.context,
132-
})
133+
await filter.addFilters(applicableFilters)
133134
})
134135

135136
await test.step('Remove applied filters one by one', async () => {
136-
await filter.removeFilters({
137-
[testIds.filter.name]: texts.filtersToApply.name,
138-
[testIds.filter.type]: texts.filtersToApply.type,
139-
[testIds.filter.terms]: texts.filtersToApply.terms,
140-
[testIds.filter.isActive]: texts.filtersToApply.isActive,
141-
[testIds.filter.context]: texts.filtersToApply.context,
142-
})
137+
await filter.removeFilters(applicableFilters)
143138
})
144139

145140
await test.step('Apply a filter and compare the grid to see if it works', async () => {

0 commit comments

Comments
 (0)