diff --git a/site/gatsby-site/cypress/e2e/integration/discover.cy.js b/site/gatsby-site/cypress/e2e/integration/discover.cy.js index 701fd362a5..3982c300b7 100644 --- a/site/gatsby-site/cypress/e2e/integration/discover.cy.js +++ b/site/gatsby-site/cypress/e2e/integration/discover.cy.js @@ -25,7 +25,7 @@ describe('The Discover app', () => { cy.waitForStableDOM(); - cy.get('div[class^="tw-hits-container"]').children().should('have.length.at.least', 28); + cy.get('div[data-cy="hits-container"]').children().should('have.length.at.least', 28); }); it('Performs a search and filters results', () => { @@ -46,7 +46,7 @@ describe('The Discover app', () => { cy.waitForStableDOM(); - cy.get('div[class^="tw-hits-container"]').children().should('have.length.at.least', 8); + cy.get('div[data-cy="hits-container"]').children().should('have.length.at.least', 8); }); it('Filters by incident Id using top filters', { retries: { runMode: 4 } }, () => { @@ -70,7 +70,7 @@ describe('The Discover app', () => { cy.waitForStableDOM(); - cy.get('div[class^="tw-hits-container"]').children().should('have.length.at.least', 28); + cy.get('div[data-cy="hits-container"]').children().should('have.length.at.least', 28); }); it('Filters by Language using top filters', { retries: { runMode: 4 } }, () => { @@ -94,7 +94,7 @@ describe('The Discover app', () => { cy.waitForStableDOM(); - cy.get('div[class^="tw-hits-container"]').children().should('have.length.at.least', 4); + cy.get('div[data-cy="hits-container"]').children().should('have.length.at.least', 4); }); it('Filters by Tags using top filters', { retries: { runMode: 4 } }, () => { @@ -118,7 +118,7 @@ describe('The Discover app', () => { cy.waitForStableDOM(); - cy.get('div[class^="tw-hits-container"]').children().should('have.length.at.least', 1); + cy.get('div[data-cy="hits-container"]').children().should('have.length.at.least', 1); }); it('Filters by incident Id using card button', { retries: { runMode: 4 } }, () => { @@ -130,7 +130,7 @@ describe('The Discover app', () => { cy.waitForStableDOM(); - cy.get('div[class^="tw-hits-container"]') + cy.get('div[data-cy="hits-container"]') .children() .get('[title="Filter by Incident ID #10"]') .first() @@ -146,7 +146,7 @@ describe('The Discover app', () => { cy.waitForStableDOM(); - cy.get('div[class^="tw-hits-container"]').children().should('have.length.at.least', 8); + cy.get('div[data-cy="hits-container"]').children().should('have.length.at.least', 8); }); it('Should flag an incident', () => { @@ -501,6 +501,6 @@ describe('The Discover app', () => { cy.waitForStableDOM(); - cy.get('div[class^="tw-hits-container"]').children().should('have.length.at.least', 8); + cy.get('div[data-cy="hits-container"]').children().should('have.length.at.least', 8); }); }); diff --git a/site/gatsby-site/src/components/discover/Hits.js b/site/gatsby-site/src/components/discover/Hits.js index fd57f21b31..f389c771a0 100644 --- a/site/gatsby-site/src/components/discover/Hits.js +++ b/site/gatsby-site/src/components/discover/Hits.js @@ -26,25 +26,19 @@ const Hits = ({ hits, isSearchStalled, toggleFilterByIncidentId, viewType }) => if (!isMounted) return <>>; - let gridClasses = ``; - const isLoading = isSearchStalled && isMounted; - switch (display) { - case 'list': - gridClasses = `${isLoading ? 'flex flex-wrap' : 'grid grid-cols-1'} gap-2`; - break; - case 'compact': - gridClasses = `${isLoading ? 'flex flex-wrap' : 'grid md:grid-cols-4'} gap-2`; - break; - case 'details': - gridClasses = `${isLoading ? 'flex flex-wrap' : 'grid md:grid-cols-4'} gap-2`; - break; - } - return (