Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/build_and_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ jobs:
- name: Verify every docs link the UI Capture SDK ships
run: yarn verify-ui-capture-sdk-links

- name: Verify every moved docs URL still leads to its page
run: yarn verify-moved-urls

# Deploys this PR's build with main.yml's deploy script into a local S3,
# then replays the weeks after it: no asset a live or open page still
# loads is deleted, every unused one eventually is, and every file gets
Expand Down
17 changes: 17 additions & 0 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ s.parentNode.insertBefore(b, s);})(window.lintrk);`,
url: "https://keploy.io",
baseUrl: "/docs/",
onBrokenLinks: "throw",
// A link to a heading that does not exist fails the build too, as a
// broken link does: a page that moves or renames a heading must fix every
// link to it.
onBrokenAnchors: "throw",
trailingSlash: true,
markdown: {
// Date each doc by the last commit that changed its content, not the last
Expand Down Expand Up @@ -225,6 +229,15 @@ s.parentNode.insertBefore(b, s);})(window.lintrk);`,
from: "/ui-capture/install-sdk/",
to: "/running-keploy/ui-capture/#install-the-sdk",
},
// Pages that moved into the Universal Mocker section.
{
from: "/running-keploy/mock-quickstart/",
to: "/universal-mocker/mock-quickstart/",
},
{
from: "/running-keploy/mock-your-tests/",
to: "/universal-mocker/mock-your-tests/",
},
],
},
],
Expand Down Expand Up @@ -330,6 +343,10 @@ s.parentNode.insertBefore(b, s);})(window.lintrk);`,
label: "API Testing (AI)",
to: "/running-keploy/api-test-generator",
},
{
label: "Universal Mocker (Service Virtualization)",
to: "/universal-mocker/overview",
},
{
label: "UI Testing",
to: "/running-keploy/ui-capture",
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"verify-linkedin-tag": "node scripts/verify-linkedin-tag.js build",
"verify-lastmod": "node scripts/verify-lastmod.js build",
"verify-ui-capture-sdk-links": "node scripts/verify-ui-capture-sdk-links.js build",
"verify-moved-urls": "node scripts/verify-moved-urls.js build",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
"clear": "docusaurus clear",
Expand Down
102 changes: 102 additions & 0 deletions scripts/verify-moved-urls.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
// Asserts every docs URL that moved still leads to its page in the built
// site. A moved page's old URL lives on in bookmarks, search results, blog
// posts and other sites' links, so it must keep working for good: a client
// redirect in docusaurus.config.js (plugin-client-redirects) sends it on.
// Docusaurus's own broken-link check cannot see this, because nothing on the
// site links to an old URL any more.
//
// For each move below, the build must hold:
// - a redirect page at the old URL whose target is the new URL, and
// - a real page (not another redirect) at the new URL.
//
// When a page moves, add its old and new URL below in the same change.
//
// Usage: node scripts/verify-moved-urls.js <build dir>
const fs = require("fs");
const path = require("path");

const BASE_URL = "/docs/";

const MOVES = [
// Into the Universal Mocker section.
{
from: "/running-keploy/mock-quickstart/",
to: "/universal-mocker/mock-quickstart/",
},
{
from: "/running-keploy/mock-your-tests/",
to: "/universal-mocker/mock-your-tests/",
},
];

// The page plugin-client-redirects writes at an old URL.
const REDIRECT_RE = /<meta http-equiv="refresh" content="0; url=([^"]+)">/;

const buildDir = process.argv[2];
if (!buildDir) {
console.error("usage: node scripts/verify-moved-urls.js <build dir>");
process.exit(2);
}

function pageFile(url) {
return path.join(buildDir, url, "index.html");
}

function readPage(url) {
try {
return fs.readFileSync(pageFile(url), "utf8");
} catch (err) {
return null;
}
}

const failures = [];
for (const {from, to} of MOVES) {
const old = readPage(from);
if (old === null) {
failures.push(
`${from}: no page at the old URL (${pageFile(from)}). Add a redirect ` +
`from it to ${to} in docusaurus.config.js's plugin-client-redirects.`
);
continue;
}
const m = old.match(REDIRECT_RE);
if (!m) {
failures.push(
`${from}: the old URL holds a page, not a redirect to ${to}. A page ` +
`moved back there? Then remove this move from ${__filename}.`
);
continue;
}
if (m[1] !== BASE_URL + to.replace(/^\//, "")) {
failures.push(
`${from}: redirects to ${m[1]}, not to ${BASE_URL}${to.replace(
/^\//,
""
)}. Point its redirect at the page's current URL.`
);
continue;
}
const target = readPage(to);
if (target === null) {
failures.push(
`${from}: redirects to ${to}, but no page is built there ` +
`(${pageFile(to)}). The page moved again? Point the redirect, and ` +
`this entry, at its current URL.`
);
continue;
}
if (REDIRECT_RE.test(target)) {
failures.push(
`${from}: redirects to ${to}, which is itself a redirect. Point it at ` +
`the page's current URL, so a reader takes one hop.`
);
}
}

if (failures.length > 0) {
console.error(`${failures.length} moved URL(s) no longer lead to a page:`);
for (const f of failures) console.error(`- ${f}`);
process.exit(1);
}
console.log(`All ${MOVES.length} moved URLs redirect to their pages.`);
85 changes: 80 additions & 5 deletions src/components/GetStartedPaths.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import React from "react";
import Link from "@docusaurus/Link";
import useBaseUrl from "@docusaurus/useBaseUrl";
import {FaRocket, FaMagic, FaRetweet, FaLaptopCode} from "react-icons/fa";
import {
FaRocket,
FaMagic,
FaRetweet,
FaLaptopCode,
FaLayerGroup,
} from "react-icons/fa";
import {SiKubernetes} from "react-icons/si";

// The four entry points rendered as cards below, in display order. Exported
// The five entry points rendered as cards below, in display order. Exported
// so the docs home can emit them as an ItemList off the same data the links
// are built from -- a hand-copied list in the JSON-LD would quietly rot the
// first time one of these paths moves.
Expand All @@ -30,10 +36,21 @@ export const GET_STARTED_PATHS = [
description: "Classic Keploy CLI experience for rapid iteration",
href: "/docs/server/installation/",
},
{
name: "Mock the dependencies of the tests you already have",
description:
"Universal Mocker: record your tests' database, queue and API calls once, then replay them offline",
href: "/docs/universal-mocker/overview/",
},
];

const [AI_GENERATE, CHROME_EXTENSION, K8S_PROXY, LOCAL_RECORD] =
GET_STARTED_PATHS;
const [
AI_GENERATE,
CHROME_EXTENSION,
K8S_PROXY,
LOCAL_RECORD,
UNIVERSAL_MOCKER,
] = GET_STARTED_PATHS;

export const GetStartedPaths = () => {
return (
Expand All @@ -47,7 +64,7 @@ export const GetStartedPaths = () => {
How do you want to get started?
</h2>
<p className="mx-auto max-w-2xl text-gray-600 dark:text-gray-400">
Pick a workflow to begin. You can switch anytime—both paths lead to
Pick a workflow to begin. You can switch anytime—every path leads to
reliable, replayable tests.
</p>
</div>
Expand Down Expand Up @@ -259,6 +276,64 @@ export const GetStartedPaths = () => {
</div>
</div>
</div>
{/* Universal Mocker: spans both columns, below the two cards above */}
<div className="group relative overflow-hidden rounded-2xl border border-gray-200 bg-gradient-to-br from-white to-emerald-50/50 p-6 shadow-sm transition-all duration-300 hover:shadow-lg hover:shadow-emerald-100/50 dark:border-gray-700 dark:from-gray-800 dark:to-emerald-950/20 dark:hover:shadow-emerald-900/20 md:col-span-2">
{/* Decorative gradient blob */}
<div className="absolute -right-10 -top-10 h-32 w-32 rounded-full bg-gradient-to-br from-emerald-400/20 to-emerald-600/10 blur-2xl transition-transform duration-500 group-hover:scale-150"></div>

<div className="relative flex flex-col gap-6 md:flex-row md:items-center">
<div className="md:flex-1">
{/* Icon Badge */}
<div className="mb-4 inline-flex items-center justify-center rounded-xl bg-gradient-to-br from-emerald-500 to-emerald-700 p-3 text-white shadow-lg shadow-emerald-500/25">
<FaLayerGroup className="h-6 w-6" />
</div>

{/* Path Label */}
<div className="mb-2 flex items-center gap-2">
<span className="rounded-md bg-emerald-100 px-2 py-0.5 text-xs font-semibold uppercase tracking-wider text-emerald-800 dark:bg-emerald-900/40 dark:text-emerald-200">
Universal Mocker
</span>
<span className="text-xs text-gray-500 dark:text-gray-400">
Service virtualization
</span>
</div>

{/* Content */}
<h3 className="mb-2 text-xl font-bold text-gray-900 dark:text-white">
Run Your Own Tests Without Their Dependencies
</h3>
<p className="mb-0 text-sm text-gray-600 dark:text-gray-400">
Wrap go test, pytest, Jest, JUnit or Playwright with keploy
mock. No mock code to write, and no test to change.
</p>
</div>

<div className="md:flex-1">
<Link
to={useBaseUrl(UNIVERSAL_MOCKER.href)}
className="group/option flex min-h-[92px] items-start justify-between gap-3 rounded-xl border border-gray-200 bg-white/50 p-3 transition-all duration-200 hover:border-emerald-300 hover:bg-emerald-50/50 hover:no-underline dark:border-gray-600 dark:bg-gray-800/50 dark:hover:border-emerald-500/50 dark:hover:bg-emerald-900/10"
>
<div className="flex items-start gap-3">
<div className="flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-lg bg-emerald-100 text-emerald-700 transition-colors group-hover/option:bg-emerald-100 group-hover/option:text-emerald-800 dark:bg-emerald-900/30 dark:text-emerald-200">
<FaLayerGroup className="h-5 w-5" />
</div>
<div>
<h4 className="mb-0.5 text-sm font-semibold text-gray-900 dark:text-white">
Mock the dependencies of the tests you already have
</h4>
<p className="text-xs text-gray-500 dark:text-gray-400">
Record your tests&apos; database, queue and API calls
once, then replay them offline
</p>
</div>
</div>
<span className="mt-1 text-gray-400 transition-colors group-hover/option:text-emerald-500 dark:text-gray-500">
→
</span>
</Link>
</div>
</div>
</div>
</div>
</section>
);
Expand Down
Loading
Loading