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

Add Did you Mean in Instant Results #3564

Merged
merged 9 commits into from
Aug 8, 2023
Merged
Prev Previous commit
Next Next commit
Add E2E test
  • Loading branch information
burhandodhy committed Jul 28, 2023
commit 9b7a4a5b0f1a6da6b4c58aa5d3e758332a990cfc
19 changes: 19 additions & 0 deletions tests/cypress/integration/features/instant-results.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,25 @@ describe('Instant Results Feature', { tags: '@slow' }, () => {
cy.get('.my-custom-result').should('exist');
cy.get('.ep-search-result').should('not.exist');
});

it('Can display a suggestion', () => {
cy.maybeEnableFeature('instant-results');
cy.maybeEnableFeature('did-you-mean');

cy.wpCli('wp elasticpress sync --setup --yes');

/**
* Perform a search.
*/
cy.intercept('*search=wordpre*').as('apiRequest');
cy.visit('/');
cy.get('.wp-block-search').last().as('searchBlock');
cy.get('@searchBlock').find('input[type="search"]').type('wordpre');
cy.get('@searchBlock').find('button').click();
cy.get('.ep-search-modal').should('be.visible');
cy.wait('@apiRequest');
cy.get('.ep-spell-suggestion a').should('have.text', 'wordpress');
});
});

it('Is possible to filter the arguments schema', () => {
Expand Down