Skip to content

Commit

Permalink
Use autosuggest search API.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hyperkid123 committed Nov 1, 2023
1 parent 2dbda74 commit afafff9
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 269 deletions.
64 changes: 3 additions & 61 deletions cypress/e2e/release-gate/search.cy.tsx
Original file line number Diff line number Diff line change
@@ -1,69 +1,11 @@
const searchResponse = {
response: {
numFound: 2,
start: 0,
maxScore: 10.0,
docs: [
{
id: 'hcc-module-/openshift/create-OPENSHIFT.cluster.create.azure',
view_uri: 'https://console.redhat.com/openshift/create',
documentKind: 'ModuleDefinition',
allTitle: 'Azure Red Hat OpenShift',
bundle: ['openshift'],
bundle_title: ['OpenShift'],
relative_uri: '/openshift/create',
alt_titles: ['ARO', 'Azure', 'OpenShift on Azure'],
abstract: 'https://console.redhat.com/openshift/create',
timestamp: '2023-08-22T17:01:31.717Z',
_version_: 1774949404248113152,
},
{
id: 'hcc-module-/openshift/releases-openshift.releases',
view_uri: 'https://console.redhat.com/openshift/releases',
documentKind: 'ModuleDefinition',
allTitle: 'Releases',
bundle: ['openshift'],
bundle_title: ['OpenShift'],
relative_uri: '/openshift/releases',
icons: 'InfrastructureIcon',
abstract: 'View general information on the most recent OpenShift Container Platform release versions that you can install.',
timestamp: '2023-08-15T10:55:46.769Z',
_version_: 1774949404248113152,
},
],
},
highlighting: {
'hcc-module-/openshift/create-OPENSHIFT.cluster.create.azure': {
abstract: ['https://console.redhat.com/<mark>openshift</mark>/create'],
allTitle: ['Azure Red Hat <mark>OpenShift</mark>'],
bundle: ['<mark>openshift</mark>'],
},
'hcc-module-/openshift/releases-openshift.releases': {
abstract: ['View general information on the most recent <mark>OpenShift</mark> Container Platform release versions that you can install.'],
allTitle: ['Releases'],
bundle: ['<mark>openshift</mark>'],
},
},
};

describe('Search', () => {
it('search for openshift services', () => {
cy.login();
cy.visit('/');
cy.intercept(
{
method: 'GET',
url: '**/hydra/rest/search/**',
},
searchResponse
).as('search');
cy.wait(4000);
cy.get('.chr-c-search__input').click().type('openshift');
cy.wait('@search').its('response.statusCode').should('equal', 200);
cy.get('@search.all').should('have.length', 1);
cy.screenshot();
cy.get('.chr-c-search__input').should('contain', 'Top 2 results');
cy.get('.chr-c-search__input li').first().should('contain', 'Azure');
cy.get('.chr-c-search__input li').last().should('contain', 'Releases').click();
cy.url().should('contain', '/openshift/releases');
cy.get('.chr-c-search__input').should('contain', 'Top 10 results');
cy.get('.chr-c-search__input li').first().should('contain', 'Red Hat OpenShift');
});
});
48 changes: 0 additions & 48 deletions src/components/Search/SearchGroup.tsx

This file was deleted.

Loading

0 comments on commit afafff9

Please sign in to comment.