chore: Argos screenshot dogfooding test pages (#10650)

This commit is contained in:
Sébastien Lorber 2024-11-07 16:12:23 +01:00 committed by GitHub
parent 1955002d3b
commit e32aa605ca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 46 additions and 4 deletions

View file

@ -41,7 +41,7 @@ jobs:
run: npx playwright install --with-deps chromium run: npx playwright install --with-deps chromium
- name: Build website fast - name: Build website fast
run: yarn build:website:fast --dev run: yarn argos:build
- name: Take Argos screenshots - name: Take Argos screenshots
run: yarn argos:screenshot run: yarn argos:screenshot

View file

@ -45,6 +45,24 @@ function isBlacklisted(pathname: string) {
'/showcase', '/showcase',
// Long blog post with many image carousels, often timeouts // Long blog post with many image carousels, often timeouts
'/blog/2022/08/01/announcing-docusaurus-2.0', '/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 ( return (
@ -52,6 +70,13 @@ function isBlacklisted(pathname: string) {
pathname.startsWith('/changelog') || pathname.startsWith('/changelog') ||
// versioned docs // versioned docs
pathname.match(/^\/docs\/((\d\.\d\.\d)|(next))\//) || 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 // manually excluded urls
BlacklistedPathnames.includes(pathname) BlacklistedPathnames.includes(pathname)
); );
@ -127,6 +152,9 @@ function throwOnConsole(page: Page) {
// on /docs/markdown-features/math-equations // on /docs/markdown-features/math-equations
'Failed to decode downloaded font: http://localhost:3000/katex/fonts/', 'Failed to decode downloaded font: http://localhost:3000/katex/fonts/',
'OTS parsing error: Failed to convert WOFF 2.0 font to SFNT', '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) => { page.on('console', (message) => {

View file

@ -41,6 +41,8 @@
"crowdin:upload:website": "crowdin upload sources --config ./crowdin-v2.yaml", "crowdin:upload:website": "crowdin upload sources --config ./crowdin-v2.yaml",
"crowdin:download": "crowdin download --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", "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", "argos:screenshot": "yarn workspace argos screenshot",
"canary": "yarn canary:bumpVersion && yarn canary:publish", "canary": "yarn canary:bumpVersion && yarn canary:publish",
"canary:getCoreVersion": "node -p \"require('./packages/docusaurus/package.json').version\"", "canary:getCoreVersion": "node -p \"require('./packages/docusaurus/package.json').version\"",

View file

@ -67,6 +67,7 @@ docusuarus
Docz Docz
dogfood dogfood
Dogfood Dogfood
DOGFOOD
dogfooding dogfooding
Dogfooding Dogfooding
Dojocat Dojocat

View file

@ -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 BlogOptions} from '@docusaurus/plugin-content-blog';
import type {Options as PageOptions} from '@docusaurus/plugin-content-pages'; 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: { export function dogfoodingTransformFrontMatter(frontMatter: {
[key: string]: unknown; [key: string]: unknown;
}): {[key: string]: unknown} { }): {[key: string]: unknown} {
@ -39,7 +47,7 @@ export const dogfoodingPluginInstances: PluginConfig[] = [
sidebarPath: '_dogfooding/docs-tests-sidebars.js', sidebarPath: '_dogfooding/docs-tests-sidebars.js',
versions: { versions: {
current: { current: {
noIndex: true, noIndex: !isArgosBuild,
}, },
}, },
onInlineTags: 'warn', onInlineTags: 'warn',

View file

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