Skip to content

Commit

Permalink
test(atomic): add tests for generated answer tab support (#4447)
Browse files Browse the repository at this point in the history
This PR adds tests for disabling/enabled atomic-generated-answer
depending on the active tab

https://coveord.atlassian.net/browse/CDX-1557
  • Loading branch information
fpbrault authored Oct 1, 2024
1 parent 0882dbc commit 7ab3dae
Show file tree
Hide file tree
Showing 4 changed files with 255 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import {html} from 'lit/static-html.js';

const {decorator, play} = wrapInSearchInterface({
search: {
// eslint-disable-next-line @cspell/spellchecker
pipeline: 'genqatest',
preprocessSearchResponseMiddleware: (r) => {
const [result] = r.body.results;
result.title = 'Manage the Coveo In-Product Experiences (IPX)';
Expand Down Expand Up @@ -68,118 +70,226 @@ export const Default: Story = {
<atomic-layout-section section="facets">
<atomic-facets>
<atomic-facet field="objecttype" label="Object type"></atomic-facet>
<atomic-facet aria-label="included-facet" tabs-included='["article"]' field="filetype"
label="File type (included facet)"></atomic-facet>
<atomic-facet aria-label="excluded-facet" tabs-excluded='["article"]' field="source"
label="Source (excluded facet)"></atomic-facet>
<atomic-category-facet aria-label="included-facet" tabs-included='["article"]' field="geographicalhierarchy"
label="World Atlas" with-search></atomic-category-facet>
<atomic-category-facet aria-label="excluded-facet" tabs-excluded='["article"]' field="geographicalhierarchy"
label="World Atlas"></atomic-category-facet>
<atomic-color-facet aria-label="included-facet" tabs-included='["article"]' field="filetype" label="Files"
number-of-values="6" sort-criteria="occurrences"></atomic-color-facet>
<atomic-color-facet aria-label="excluded-facet" tabs-excluded='["article"]' field="filetype" label="Files"
number-of-values="6" sort-criteria="occurrences"></atomic-color-facet>
<atomic-rating-facet aria-label="included-facet" tabs-included='["article"]' field="snrating" label="Rating"
number-of-intervals="5"></atomic-rating-facet>
<atomic-rating-facet aria-label="excluded-facet" tabs-excluded='["article"]' field="snrating" label="Rating"
number-of-intervals="5"></atomic-rating-facet>
<atomic-rating-range-facet aria-label="included-facet" tabs-included='["article"]' facet-id="snrating_range"
field="snrating" label="Rating Range (auto)" number-of-intervals="5"></atomic-rating-range-facet>
<atomic-rating-range-facet aria-label="excluded-facet" tabs-excluded='["article"]'
facet-id="snrating_range_2" field="snrating" label="Rating Range (auto)"
number-of-intervals="5"></atomic-rating-range-facet>
<atomic-timeframe-facet aria-label="included-facet" tabs-included='["article"]' label="Timeframe"
with-date-picker>
<atomic-facet
aria-label="included-facet"
tabs-included='["article"]'
field="filetype"
label="File type (included facet)"
></atomic-facet>
<atomic-facet
aria-label="excluded-facet"
tabs-excluded='["article"]'
field="source"
label="Source (excluded facet)"
></atomic-facet>
<atomic-category-facet
aria-label="included-facet"
tabs-included='["article"]'
field="geographicalhierarchy"
label="World Atlas"
with-search
></atomic-category-facet>
<atomic-category-facet
aria-label="excluded-facet"
tabs-excluded='["article"]'
field="geographicalhierarchy"
label="World Atlas"
></atomic-category-facet>
<atomic-color-facet
aria-label="included-facet"
tabs-included='["article"]'
field="filetype"
label="Files"
number-of-values="6"
sort-criteria="occurrences"
></atomic-color-facet>
<atomic-color-facet
aria-label="excluded-facet"
tabs-excluded='["article"]'
field="filetype"
label="Files"
number-of-values="6"
sort-criteria="occurrences"
></atomic-color-facet>
<atomic-rating-facet
aria-label="included-facet"
tabs-included='["article"]'
field="snrating"
label="Rating"
number-of-intervals="5"
></atomic-rating-facet>
<atomic-rating-facet
aria-label="excluded-facet"
tabs-excluded='["article"]'
field="snrating"
label="Rating"
number-of-intervals="5"
></atomic-rating-facet>
<atomic-rating-range-facet
aria-label="included-facet"
tabs-included='["article"]'
facet-id="snrating_range"
field="snrating"
label="Rating Range (auto)"
number-of-intervals="5"
></atomic-rating-range-facet>
<atomic-rating-range-facet
aria-label="excluded-facet"
tabs-excluded='["article"]'
facet-id="snrating_range_2"
field="snrating"
label="Rating Range (auto)"
number-of-intervals="5"
></atomic-rating-range-facet>
<atomic-timeframe-facet
aria-label="included-facet"
tabs-included='["article"]'
label="Timeframe"
with-date-picker
>
<atomic-timeframe unit="hour"></atomic-timeframe>
<atomic-timeframe unit="day"></atomic-timeframe>
<atomic-timeframe unit="week"></atomic-timeframe>
<atomic-timeframe unit="month"></atomic-timeframe>
<atomic-timeframe unit="quarter"></atomic-timeframe>
<atomic-timeframe unit="year"></atomic-timeframe>
<atomic-timeframe unit="year" amount="10" period="next"></atomic-timeframe></atomic-timeframe-facet>
<atomic-timeframe-facet aria-label="excluded-facet" tabs-excluded='["article"]' label="Timeframe"
with-date-picker>
<atomic-timeframe
unit="year"
amount="10"
period="next"
></atomic-timeframe
></atomic-timeframe-facet>
<atomic-timeframe-facet
aria-label="excluded-facet"
tabs-excluded='["article"]'
label="Timeframe"
with-date-picker
>
<atomic-timeframe unit="hour"></atomic-timeframe>
<atomic-timeframe unit="day"></atomic-timeframe>
<atomic-timeframe unit="week"></atomic-timeframe>
<atomic-timeframe unit="month"></atomic-timeframe>
<atomic-timeframe unit="quarter"></atomic-timeframe>
<atomic-timeframe unit="year"></atomic-timeframe>
<atomic-timeframe unit="year" amount="10" period="next"></atomic-timeframe></atomic-timeframe-facet>
<atomic-timeframe
unit="year"
amount="10"
period="next"
></atomic-timeframe
></atomic-timeframe-facet>
</atomic-facets>
</atomic-layout-section>
<atomic-layout-section section="main">
${story()}
<atomic-layout-section section="horizontal-facets">
<atomic-segmented-facet-scrollable>
<atomic-segmented-facet aria-label="included-facet" tabs-included='["article"]' field="inat_kingdom"
label="Kingdom"></atomic-segmented-facet>
<atomic-segmented-facet
aria-label="included-facet"
tabs-included='["article"]'
field="inat_kingdom"
label="Kingdom"
></atomic-segmented-facet>
</atomic-segmented-facet-scrollable>
<atomic-segmented-facet-scrollable>
<atomic-segmented-facet aria-label="excluded-facet" tabs-excluded='["article"]' field="inat_kingdom"
label="Kingdom"></atomic-segmented-facet>
<atomic-segmented-facet
aria-label="excluded-facet"
tabs-excluded='["article"]'
field="inat_kingdom"
label="Kingdom"
></atomic-segmented-facet>
</atomic-segmented-facet-scrollable>
</atomic-layout-section>
<atomic-layout-section section="status">
<atomic-breadbox></atomic-breadbox>
<atomic-query-summary></atomic-query-summary>
<atomic-refine-toggle></atomic-refine-toggle>
<atomic-sort-dropdown>
<atomic-sort-expression tabs-excluded='["article"]' label="Name descending"
expression="name descending"></atomic-sort-expression>
<atomic-sort-expression tabs-excluded='["article"]' label="Name ascending"
expression="name ascending"></atomic-sort-expression>
<atomic-sort-expression tabs-included='["article"]' label="Most Recent"
expression="date descending"></atomic-sort-expression>
<atomic-sort-expression tabs-included='["article"]' label="Least Recent"
expression="date ascending"></atomic-sort-expression>
<atomic-sort-expression label="relevance" expression="relevancy"></atomic-sort-expression>
<atomic-sort-expression
tabs-excluded='["article"]'
label="Name descending"
expression="name descending"
></atomic-sort-expression>
<atomic-sort-expression
tabs-excluded='["article"]'
label="Name ascending"
expression="name ascending"
></atomic-sort-expression>
<atomic-sort-expression
tabs-included='["article"]'
label="Most Recent"
expression="date descending"
></atomic-sort-expression>
<atomic-sort-expression
tabs-included='["article"]'
label="Least Recent"
expression="date ascending"
></atomic-sort-expression>
<atomic-sort-expression
label="relevance"
expression="relevancy"
></atomic-sort-expression>
</atomic-sort-dropdown>
</atomic-layout-section>
<atomic-layout-section section="results">
<atomic-smart-snippet tabs-included='["article", "documentation"]'
style="padding: 10px;"></atomic-smart-snippet>
<atomic-result-list tabs-included='["article"]' display="list" density="compact" image-size="small"
data-testid="included-result-list">
<atomic-generated-answer tabs-included='["article", "documentation"]'></atomic-generated-answer>
<atomic-smart-snippet
tabs-included='["article", "documentation"]'
style="padding: 10px"
></atomic-smart-snippet>
<atomic-result-list
tabs-included='["article"]'
display="list"
density="compact"
image-size="small"
data-testid="included-result-list"
>
<atomic-result-template>
<template>
<atomic-result-section-actions><atomic-quickview></atomic-quickview></atomic-result-section-actions>
<atomic-result-section-actions
><atomic-quickview></atomic-quickview
></atomic-result-section-actions>
<atomic-result-section-visual>
<img src="https://picsum.photos/350" class="thumbnail" />
</atomic-result-section-visual>
<atomic-result-section-title><atomic-result-link></atomic-result-link></atomic-result-section-title>
<atomic-result-section-title
><atomic-result-link></atomic-result-link
></atomic-result-section-title>
<atomic-result-section-excerpt>
"included result list"
<atomic-result-text field="excerpt"></atomic-result-text></atomic-result-section-excerpt>
<atomic-result-text field="excerpt"></atomic-result-text
></atomic-result-section-excerpt>
</template>
</atomic-result-template>
</atomic-result-list>
<atomic-result-list tabs-excluded='["article"]' display="grid" density="normal" image-size="icon"
data-testid="excluded-result-list">
<atomic-result-list
tabs-excluded='["article"]'
display="grid"
density="normal"
image-size="icon"
data-testid="excluded-result-list"
>
<atomic-result-template>
<template>
<atomic-result-section-actions><atomic-quickview></atomic-quickview></atomic-result-section-actions>
<atomic-result-section-visual>
<atomic-result-section-actions
><atomic-quickview></atomic-quickview
></atomic-result-section-actions>
<atomic-result-section-visual>
<img src="https://picsum.photos/400" class="thumbnail" />
</atomic-result-section-visual>
<atomic-result-section-title><atomic-result-link></atomic-result-link></atomic-result-section-title>
<atomic-result-section-title
><atomic-result-link></atomic-result-link
></atomic-result-section-title>
<atomic-result-section-excerpt>
"excluded result list"
<atomic-result-text field="excerpt"></atomic-result-text></atomic-result-section-excerpt>
<atomic-result-text field="excerpt"></atomic-result-text
></atomic-result-section-excerpt>
</template>
</atomic-result-template>
</atomic-result-list>
<atomic-query-error></atomic-commerce-query-error>
<atomic-query-error></atomic-query-error>
</atomic-layout-section>
<atomic-layout-section section="pagination"></atomic-layout-section>
</atomic-layout-section>
</atomic-search-layout>
`,
],
Expand Down
Loading

0 comments on commit 7ab3dae

Please sign in to comment.