cloudflare-docs-engine icon indicating copy to clipboard operation
cloudflare-docs-engine copied to clipboard

Add tests for links within markdown / e2e test in CI

Open davidtsong opened this issue 4 years ago • 3 comments

"A link in markdown will always 404 if it does not exist instead of using the 301 redirects set up.

We should:

make tests to ensure these links always exist OR design it so that they 301 appropriately Example is The first link on the "Build A To-Do List With KV" page tries to link to the "Workers KV" page"

It would be a nice to have to have broken links detected automatically (ignoring the MDX links). https://github.com/cloudflare/workers-docs/issues/841

davidtsong avatar Aug 26 '20 18:08 davidtsong

Related to https://github.com/cloudflare/workers-docs/issues/838 "End-to-end tests in CI would serve at least two purposes:

They could help prevent many small regressions They would give us the confidence to auto-merge dependency updates Gatsby itself recommends and uses Cypress, which you can read more about here:

https://www.gatsbyjs.org/docs/end-to-end-testing/ https://github.com/gatsbyjs/gatsby/tree/master/e2e-tests Specifically, some of the kind of things I think we can test with e2e tests, but that are hard to test with React component tests or other unit tests, include:

Does navigation work the way we expect (e.g. no unexpected 301s, URLs are rendered with/without trailing slashes)? Ensure that every img element loads successfully Ensure that every link in an article is navigable (i.e. does not result in 404) ?? What do folks think?

Are e2e tests worth the burden? If we were to do this, would Cypress be a good choice, or should we investigate other options?"

davidtsong avatar Aug 26 '20 18:08 davidtsong

Related. to https://github.com/cloudflare/workers-docs/issues/809

"To help contributors and take some burden off reviewers, it would be great if we could integrate automated spell-checking into our pipeline.

https://www.npmjs.com/package/markdown-spellcheck is one such tool; I’m sure there are others.

Questions:

Is this a good idea? What do other documentation repos do? What tool should we use? Where should we integrate this in our pipeline, if we choose to do so?"

davidtsong avatar Aug 26 '20 18:08 davidtsong

Explored CI spell-checking a few months ago and found the Rust Book implemented this using a bash script that leverages aspell. Here's the PR it was implemented in as reference:

https://github.com/rust-lang/book/pull/338

bradyjoslin avatar Aug 26 '20 22:08 bradyjoslin