Skip to content

Commit

Permalink
Bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
sherakama committed Oct 28, 2024
1 parent 4dd8280 commit 8493d22
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 16 deletions.
10 changes: 5 additions & 5 deletions cypress/e2e/2-travel-study/destinations-filter.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
8 changes: 4 additions & 4 deletions cypress/e2e/2-travel-study/registration-form.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', '[email protected]');

// 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});
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/4-search/search-results.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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:')
Expand Down
2 changes: 2 additions & 0 deletions src/components/search/Modal/SearchFieldModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ const SearchFieldModal = React.forwardRef(({ emptySearchMessage }, ref) => {
placeholder="Search"
InputProps={{ ...params.InputProps, type: 'searchbox' }}
inputRef={ref}
data-test="search--modal-input"
/>
</label>
)}
Expand Down Expand Up @@ -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"
>
<Search className="su-transition su-text-white su-w-18 md:su-w-30 su-h-18 md:su-h-30" />
</button>
Expand Down
2 changes: 2 additions & 0 deletions src/components/search/SearchField.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ const SearchField = ({ emptySearchMessage }) => {
<Autocomplete
freeSolo
id="search-field-input"
data-test="search--input"
popupIcon={null}
disableClearable
disablePortal
Expand Down Expand Up @@ -209,6 +210,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"
>
<Search className="su-transition su-text-white su-w-18 md:su-w-30 su-h-18 md:su-h-30" />
</button>
Expand Down
15 changes: 10 additions & 5 deletions src/components/search/SearchPageContent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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 (
<SbEditable content={blok}>
Expand Down Expand Up @@ -252,7 +254,10 @@ const SearchPageContent = (props) => {
</Grid>

{hasNoResults && (
<Grid xs={12} className="su-rs-mt-7">
<Grid
xs={12}
className={cnb('su-rs-mt-7', { 'su-opacity-30': isLoading })}
>
<SearchNoResults
heading={blok.noResultsHeading}
body={blok.noResultsBody}
Expand Down

0 comments on commit 8493d22

Please sign in to comment.