-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: fix charts not rendering because of version mismatch (#1823)
Closes #1822 - fix charts not rendering because of version mismatch - **Cause:** This was caused by mismatching versions of the `chart.js` package in our `docs` and the `@sit-onyx/chartjs-plugin` packages. - **Fix:** We now make use of the [PNPM catalog feature](https://pnpm.io/catalogs) to enforce usage of the same package version. Added screenshot tests to ensure that we catch these issues in the future. - fix warning logged by vitepress about `gobalThis.document` not being available - **Cause:** Vitepress does server-side rendering, where the document is not available. But we try to set a CSS variable. - **Fix:** We use the optional chaining operator to ensure that we set the CSS variable only when `gobalThis.document` is defined. --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: JoCa96 <18483883+JoCa96@users.noreply.github.com>
- Loading branch information
1 parent
ef3e2f1
commit 5209762
Showing
148 changed files
with
126 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
node_modules/ | ||
/test-results/ | ||
/playwright-report/ | ||
/blob-report/ | ||
/playwright/.cache/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { defineConfig, devices } from "@playwright/test"; | ||
|
||
// NOTE: You need to run "pnpm build" before running the tests | ||
|
||
/** | ||
* See https://playwright.dev/docs/test-configuration. | ||
*/ | ||
export default defineConfig({ | ||
testDir: "./tests", | ||
snapshotDir: "./playwright/snapshots", | ||
// custom snapshotPathTemplate to remove the testFileName folder that we don't want | ||
snapshotPathTemplate: "{snapshotDir}/{testFileDir}/{arg}-{projectName}-{platform}{ext}", | ||
// we don't want to update snapshots on the local machine of each developer. | ||
// if you want to update snapshots for your branch, use the corresponding GitHub action: | ||
// https://github.com/SchwarzIT/onyx/actions/workflows/playwright-screenshots.yml | ||
ignoreSnapshots: !process.env.CI, | ||
updateSnapshots: "none", | ||
fullyParallel: true, | ||
forbidOnly: !!process.env.CI, // fail build on CI if we left test.only in the source code | ||
retries: process.env.CI ? 1 : 0, // retry on CI only | ||
/* In the CI pipeline it generates dot (for the stdout) and blob reports, locally only a html report is generated */ | ||
reporter: process.env.CI ? [["dot"], ["blob"]] : [["html", { open: "never" }]], | ||
use: { | ||
baseURL: "http://localhost:3200/", | ||
trace: process.env.CI ? "retain-on-failure" : "off", | ||
video: process.env.CI ? "retain-on-failure" : "off", | ||
}, | ||
/* Configure projects for major browsers */ | ||
projects: [ | ||
{ name: "chromium", use: { ...devices["Desktop Chrome"] } }, | ||
{ name: "firefox", use: { ...devices["Desktop Firefox"] } }, | ||
{ name: "webkit", use: { ...devices["Desktop Safari"] } }, | ||
], | ||
/* Run your local dev server before starting the tests */ | ||
webServer: { | ||
command: "pnpm preview --port 3200 --mode test", | ||
port: 3200, | ||
reuseExistingServer: false, | ||
}, | ||
}); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+364 KB
apps/docs/playwright/snapshots/basics-accessibility-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+394 KB
apps/docs/playwright/snapshots/basics-breakpoints-grid-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+691 KB
apps/docs/playwright/snapshots/basics-breakpoints-grid-firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+373 KB
apps/docs/playwright/snapshots/basics-breakpoints-grid-webkit-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Binary file added
BIN
+17.9 KB
apps/docs/playwright/snapshots/basics-infographics-chromium-linux.png
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Binary file added
BIN
+8.1 KB
apps/docs/playwright/snapshots/basics-notifications-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+11.1 KB
apps/docs/playwright/snapshots/basics-notifications-firefox-linux.png
Oops, something went wrong.
Oops, something went wrong.
Binary file added
BIN
+8.86 KB
apps/docs/playwright/snapshots/basics-search-behavior-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+12.3 KB
apps/docs/playwright/snapshots/basics-search-behavior-firefox-linux.png
Oops, something went wrong.
Binary file added
BIN
+8.21 KB
apps/docs/playwright/snapshots/basics-search-behavior-webkit-linux.png
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Binary file added
BIN
+173 KB
apps/docs/playwright/snapshots/development-breakpoints-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+247 KB
apps/docs/playwright/snapshots/development-breakpoints-firefox-linux.png
Oops, something went wrong.
Binary file added
BIN
+161 KB
apps/docs/playwright/snapshots/development-breakpoints-webkit-linux.png
Oops, something went wrong.
Binary file added
BIN
+71.9 KB
apps/docs/playwright/snapshots/development-density-chromium-linux.png
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Binary file added
BIN
+354 KB
...ocs/playwright/snapshots/development-packages-chartjs-plugin-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+523 KB
...docs/playwright/snapshots/development-packages-chartjs-plugin-firefox-linux.png
Oops, something went wrong.
Binary file added
BIN
+356 KB
.../docs/playwright/snapshots/development-packages-chartjs-plugin-webkit-linux.png
Oops, something went wrong.
Binary file added
BIN
+284 KB
apps/docs/playwright/snapshots/development-packages-figma-utils-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+396 KB
apps/docs/playwright/snapshots/development-packages-figma-utils-firefox-linux.png
Oops, something went wrong.
Binary file added
BIN
+258 KB
apps/docs/playwright/snapshots/development-packages-figma-utils-webkit-linux.png
Oops, something went wrong.
Binary file added
BIN
+52.3 KB
apps/docs/playwright/snapshots/development-packages-headless-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+73.5 KB
apps/docs/playwright/snapshots/development-packages-headless-firefox-linux.png
Oops, something went wrong.
Binary file added
BIN
+48.7 KB
apps/docs/playwright/snapshots/development-packages-headless-webkit-linux.png
Oops, something went wrong.
Binary file added
BIN
+236 KB
apps/docs/playwright/snapshots/development-packages-nuxt-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+353 KB
apps/docs/playwright/snapshots/development-packages-nuxt-firefox-linux.png
Oops, something went wrong.
Binary file added
BIN
+219 KB
apps/docs/playwright/snapshots/development-packages-nuxt-webkit-linux.png
Oops, something went wrong.
Binary file added
BIN
+179 KB
...cs/playwright/snapshots/development-packages-storybook-utils-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+260 KB
...ocs/playwright/snapshots/development-packages-storybook-utils-firefox-linux.png
Oops, something went wrong.
Binary file added
BIN
+166 KB
...docs/playwright/snapshots/development-packages-storybook-utils-webkit-linux.png
Oops, something went wrong.
Binary file added
BIN
+142 KB
...cs/playwright/snapshots/development-packages-vitepress-theme-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+210 KB
...ocs/playwright/snapshots/development-packages-vitepress-theme-firefox-linux.png
Oops, something went wrong.
Binary file added
BIN
+132 KB
...docs/playwright/snapshots/development-packages-vitepress-theme-webkit-linux.png
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Binary file added
BIN
+119 KB
apps/docs/playwright/snapshots/development-typography-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+185 KB
apps/docs/playwright/snapshots/development-typography-firefox-linux.png
Oops, something went wrong.
Binary file added
BIN
+110 KB
apps/docs/playwright/snapshots/development-typography-webkit-linux.png
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Binary file added
BIN
+169 KB
...ocs/playwright/snapshots/principles-component-quality-stages-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+248 KB
...docs/playwright/snapshots/principles-component-quality-stages-firefox-linux.png
Oops, something went wrong.
Binary file added
BIN
+159 KB
.../docs/playwright/snapshots/principles-component-quality-stages-webkit-linux.png
Oops, something went wrong.
Binary file added
BIN
+574 KB
apps/docs/playwright/snapshots/principles-contributing-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+805 KB
apps/docs/playwright/snapshots/principles-contributing-firefox-linux.png
Oops, something went wrong.
Binary file added
BIN
+541 KB
apps/docs/playwright/snapshots/principles-contributing-webkit-linux.png
Oops, something went wrong.
Binary file added
BIN
+48.1 KB
apps/docs/playwright/snapshots/principles-definition-of-done-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+71 KB
apps/docs/playwright/snapshots/principles-definition-of-done-firefox-linux.png
Oops, something went wrong.
Binary file added
BIN
+45.2 KB
apps/docs/playwright/snapshots/principles-definition-of-done-webkit-linux.png
Oops, something went wrong.
Binary file added
BIN
+49.4 KB
apps/docs/playwright/snapshots/principles-definition-of-ready-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+72.5 KB
apps/docs/playwright/snapshots/principles-definition-of-ready-firefox-linux.png
Oops, something went wrong.
Binary file added
BIN
+46.1 KB
apps/docs/playwright/snapshots/principles-definition-of-ready-webkit-linux.png
Oops, something went wrong.
Binary file added
BIN
+585 KB
apps/docs/playwright/snapshots/principles-technical-vision-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+854 KB
apps/docs/playwright/snapshots/principles-technical-vision-firefox-linux.png
Oops, something went wrong.
Binary file added
BIN
+545 KB
apps/docs/playwright/snapshots/principles-technical-vision-webkit-linux.png
Oops, something went wrong.
Binary file added
BIN
+38.4 KB
apps/docs/playwright/snapshots/principles-ticket-naming-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+55 KB
apps/docs/playwright/snapshots/principles-ticket-naming-firefox-linux.png
Oops, something went wrong.
Binary file added
BIN
+36 KB
apps/docs/playwright/snapshots/principles-ticket-naming-webkit-linux.png
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
header, | ||
footer, | ||
.VPLocalNav { | ||
visibility: hidden; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { expect, test } from "@playwright/test"; | ||
import { join } from "node:path"; | ||
import { DefaultTheme } from "../node_modules/vitepress/types/default-theme"; | ||
import { CONFIG } from "../src/.vitepress/config"; | ||
|
||
test("has title", async ({ page }) => { | ||
await page.goto("/"); | ||
|
||
await expect(page).toHaveTitle(/onyx/); | ||
}); | ||
|
||
const BLACKLIST_PATHS = [/changelog/i, /icons/i]; | ||
|
||
/** | ||
* maps links listed in the vitepress config to their respective absolute url | ||
*/ | ||
const mapToLinks = ( | ||
navItem: DefaultTheme.NavItem | DefaultTheme.SidebarItem, | ||
baseParm?: string, | ||
): string[] => { | ||
const base = baseParm ?? (navItem as DefaultTheme.SidebarItem).base ?? ""; | ||
const links: string[] = []; | ||
if ("link" in navItem && navItem.link && navItem.link.startsWith("/")) { | ||
links.push(`${base}${navItem.link}`); | ||
} | ||
if ("items" in navItem && navItem.items) { | ||
navItem.items.forEach((item) => links.push(...mapToLinks(item, navItem["base"]))); | ||
} | ||
return links; | ||
}; | ||
|
||
const navItems = CONFIG.themeConfig.nav; | ||
const sidebarItems = Object.values(CONFIG.themeConfig.sidebar).flat(1); | ||
|
||
const items = [...navItems, ...sidebarItems].map((item) => mapToLinks(item)).flat(1); | ||
const uniqueItems = new Set(items); | ||
const pathsTotTest = Array.from(uniqueItems).filter( | ||
(p) => !BLACKLIST_PATHS.some((bl) => p.match(bl)), | ||
); | ||
|
||
pathsTotTest.forEach((path) => { | ||
test(`screenshot content of ${path}`, async ({ page }) => { | ||
const name = path | ||
.replace(/^\//, "") | ||
.replace(/\.html$/, "") | ||
.replace(/[_/ ]/g, "_"); | ||
await page.goto(path); | ||
const main = page.getByRole("main"); | ||
await expect(main).toHaveScreenshot(`${name}.png`, { | ||
stylePath: join(import.meta.dirname, "hide-non-main.css"), | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,6 @@ packages: | |
- "packages/*" | ||
|
||
catalog: | ||
vue: ~3.4.0 | ||
"@vue/compiler-dom": ~3.4.0 | ||
chart.js: "^4.4.4" | ||
vue: ~3.4.0 |