-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(atomic): clickable "More matches for {query}" in facetSearch (#4154
) https://coveord.atlassian.net/browse/KIT-3361 Still need to implement the feature for the commerce use case in a future PR. BEFORE <img width="474" alt="image" src="https://github.com/coveo/ui-kit/assets/78121423/319ad32b-ac0f-48d6-ab4a-419c02864575"> AFTER <img width="485" alt="image" src="https://github.com/coveo/ui-kit/assets/78121423/0fd849af-a6c9-43a0-bc22-7e13da714505"> increments like this : numberOfValues += initalNumberOfValues <img width="480" alt="image" src="https://github.com/coveo/ui-kit/assets/78121423/d9a3a5ba-828b-47e2-a449-87f049ddd448">
- Loading branch information
1 parent
cd679cc
commit a389b40
Showing
17 changed files
with
268 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...tomic/src/components/search/facets/atomic-category-facet/e2e/atomic-category-facet.e2e.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import {test, expect} from './fixture'; | ||
|
||
test.describe('when clicking facet search "More matches for"', () => { | ||
test.beforeEach(async ({facet}) => { | ||
await facet.load({story: 'low-facet-values'}); | ||
}); | ||
test('should display an increasing number of matches', async ({facet}) => { | ||
await facet.getFacetSearch.click(); | ||
await facet.getFacetSearch.pressSequentially('p'); | ||
await expect | ||
.poll(async () => { | ||
return await facet.getFacetValue.count(); | ||
}) | ||
.toBeGreaterThanOrEqual(2); | ||
|
||
await facet.facetSearchMoreMatchesFor.click(); | ||
await expect | ||
.poll(async () => { | ||
return await facet.getFacetValue.count(); | ||
}) | ||
.toBeGreaterThanOrEqual(4); | ||
|
||
await facet.facetSearchMoreMatchesFor.click(); | ||
await expect | ||
.poll(async () => { | ||
return await facet.getFacetValue.count(); | ||
}) | ||
.toBeGreaterThanOrEqual(6); | ||
}); | ||
}); |
19 changes: 19 additions & 0 deletions
19
packages/atomic/src/components/search/facets/atomic-category-facet/e2e/fixture.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import {test as base} from '@playwright/test'; | ||
import { | ||
AxeFixture, | ||
makeAxeBuilder, | ||
} from '../../../../../../playwright-utils/base-fixture'; | ||
import {AtomicCategoryFacetPageObject as Facet} from './page-object'; | ||
|
||
type MyFixture = { | ||
facet: Facet; | ||
}; | ||
|
||
export const test = base.extend<MyFixture & AxeFixture>({ | ||
makeAxeBuilder, | ||
facet: async ({page}, use) => { | ||
await use(new Facet(page)); | ||
}, | ||
}); | ||
|
||
export {expect} from '@playwright/test'; |
20 changes: 20 additions & 0 deletions
20
packages/atomic/src/components/search/facets/atomic-category-facet/e2e/page-object.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import type {Page} from '@playwright/test'; | ||
import {BasePageObject} from '../../../../../../playwright-utils/base-page-object'; | ||
|
||
export class AtomicCategoryFacetPageObject extends BasePageObject<'atomic-category-facet'> { | ||
constructor(page: Page) { | ||
super(page, 'atomic-category-facet'); | ||
} | ||
|
||
get getFacetSearch() { | ||
return this.page.getByLabel('Search'); | ||
} | ||
|
||
get getFacetValue() { | ||
return this.page.locator('[part="search-result"]'); | ||
} | ||
|
||
get facetSearchMoreMatchesFor() { | ||
return this.page.getByRole('button', {name: 'More matches for p'}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...ages/atomic/src/components/search/facets/atomic-color-facet/e2e/atomic-color-facet.e2e.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import {test, expect} from './fixture'; | ||
|
||
test.describe('when clicking facet search "More matches for"', () => { | ||
test.beforeEach(async ({facet}) => { | ||
await facet.load({story: 'low-facet-values'}); | ||
}); | ||
test('should display an increasing number of matches', async ({facet}) => { | ||
await facet.getFacetSearch.click(); | ||
await facet.getFacetSearch.pressSequentially('p'); | ||
await expect | ||
.poll(async () => { | ||
return await facet.getFacetValue.count(); | ||
}) | ||
.toBeGreaterThanOrEqual(2); | ||
|
||
await facet.facetSearchMoreMatchesFor.click(); | ||
await expect | ||
.poll(async () => { | ||
return await facet.getFacetValue.count(); | ||
}) | ||
.toBeGreaterThanOrEqual(4); | ||
|
||
await facet.facetSearchMoreMatchesFor.click(); | ||
await expect | ||
.poll(async () => { | ||
return await facet.getFacetValue.count(); | ||
}) | ||
.toBeGreaterThanOrEqual(6); | ||
}); | ||
}); |
19 changes: 19 additions & 0 deletions
19
packages/atomic/src/components/search/facets/atomic-color-facet/e2e/fixture.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import {test as base} from '@playwright/test'; | ||
import { | ||
AxeFixture, | ||
makeAxeBuilder, | ||
} from '../../../../../../playwright-utils/base-fixture'; | ||
import {AtomicColorFacetPageObject as Facet} from './page-object'; | ||
|
||
type MyFixture = { | ||
facet: Facet; | ||
}; | ||
|
||
export const test = base.extend<MyFixture & AxeFixture>({ | ||
makeAxeBuilder, | ||
facet: async ({page}, use) => { | ||
await use(new Facet(page)); | ||
}, | ||
}); | ||
|
||
export {expect} from '@playwright/test'; |
20 changes: 20 additions & 0 deletions
20
packages/atomic/src/components/search/facets/atomic-color-facet/e2e/page-object.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import type {Page} from '@playwright/test'; | ||
import {BasePageObject} from '../../../../../../playwright-utils/base-page-object'; | ||
|
||
export class AtomicColorFacetPageObject extends BasePageObject<'atomic-color-facet'> { | ||
constructor(page: Page) { | ||
super(page, 'atomic-color-facet'); | ||
} | ||
|
||
get getFacetSearch() { | ||
return this.page.getByLabel('Search'); | ||
} | ||
|
||
get getFacetValue() { | ||
return this.page.locator('[part="value-box"]'); | ||
} | ||
|
||
get facetSearchMoreMatchesFor() { | ||
return this.page.getByRole('button', {name: 'More matches for p'}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.