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

EDSC-4162: Create a Guided Tour For Users of Earthdata Search #1800

Open
wants to merge 42 commits into
base: main
Choose a base branch
from

Conversation

dpesall
Copy link
Member

@dpesall dpesall commented Sep 10, 2024

Overview

What is the feature?

Creating a guided tour for EDSC users

What is the Solution?

Creating a tour using React-Joyride

What areas of the application does this impact?

EDSC Search Endpoint

Testing

Reproduction steps

  1. Click "Start Tour" on the toolbar
  2. Verify that all the steps work and the links function

Attachments

Please include relevant screenshots or files that would be helpful in reviewing and verifying this change.

Checklist

  • I have added automated tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

Copy link

codecov bot commented Sep 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.44%. Comparing base (8114767) to head (26fe840).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1800      +/-   ##
==========================================
+ Coverage   93.38%   93.44%   +0.05%     
==========================================
  Files         765      772       +7     
  Lines       18451    18543      +92     
  Branches     4761     4780      +19     
==========================================
+ Hits        17231    17328      +97     
+ Misses       1136     1131       -5     
  Partials       84       84              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@macrouch macrouch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a Playwright test would make sense to ensure each step works as intended, and we don't break it in the future

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

732 Lines is a huge component. To make it easier for devs to parse you could split out components into their own files (that would also make testing each component easier). You could also look at moving the steps into their own file, that seems like the vast majority of the actual lines.

width: 4000px;
left: calc(100%);
pointer-events: none;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newline

@@ -104,11 +103,20 @@ describe('Search component', () => {
expect(portalFeatureContainer.props().advancedSearch).toBeTruthy()
})

test('calls onTogglePortalBrowserModal(true) when "Browse Portals" button is clicked', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious if this was added for anything to do with the tour? Seems like a good test anyway

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason, it was showing this was missing test coverage on my PR? So I just went ahead and added a test to cover it.

</div>
),
placement: 'right',
styles: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are gonna want to move alot of the repeated css into a classname also the bootstrap classes should be favored since we don't have to maintain them

@dpesall dpesall marked this pull request as ready for review October 7, 2024 19:54
const isSiteTourEnabled = disableSiteTour === 'false'
const hasUserDisabledTour = localStorage.getItem('dontShowTour') === 'true'
const isLocalhost = window.location.hostname === 'localhost'
const shouldShowTour = isSiteTourEnabled && !hasUserDisabledTour && !isLocalhost
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look into Playwright env variables to make the tour not run on each playwright test

@@ -71,6 +73,7 @@
margin-right: 0.5rem;
}

&__begin-tour-button,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename to start-tour-button

}, [runTour])

useEffect(() => {
if (stepIndex === 6) { // Scrolling to the top to ensure "Browse Portals" is visible.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Provide more detail


const handleJoyrideCallback = (data) => {
const {
action, index, status, type
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put these on newlines

Comment on lines 78 to 97
{
options: {
primaryColor: '#007bff',
zIndex: 10000,
textAlign: 'left',
width: '600px'
},
tooltip: {
fontSize: '16px',
padding: '20px',
paddingTop: '0px',
textAlign: 'left'
},
tooltipContent: {
textAlign: 'left'
},
buttonNext: {
// Hide the next button since we use custom buttons
display: 'none'
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rem instead of pixels, try to find a way to use class names instead of inline styling

Comment on lines 100 to 112
floaterProps={
{
disableAnimation: true,
styles: {
button: {
borderRadius: '4px',
padding: '8px 16px',
fontSize: '14px'
}
}
}
}
/>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above comment

Comment on lines 489 to 493
{
fontSize: '16px',
fontWeight: 'bold',
marginBottom: '5px'
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as previous comment

Comment on lines 535 to 543
styles: {
tooltip: {
width: '600px',
padding: '20px'
},
tooltipContent: {
fontSize: '16px'
}
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as previous comment

await expect(page.locator('.tour-content').first()).toContainText('This area contains the filters used when searching for collections')

// Move forward to the next step again using the "Next" button
await page.locator('.tour-buttons button:has-text("Next")').click()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try removing class names from use by locator

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try page.getByRole()

Comment on lines +61 to +64
for (let i = 0; i < 10; i += 1) {
// eslint-disable-next-line no-await-in-loop
await page.locator('.tour-buttons button:has-text("Next")').click()
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure to check that each step is highlighting the proper section

// Ensure the tour is closed by checking that the tour container is no longer visible
await expect(page.locator('.tour-container')).toBeHidden()
})
})
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add test to ensure the tour starts up for a brand new user by default

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants