diff --git a/cypress/e2e/2-travel-study/destinations-filter.cy.ts b/cypress/e2e/2-travel-study/destinations-filter.cy.ts index 3e1477593..81afec152 100644 --- a/cypress/e2e/2-travel-study/destinations-filter.cy.ts +++ b/cypress/e2e/2-travel-study/destinations-filter.cy.ts @@ -19,19 +19,19 @@ describe('Travel-Study Destinations Page', () => { cy.wait(1000); // Select Filter Month and check for URL update - cy.get('[data-test="filter-option--october"]').first().check({ force: true }); - cy.url().should('contain', 'trip-month=oct'); + cy.get('[data-test="filter-option--february"]').first().check({ force: true }); + cy.url().should('contain', 'trip-month=feb'); // Load the filter from the URL - cy.visit('/travel-study/destinations/?page=1&trip-month=oct'); + cy.visit('/travel-study/destinations/?page=1&trip-month=feb'); // Confirm chip exists - cy.get('[data-test="chip:October"]').should('exist'); + cy.get('[data-test="chip:February"]').should('exist'); // Confirm that a trip card exists cy.get('.trip-filter-page article h3').should('exist'); // Clear Filters and check for URL update cy.get('[data-test="filter-btn--clear-all"]').first().click({force: true}); - cy.url().should('not.contain', 'trip-month=oct'); + cy.url().should('not.contain', 'trip-month=feb'); // Enable family focused filter cy.visit('/travel-study/destinations/?page=1&trip-experience=family-focused'); diff --git a/cypress/e2e/2-travel-study/registration-form.cy.ts b/cypress/e2e/2-travel-study/registration-form.cy.ts index 3eb9278aa..6658d414b 100644 --- a/cypress/e2e/2-travel-study/registration-form.cy.ts +++ b/cypress/e2e/2-travel-study/registration-form.cy.ts @@ -46,16 +46,16 @@ describe('Travel-Study Trip Registration Form Page', () => { // Confirm form exists cy.get('[id="su-embed"]').should('exist'); cy.get('form').should('exist'); - + // Confirm that the user's name is prefilled cy.get('[data-fieldid="DigitalName"]').should('contain.value', 'Teri Dactyl'); - + // Confirm email is prefilled cy.get('[data-fieldid="ContactEmail"]').should('contain.value', 'tdactyl@test.com'); // Confirm phone number is prefilled cy.get('[data-fieldid="PhoneNumber"]').should('contain.value', '4081111111'); - + // Fill required questions cy.get('[data-fieldid="Pre-TripExtension__0"]').first().check({force: true}); cy.get('[data-fieldid="Post-TripExtension__0"]').first().check({force: true}); @@ -70,7 +70,7 @@ describe('Travel-Study Trip Registration Form Page', () => { // Visit the membership form page URL cy.visit('/travel-study/destinations/finland-2022/finland-reg-form/form'); - + // Confirm that the URL redirect to the expected URL cy.url().should('include', '/travel-study/destinations/finland-2022/finland-reg-form'); cy.reload(); // Needed for local Gatsby build diff --git a/cypress/e2e/4-search/search-results.cy.ts b/cypress/e2e/4-search/search-results.cy.ts index 83edaaa00..3da4e16de 100644 --- a/cypress/e2e/4-search/search-results.cy.ts +++ b/cypress/e2e/4-search/search-results.cy.ts @@ -9,7 +9,7 @@ describe('Search Results', () => { }) cy.get('[data-test="search--modal-input"]').should('exist').type('travel study'); - cy.get('[data-cy="search--submit-btn"]').first().click(); + cy.get('[data-test="search--submit-btn"]').first().click(); cy.reload({timeout: 1000}) // Needed for local Gatsby build cy.url().should('include', '/search/?q=travel%20study'); @@ -35,7 +35,7 @@ describe('Search Results', () => { cy.reload() // Needed for local Gatsby build cy.get('h1').should('contain.text', 'Search for...'); - cy.get('section > div form input[data-test="search--modal-input"]').should('contain.value','lorem ipsum'); + cy.get('#search-field-input').should('contain.value','lorem ipsum'); cy.get('h2').should('contain.text', 'We’re sorry, we couldn’t find results for “lorem ipsum”.') cy.get('h3').should('contain.text', 'Consider Browsing by Category:') diff --git a/src/components/search/Modal/SearchFieldModal.jsx b/src/components/search/Modal/SearchFieldModal.jsx index 5c058cd82..fb8e5ac0f 100644 --- a/src/components/search/Modal/SearchFieldModal.jsx +++ b/src/components/search/Modal/SearchFieldModal.jsx @@ -138,6 +138,7 @@ const SearchFieldModal = React.forwardRef(({ emptySearchMessage }, ref) => { placeholder="Search" InputProps={{ ...params.InputProps, type: 'searchbox' }} inputRef={ref} + data-test="search--modal-input" /> )} @@ -190,6 +191,7 @@ const SearchFieldModal = React.forwardRef(({ emptySearchMessage }, ref) => { type="submit" aria-label="Search events" className="su-flex su-items-center su-justify-center su-min-w-[4rem] su-w-40 su-h-40 md:su-min-w-[7rem] md:su-w-70 md:su-h-70 md:children:su-w-40 md:children:su-h-40 su-rounded-full su-transition-colors su-bg-digital-red hocus:su-bg-digital-red-xlight su-origin-center !su-ml-0" + data-test="search--submit-btn" > diff --git a/src/components/search/SearchField.jsx b/src/components/search/SearchField.jsx index d11bfac34..0962d439d 100644 --- a/src/components/search/SearchField.jsx +++ b/src/components/search/SearchField.jsx @@ -139,6 +139,7 @@ const SearchField = ({ emptySearchMessage }) => { { type="submit" aria-label="Search events" className="su-flex su-items-center su-justify-center su-shrink-0 su-rounded-full su-w-36 su-h-36 md:su-w-50 md:su-h-50 su-bg-digital-red-light hocus:su-bg-cardinal-red-dark su-transition-colors" + data-test="search--submit-btn" > diff --git a/src/components/search/SearchPageContent.jsx b/src/components/search/SearchPageContent.jsx index 014500528..21f614ad7 100644 --- a/src/components/search/SearchPageContent.jsx +++ b/src/components/search/SearchPageContent.jsx @@ -34,7 +34,10 @@ import useDisplay from '../../hooks/useDisplay'; const SearchPageContent = (props) => { const { blok } = props; const { nbHits, areHitsSorted, nbSortedHits } = useStats(); - const { status, started } = useInstantSearch(); + const { + status, + results: { __isArtificial: isArtificial }, + } = useInstantSearch(); const [opened, setOpened] = useState(false); const { refine: clearFilters } = useClearRefinements(); const { showDesktop, showMobile } = useDisplay(); @@ -49,9 +52,8 @@ const SearchPageContent = (props) => { return nbHits; }, [areHitsSorted, nbHits, nbSortedHits]); - const isLoading = status === 'loading' && started; - const isIdle = status === 'idle' && started; - const hasNoResults = resultCount === 0 && isIdle && started; + const isLoading = status === 'loading' && !isArtificial; + const hasNoResults = resultCount === 0 && !isArtificial; return ( @@ -252,7 +254,10 @@ const SearchPageContent = (props) => { {hasNoResults && ( - +