Skip to content

Commit

Permalink
chore: Argos screenshot dogfooding test pages (#10650)
Browse files Browse the repository at this point in the history
  • Loading branch information
slorber authored Nov 7, 2024
1 parent 1955002 commit e32aa60
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/argos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
run: npx playwright install --with-deps chromium

- name: Build website fast
run: yarn build:website:fast --dev
run: yarn argos:build

- name: Take Argos screenshots
run: yarn argos:screenshot
28 changes: 28 additions & 0 deletions argos/tests/screenshot.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,38 @@ function isBlacklisted(pathname: string) {
'/showcase',
// Long blog post with many image carousels, often timeouts
'/blog/2022/08/01/announcing-docusaurus-2.0',

// DOGFOOD TESTS
// React key errors:
'/tests/docs/tests/toc-partials',
// Console errors
'/tests/pages/diagrams',
'/tests/pages/markdown-tests-md',
// Flaky because of hydration error
'/tests/blog/archive',
'/tests/docs/tests/custom-props',
'/tests/pages/code-block-tests',
'/tests/pages/embeds',
// Flaky because of hydration error with docusaurus serve + .html
'/tests/blog/x/y/z.html',
'/tests/docs/dummy.html',
// Cause weird docusaurus serve errors:
'/tests/docs/tests/ascii/%C3%A6%C3%B8%C3%A5',
'/tests/docs/tests/ascii/folder/%C3%A6%C3%B8%C3%A5',
];

return (
// changelog docs
pathname.startsWith('/changelog') ||
// versioned docs
pathname.match(/^\/docs\/((\d\.\d\.\d)|(next))\//) ||
// verbose useless dogfooding pages
pathname.startsWith('/tests/docs/toc/') ||
pathname.startsWith('/tests/docs/tags/') ||
pathname.startsWith('/tests/docs/tests/category-links') ||
pathname.startsWith('/tests/docs/tests/visibility') ||
pathname.startsWith('/tests/blog/page/') ||
pathname.startsWith('/tests/blog/tags/') ||
// manually excluded urls
BlacklistedPathnames.includes(pathname)
);
Expand Down Expand Up @@ -127,6 +152,9 @@ function throwOnConsole(page: Page) {
// on /docs/markdown-features/math-equations
'Failed to decode downloaded font: http://localhost:3000/katex/fonts/',
'OTS parsing error: Failed to convert WOFF 2.0 font to SFNT',

// Mermaid warning, see https://github.com/mermaid-js/mermaid/issues/6031
'Do not assign mappings to elements without corresponding data',
];

page.on('console', (message) => {
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
"crowdin:upload:website": "crowdin upload sources --config ./crowdin-v2.yaml",
"crowdin:download": "crowdin download --config ./crowdin-v2.yaml",
"crowdin:download:website": "yarn crowdin:download --language fr --language ko --language pt-BR --language zh-CN --language ja",
"argos": "yarn argos:build && yarn argos:screenshot",
"argos:build": "cross-env DOCUSAURUS_ARGOS_BUILD=true yarn build:website:fast --dev",
"argos:screenshot": "yarn workspace argos screenshot",
"canary": "yarn canary:bumpVersion && yarn canary:publish",
"canary:getCoreVersion": "node -p \"require('./packages/docusaurus/package.json').version\"",
Expand Down
1 change: 1 addition & 0 deletions project-words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ docusuarus
Docz
dogfood
Dogfood
DOGFOOD
dogfooding
Dogfooding
Dojocat
Expand Down
10 changes: 9 additions & 1 deletion website/_dogfooding/dogfooding.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ import type {Options as DocsOptions} from '@docusaurus/plugin-content-docs';
import type {Options as BlogOptions} from '@docusaurus/plugin-content-blog';
import type {Options as PageOptions} from '@docusaurus/plugin-content-pages';

export const isArgosBuild = process.env.DOCUSAURUS_ARGOS_BUILD === 'true';

if (isArgosBuild) {
console.warn(
'Building site for Argos CI - additional dogfooding pages will be preserved in sitemap',
);
}

export function dogfoodingTransformFrontMatter(frontMatter: {
[key: string]: unknown;
}): {[key: string]: unknown} {
Expand Down Expand Up @@ -39,7 +47,7 @@ export const dogfoodingPluginInstances: PluginConfig[] = [
sidebarPath: '_dogfooding/docs-tests-sidebars.js',
versions: {
current: {
noIndex: true,
noIndex: !isArgosBuild,
},
},
onInlineTags: 'warn',
Expand Down
7 changes: 5 additions & 2 deletions website/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
dogfoodingThemeInstances,
dogfoodingRedirects,
dogfoodingTransformFrontMatter,
isArgosBuild,
} from './_dogfooding/dogfooding.config';

import ConfigLocalized from './docusaurus.config.localized.json';
Expand Down Expand Up @@ -538,8 +539,10 @@ export default async function createConfigAsync() {
}
: undefined,
sitemap: {
// Note: /tests/docs already has noIndex: true
ignorePatterns: ['/tests/{blog,pages}/**'],
ignorePatterns: isArgosBuild
? undefined
: // Note: /tests/docs already has noIndex: true
['/tests/{blog,pages}/**'],
lastmod: 'date',
priority: null,
changefreq: null,
Expand Down

0 comments on commit e32aa60

Please sign in to comment.