@dargmuesli/nuxt-vio-testing 23.0.0 → 23.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,8 +7,8 @@ export declare const testMetadata: ({ page, path, title }: {
7
7
  title: string;
8
8
  }) => Promise<void>;
9
9
  export declare const testOgImage: (paths: {
10
- static?: Record<string, string>;
11
- dynamic?: Record<string, string>;
10
+ en: string;
11
+ de: string;
12
12
  }) => void;
13
13
  export declare const testPageLoad: (url: string, status?: number) => void;
14
14
  export declare const testVisualRegression: (url: string, plain?: boolean) => void;
@@ -2,7 +2,7 @@ import { SITE_URL, TIMEOUT } from "./constants.mjs";
2
2
  import { vioTest } from "../fixtures/vioTest.mjs";
3
3
  import { expect } from "@playwright/test";
4
4
  import AxeBuilder from "@axe-core/playwright";
5
- import { joinURL, withoutTrailingSlash } from "ufo";
5
+ import { withoutTrailingSlash } from "ufo";
6
6
  //#region e2e/utils/tests.ts
7
7
  const testA11y = (url) => vioTest.describe("a11y", () => {
8
8
  vioTest("should not have any automatically detectable accessibility issues", async ({ defaultPage }) => {
@@ -403,17 +403,20 @@ const testMetadata = async ({ page, path, title }) => {
403
403
  ];
404
404
  for (const object of meta) await expect(page.locator(object.tag + object.attributes?.map((attribute) => `[${attribute.key}="${attribute.value}"]`).join(""))).toBeAttached();
405
405
  expect((await page.locator("script[data-hid=\"schema-org-graph\"]").innerText()).replaceAll(SITE_URL, "https://example.com")).toMatchSnapshot(`schema-org-graph-${process.env.VIO_SERVER}.json`);
406
+ const ogImageContent = await page.locator("meta[property=\"og:image\"]").getAttribute("content");
407
+ expect(ogImageContent).toBeTruthy();
408
+ expect(ogImageContent?.startsWith(SITE_URL)).toBeTruthy();
409
+ expect(ogImageContent).toMatch(/(\/_og\/[ds]\/).+\.png$/);
406
410
  };
407
411
  const testOgImage = (paths) => vioTest.describe("visual regression", () => {
408
412
  vioTest("generates the open graph image", async ({ page }) => {
409
- const isStaticServer = process.env.VIO_SERVER === "static";
410
- const serverPaths = isStaticServer ? paths.static : paths.dynamic;
411
- if (!serverPaths) throw new Error(isStaticServer ? "Static paths must be provided for static server tests" : "Dynamic paths must be provided for dynamic server tests");
412
- const serverPrefix = isStaticServer ? "s" : "d";
413
- await page.goto(joinURL(`/_og/${serverPrefix}/${serverPaths.en}`));
414
- await expect(page).toHaveScreenshot();
415
- await page.goto(joinURL(`/_og/${serverPrefix}/${serverPaths.de}`));
416
- await expect(page).toHaveScreenshot();
413
+ for (const path of [paths.en, paths.de]) {
414
+ await page.goto(path);
415
+ const ogImageUrl = await page.locator("meta[property=\"og:image\"]").getAttribute("content");
416
+ if (!ogImageUrl) throw new Error("The og:image url is not given.");
417
+ await page.goto(ogImageUrl);
418
+ await expect(page).toHaveScreenshot();
419
+ }
417
420
  });
418
421
  });
419
422
  const testPageLoad = (url, status = 200) => vioTest.describe("page load", () => {
@@ -1,6 +1,7 @@
1
1
  import { SITE_URL, TIMEOUT } from "./e2e/utils/constants.mjs";
2
2
  import { defineConfig, devices } from "@playwright/test";
3
3
  //#region playwright.config.ts
4
+ const VIO_SERVER = process.env.VIO_SERVER || "dev";
4
5
  /**
5
6
  * Read environment variables from file.
6
7
  * https://github.com/motdotla/dotenv
@@ -36,7 +37,7 @@ var playwright_config_default = defineConfig({
36
37
  trace: "on-first-retry"
37
38
  },
38
39
  webServer: {
39
- command: `pnpm run --dir ../src certificates && pnpm run --dir ../src start:${process.env.VIO_SERVER || "dev"}`,
40
+ command: VIO_SERVER === "dev" ? "pnpm run --dir ../src certificates && node ./scripts/warm-dev-server.mjs" : `pnpm run --dir ../src certificates && pnpm run --dir ../src start:${VIO_SERVER}`,
40
41
  env: {
41
42
  NUXT_APP_SECRET: "vio-testing-app-secret-0123456789",
42
43
  NUXT_PUBLIC_VIO_IS_TESTING: "true"
package/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "devDependencies": {
3
- "@axe-core/playwright": "4.13.0",
3
+ "@axe-core/playwright": "4.14.0",
4
4
  "@eslint/js": "10.0.1",
5
- "@playwright/test": "1.64.0",
5
+ "@playwright/test": "1.64.1",
6
6
  "@types/lodash-es": "4.17.12",
7
7
  "@types/node": "24.19.2",
8
8
  "cross-env": "10.1.0",
9
- "eslint": "10.12.0",
9
+ "eslint": "10.13.0",
10
10
  "eslint-config-prettier": "10.1.8",
11
- "eslint-plugin-prettier": "5.5.6",
11
+ "eslint-plugin-prettier": "5.5.7",
12
12
  "lodash-es": "4.18.1",
13
- "playwright-core": "1.64.0",
13
+ "playwright-core": "1.64.1",
14
14
  "tsdown": "0.23.1",
15
15
  "typescript": "6.0.3",
16
- "typescript-eslint": "8.71.1",
16
+ "typescript-eslint": "8.71.2",
17
17
  "ufo": "1.6.4"
18
18
  },
19
19
  "engines": {
@@ -56,7 +56,7 @@
56
56
  "url": "git+https://github.com/dargmuesli/vio.git"
57
57
  },
58
58
  "type": "module",
59
- "version": "23.0.0",
59
+ "version": "23.1.1",
60
60
  "scripts": {
61
61
  "build": "tsdown",
62
62
  "build:watch": "tsdown --watch",