Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(quantic): quantic search box improvements #4120

Merged
merged 91 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from 82 commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
7adf769
feat(headless-commerce): use getVisitorID to set clientId (#3628)
sallainCoveo Feb 26, 2024
79d4d9a
Merge branch 'master' of https://github.com/coveo/ui-kit
mmitiche Feb 27, 2024
fe7251a
Merge branch 'master' of https://github.com/coveo/ui-kit
mmitiche Feb 29, 2024
fcbeaed
Merge branch 'master' of https://github.com/coveo/ui-kit
mmitiche Mar 1, 2024
bf5f573
Merge branch 'master' of https://github.com/coveo/ui-kit
mmitiche Mar 6, 2024
94aaa94
Merge branch 'master' of https://github.com/coveo/ui-kit
mmitiche Mar 8, 2024
3a56e2f
Merge branch 'master' of https://github.com/coveo/ui-kit
mmitiche Mar 11, 2024
986efe8
Merge branch 'master' of https://github.com/coveo/ui-kit
mmitiche Mar 12, 2024
5305dae
Merge branch 'master' of https://github.com/coveo/ui-kit
mmitiche Mar 14, 2024
ea7492a
Merge branch 'master' of https://github.com/coveo/ui-kit
mmitiche Mar 19, 2024
0936b36
Merge branch 'master' of https://github.com/coveo/ui-kit
mmitiche Mar 19, 2024
7a04068
Merge branch 'master' of https://github.com/coveo/ui-kit
mmitiche Mar 22, 2024
ddb8da2
Merge branch 'master' of https://github.com/coveo/ui-kit
mmitiche Mar 25, 2024
a33bf41
Merge branch 'master' of https://github.com/coveo/ui-kit
mmitiche Mar 27, 2024
e50d37e
Merge branch 'master' of https://github.com/coveo/ui-kit
mmitiche Mar 28, 2024
dd10cec
Merge branch 'master' of https://github.com/coveo/ui-kit
mmitiche Apr 4, 2024
6947098
Merge branch 'master' of https://github.com/coveo/ui-kit
mmitiche Apr 8, 2024
2895797
Merge branch 'master' of https://github.com/coveo/ui-kit
mmitiche Apr 12, 2024
e54f20f
Merge branch 'master' of https://github.com/coveo/ui-kit
mmitiche Apr 15, 2024
be7cbc5
Merge branch 'master' of https://github.com/coveo/ui-kit
mmitiche Apr 15, 2024
0409e34
Merge branch 'master' of https://github.com/coveo/ui-kit
mmitiche Apr 17, 2024
bc13eec
Merge branch 'master' of https://github.com/coveo/ui-kit
mmitiche Apr 18, 2024
ce982c7
Merge branch 'master' of https://github.com/coveo/ui-kit
mmitiche Apr 19, 2024
f016a13
Merge branch 'master' of https://github.com/coveo/ui-kit
mmitiche Apr 22, 2024
1655e44
Merge branch 'master' of https://github.com/coveo/ui-kit
mmitiche Apr 23, 2024
f2a797e
Merge branch 'master' of https://github.com/coveo/ui-kit
mmitiche Apr 25, 2024
440c622
Merge branch 'master' of https://github.com/coveo/ui-kit
mmitiche May 9, 2024
f4651c3
Merge branch 'master' of https://github.com/coveo/ui-kit
mmitiche May 15, 2024
d7520b2
Merge branch 'master' of https://github.com/coveo/ui-kit
mmitiche May 16, 2024
d0f7f0b
Merge branch 'master' of https://github.com/coveo/ui-kit
mmitiche May 20, 2024
905d0a3
Merge branch 'master' of https://github.com/coveo/ui-kit
mmitiche May 23, 2024
fd01275
recent queries integrated in search box
mmitiche May 30, 2024
3319eb9
improvements performed
mmitiche May 30, 2024
aab30e4
public property added
mmitiche May 30, 2024
b38661a
Merge branch 'master' of https://github.com/coveo/ui-kit
mmitiche May 30, 2024
d22564c
e2e tests created
mmitiche May 31, 2024
ef33eea
keyboard navigations tests added
mmitiche May 31, 2024
e26a0c3
new tests added
mmitiche May 31, 2024
fb7f232
new tests added
mmitiche Jun 2, 2024
f4147a5
labels added
mmitiche Jun 2, 2024
df6cf60
minor changes
mmitiche Jun 3, 2024
99c63af
Merge branch 'master' into SFINT-5429
mmitiche Jun 3, 2024
a9da0eb
Merge branch 'master' of https://github.com/coveo/ui-kit
mmitiche Jun 4, 2024
9a9172b
Merge branch 'master' of https://github.com/coveo/ui-kit
mmitiche Jun 5, 2024
d757276
Update packages/quantic/force-app/main/default/lwc/quanticSearchBoxSu…
mmitiche Jun 6, 2024
1810a64
correct analytics sent on recent query click
mmitiche Jun 7, 2024
50f1b81
new test added
mmitiche Jun 7, 2024
9475972
test community updated
mmitiche Jun 7, 2024
0adf853
Merge branch 'SFINT-5429' of https://github.com/coveo/ui-kit into SFI…
mmitiche Jun 7, 2024
9d41633
Merge branch 'master' of https://github.com/coveo/ui-kit into SFINT-5429
mmitiche Jun 7, 2024
1379b54
Update packages/quantic/force-app/examples/main/lwc/exampleQuanticSea…
mmitiche Jun 7, 2024
06c5822
js doc commit improved
mmitiche Jun 7, 2024
15ed4bf
Merge branch 'master' of https://github.com/coveo/ui-kit
mmitiche Jun 7, 2024
8fbbe2c
Merge branch 'master' of https://github.com/coveo/ui-kit
mmitiche Jun 10, 2024
34066e5
logic to handle proxy object updated
mmitiche Jun 11, 2024
ac6eec8
Merge branch 'master' into SFINT-5571
mmitiche Jun 12, 2024
098b059
Merge branch 'SFINT-5571' of https://github.com/coveo/ui-kit into SFI…
mmitiche Jun 12, 2024
d1c714e
comments added
mmitiche Jun 12, 2024
170affb
PR feedback applied
mmitiche Jun 13, 2024
6c109c9
Merge branch 'master' of https://github.com/coveo/ui-kit into SFINT-5429
mmitiche Jun 13, 2024
818b5b1
Merge branch 'SFINT-5429' of https://github.com/coveo/ui-kit into SFI…
mmitiche Jun 13, 2024
cb8a25b
variable name updated
mmitiche Jun 13, 2024
8ce06a6
variable name updated
mmitiche Jun 13, 2024
cc86be2
variable name updated
mmitiche Jun 13, 2024
e1b40c2
variable name updated
mmitiche Jun 13, 2024
57d32df
search box issues fixed
mmitiche Jun 26, 2024
ca3612a
search box issues fixed
mmitiche Jun 26, 2024
6ea2663
search box issues fixed
mmitiche Jun 26, 2024
6bd6666
search box issues fixed
mmitiche Jun 26, 2024
0017243
Merge branch 'master' into SFINT-5576
mmitiche Jun 26, 2024
5d93c27
search box issues fixed
mmitiche Jun 26, 2024
02c93e6
Merge branch 'SFINT-5576' of https://github.com/coveo/ui-kit into SFI…
mmitiche Jun 26, 2024
eeb06ce
labels added
mmitiche Jun 27, 2024
a7cb711
Merge branch 'master' into SFINT-5576
mmitiche Jun 27, 2024
831efd1
improvements added
mmitiche Jun 27, 2024
6c31799
test adjusted
mmitiche Jun 27, 2024
e3505ab
Merge branch 'master' into SFINT-5576
mmitiche Jun 27, 2024
8ecb6f1
handling value of input improved
mmitiche Jun 27, 2024
f930345
Merge branch 'SFINT-5576' of https://github.com/coveo/ui-kit into SFI…
mmitiche Jun 27, 2024
5c2bc7a
pr feedback applied
mmitiche Jul 4, 2024
efa5c43
pr feedback applied
mmitiche Jul 4, 2024
88966ad
pr feedback applied
mmitiche Jul 4, 2024
cbec7c3
pr feedback applied
mmitiche Jul 12, 2024
82bb5b4
pr feedback applied
mmitiche Jul 17, 2024
f135d88
Merge branch 'master' of https://github.com/coveo/ui-kit into SFINT-5576
mmitiche Jul 19, 2024
2243533
property name adjusted
mmitiche Jul 19, 2024
4a4b723
expectation removed
mmitiche Jul 22, 2024
13c2db6
tests improved
mmitiche Jul 22, 2024
6aa6f78
Merge branch 'master' into SFINT-5576
mmitiche Jul 22, 2024
ab940c2
test adjust to remove flakiness
mmitiche Jul 22, 2024
3da6a7c
Merge branch 'SFINT-5576' of https://github.com/coveo/ui-kit into SFI…
mmitiche Jul 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import {SearchBoxSelector, SearchBoxSelectors} from './search-box-selectors';

const standaloneSearchBoxActions = (selector: SearchBoxSelector) => {
return {
typeInSearchBox: (query: string, textarea = false) => {
selector
.input(textarea)
.type(query)
.logAction(`when typing "${query}" in search box`);
},
pressDownArrowOnSearchBox: (textarea = false) => {
selector.input(textarea).type('{downarrow}');
},
pressEnterOnSearchBox: (textarea = false) => {
selector.input(textarea).type('{enter}');
},
clickQuerySuggestion: (index: number) => {
selector.querySuggestionByIndex(index).click();
},
clickClearRecentQueriesButton: () => {
selector.clearRecentQueriesButton().click();
},
focusSearchBox: (textarea = false) => {
selector.input(textarea).then((searchbox) => {
cy.wrap(searchbox).focus();
});
},
blurSearchBox: (textarea = false) => {
selector.input(textarea).blur({force: true});
},
};
};

export const SearchBoxActions = {
...standaloneSearchBoxActions(SearchBoxSelectors),
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
import {InterceptAliases} from '../../../page-objects/search';
import {should} from '../../common-selectors';
import {AriaLiveExpectations} from '../../default-1/aria-live/aria-live-expectations';
import {SearchBoxSelectors, SearchBoxSelector} from './search-box-selectors';

function searchBoxExpectations(selector: SearchBoxSelector) {
return {
displayClearRecentQueriesButton: (display: boolean) => {
selector
.clearRecentQueriesButton()
.should(display ? 'exist' : 'not.exist')
.logDetail(
`${should(display)} display the 'clear recent queries' button`
);
},
querySuggestionsEquals: (querySuggestions: String[]) => {
querySuggestions.forEach((querySuggestion, index) => {
selector
.querySuggestionByIndex(index)
.invoke('attr', 'data-rawvalue')
.should('equal', querySuggestion)
mmitiche marked this conversation as resolved.
Show resolved Hide resolved
.logDetail(
'should display the query suggestions properly and in the correct order'
);
});
},
searchWithQuery: (
mmitiche marked this conversation as resolved.
Show resolved Hide resolved
expectedQuery: string,
expectedRecentQueriesInLocalStorage?: {LSkey: string; queries: string[]}
) => {
cy.wait(InterceptAliases.Search)
.then((interception) => {
const requestBody = interception.request.body;
expect(requestBody).to.have.property('q', expectedQuery);
if (expectedRecentQueriesInLocalStorage) {
const {LSkey, queries} = expectedRecentQueriesInLocalStorage;
const recentQueries = window.localStorage.getItem(LSkey);
expect(recentQueries).to.equal(JSON.stringify(queries));
}
})
.logDetail(
`should make a search request with the query ${expectedQuery}`
erocheleau marked this conversation as resolved.
Show resolved Hide resolved
);
},
displaySearchBoxInput: (display: boolean, textarea = false) => {
selector
.input(textarea)
.should(display ? 'exist' : 'not.exist')
.logDetail(`${should(display)} display the input search box`);
mmitiche marked this conversation as resolved.
Show resolved Hide resolved
},
displaySearchButton: (display: boolean) => {
selector
.searchButton()
.should(display ? 'exist' : 'not.exist')
.logDetail(`${should(display)} display the search button`);
},
displaySuggestionList: (display: boolean) => {
selector
.suggestionList()
.should(display ? 'exist' : 'not.exist')
.logDetail(`${should(display)} display the query suggestions list`);
},
numberOfQuerySuggestions: (value: number) => {
selector
.querySuggestions()
.should('have.length', value)
.logDetail(`should display ${value} query suggestions`);
},
searchInputHasAriaOwnsValue: (textarea = false) => {
mmitiche marked this conversation as resolved.
Show resolved Hide resolved
selector
.input(textarea)
.then((inputElement) => {
selector.suggestionList().then((suggestionListElement) => {
const actualValue = inputElement[0].getAttribute('aria-owns');
expect(actualValue).to.equal(suggestionListElement[0].id);
});
return;
})
.logDetail(
'The search input should have the id of the suggestion list as its value for the aria-owns attribute'
);
},
searchInputHasAriaActiveDescendantValue: (
mmitiche marked this conversation as resolved.
Show resolved Hide resolved
textarea = false,
index: number
) => {
selector
.input(textarea)
.then((inputElement) => {
selector
.querySuggestionByIndex(index)
.then((suggestionOptionElement) => {
const actualValue = inputElement[0].getAttribute(
'aria-activedescendant'
);
expect(actualValue).to.equal(suggestionOptionElement[0].id);
});
return;
})
.logDetail(
`the aria-activedescendant attribute of the searchbox input should have the id of the ${index}-th suggestion as its value`
);
},
searchInputHasNoAriaActiveDescendantValue: (textarea = false) => {
mmitiche marked this conversation as resolved.
Show resolved Hide resolved
selector
.input(textarea)
.should('not.have.attr', 'aria-activedescendant')
.logDetail(
'The search input should not have the aria-activedescendant attribute'
);
},
logClearRecentQueries: () => {
cy.wait(InterceptAliases.UA.RecentQueries.ClearRecentQueries)
.then((interception) => {
const analyticsBody = interception.request.body;
expect(analyticsBody).to.have.property('eventType', 'recentQueries');
})
.logDetail("should log the 'clearRecentQueries' UA event");
},
logClickRecentQueries: (queryText: string) => {
cy.wait(InterceptAliases.UA.RecentQueries.ClickRecentQueries)
.then((interception) => {
const analyticsBody = interception.request.body;
expect(analyticsBody).to.have.property('queryText', queryText);
})
.logDetail(
`should log the 'recentQueriesClick' UA event with the correct value: ${queryText}`
);
},
logClickSuggestion: (queryText: string) => {
cy.wait(InterceptAliases.UA.OmniboxAnalytics)
.then((interception) => {
const analyticsBody = interception.request.body;
expect(analyticsBody).to.have.property('queryText', queryText);
})
.logDetail("should log the 'omniboxAnalytics' UA event");
},
};
}

export const SearchBoxExpectations = {
...searchBoxExpectations(SearchBoxSelectors),
ariaLive: {
...AriaLiveExpectations,
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import {ComponentSelector, CypressSelector} from '../../common-selectors';

export const standaloneSearchBoxComponent = 'c-quantic-search-box';

export interface SearchBoxSelector extends ComponentSelector {
input: (textarea?: boolean) => CypressSelector;
mmitiche marked this conversation as resolved.
Show resolved Hide resolved
quanticSearchBoxInput: () => CypressSelector;
mmitiche marked this conversation as resolved.
Show resolved Hide resolved
suggestionList: () => CypressSelector;
searchButton: () => CypressSelector;
clearRecentQueriesButton: () => CypressSelector;
querySuggestions: () => CypressSelector;
querySuggestionByIndex: (index: number) => CypressSelector;
}

export const SearchBoxSelectors: SearchBoxSelector = {
get: () => cy.get(standaloneSearchBoxComponent),
quanticSearchBoxInput: () =>
SearchBoxSelectors.get().find('[data-cy="quantic-search-box-input"]'),
input: (textarea = false) =>
SearchBoxSelectors.get().find(
`c-quantic-search-box-input [data-cy="${textarea ? 'search-box-textarea' : 'search-box-input'}"]`
),
suggestionList: () =>
SearchBoxSelectors.get().find(
'c-quantic-search-box-suggestions-list [data-cy="suggestion-list"]'
),
searchButton: () =>
SearchBoxSelectors.get().find(
'c-quantic-search-box-input [data-cy="search-box-submit-button"]'
),
clearRecentQueriesButton: () =>
SearchBoxSelectors.get().find(
'c-quantic-search-box-input [data-cy="clear-recent-queries"]'
),
querySuggestions: () =>
SearchBoxSelectors.get().find(
'c-quantic-search-box-input [data-cy="suggestions-option"]'
),
querySuggestionByIndex: (index: number) =>
SearchBoxSelectors.querySuggestions().eq(index),
};
Loading
Loading