Skip to content

Conversation

@rogermparent
Copy link
Contributor

@rogermparent rogermparent commented Dec 12, 2025

2025-12-11_22-07-13.mp4

Hello! I had the opportunity to test out an AI coding tool and decided to try out a little change on this site I used to work on. I took the opportunity to do something I wished I would have a long while ago- set up e2e tests!

I figured this code could be helpful even if just as a proof-of-concept, so I've turned it into a PR here. Feel free to use it or decide not to.

One unfortunate quirk I've noticed is that when running the test suite against the production server, the test will attempt to click the mobile sidebar toggle button and nothing will happen, causing the test to fail. Somehow I haven't been able to get it to happen in the dev server version or the headless run, and I didn't want to invest too more time untangling this edge case.

@CLAassistant
Copy link

CLAassistant commented Dec 12, 2025

CLA assistant check
All committers have signed the CLA.

<span className={bulletIconClassName}></span>
)}
{label} <ExternalLinkIcon />
{label} <ExternalLinkIcon aria-label="External Link" />
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Used as a testing target and possibly a little a11y bonus.

Comment on lines -55 to +61
<div
<nav
className={cn(styles.menu, isScrollHidden && styles.isScrollHidden)}
ref={rootRef}
aria-label="Documentation Navigation"
>
<InnerSidebar onClick={onClick} activePaths={activePaths} />
</div>
</nav>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tweaked to add a reliable test target

Comment on lines +40 to +44
aria-label={
isMenuOpen
? 'Close documentation sidebar'
: 'Open documentation sidebar'
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tweaked to add a target for tests. Changes when open/closed in an attempt to be able to target something visible to verify the sidebar is open when trying to fix the odd sidebar-not-opening issue, but it didn't work. Still kept since I think it's good for a11y.

Comment on lines +16 to +21
"cypress:open": "cypress open --e2e",
"cypress:run": "cypress run --e2e",
"cypress:test": "start-server-and-test develop http://localhost:8000 cypress:run",
"cypress:test:open": "start-server-and-test develop http://localhost:8000 cypress:open",
"cypress:test:prod": "CYPRESS_BASE_URL=http://localhost:3000 start-server-and-test start http://localhost:3000 cypress:run",
"cypress:test:prod:open": "CYPRESS_BASE_URL=http://localhost:3000 start-server-and-test start http://localhost:3000 cypress:open",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This setup is just kind of arbitrary, but allows for all permutations of running the tests with dev/prod and run/open. The non start-server-and-test entries can be removed if you replace the script name passed to start-server-and-test with an escaped version of the full command (e.g. replace cypress:open with \"cypress open --e2e\")

The --e2e flag makes the Cypress UI go straight to e2e, which makes sense here because there's no component tests.

@skshetry
Copy link
Collaborator

Hey, @rogermparent. Thanks for creating this PR. Unfortunately, I'd have to decline this.
The e2e tests adds maintenance burden that I can't take at the moment. The site is only serving docs now, for which the engine is too complex, so we’re likely to move to something simpler like mkdocs or zensical given the state of Gatsby.

@rogermparent
Copy link
Contributor Author

Understood! I'd probably do the same in your current position. Good luck!

@rogermparent
Copy link
Contributor Author

rogermparent commented Dec 12, 2025

I looked into mkdocs and zensical. They seem solid, but for porting this site's docs in particular I'd personally recommend Docusaurus specifically because its MDX and custom component support makes it the closest to this site's architecture and likely the least work to port. It's also an SSG so it should host just as well (better, really, given this site's janky middleware proxy thing).
Zensical has custom components on the roadmap and mkdocs seems to made intentionally simple such that they won't support it.

No worries if you've already thought this through and my advice is redundant, I just had the thought and figured it could be helpful to share. Custom component support was the main sticking point I had when researching other potential engines in the past.

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