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
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ address. A daily cron erases the hashes older than 13 months, and the rest is ke
form that host counts the same: `?ref=toptal` goes, `?ref=toptal-509168` becomes `?ref=509168`.
With `TOPTAL_ORIGIN` empty it stays, in the page's own Toptal mode: an inline script marks
`<html data-toptal>` before the first paint, and the page shows no form, no email and no
"Contact me" (`src/lib/toptal.ts`). `/audit` offers no order, and its link home is `nofollow`.
"Contact me" (`src/lib/toptal.ts`). `/audit` hides its prices and order buttons, and its link
home is `nofollow`; the Toptal build renders no prices at all.
- **The Toptal host:** `toptal.naidenko.dev` serves the Toptal build (`pnpm build:toptal`,
`NEXT_PUBLIC_SITE_VARIANT=toptal`) from a Worker of its own (`worker/toptal-site.ts`,
`wrangler.toptal.jsonc`): no form, no email, no icon row under the name, no LinkedIn or GitHub
Expand Down Expand Up @@ -208,6 +209,10 @@ such as `hire_me_toptal-badge`; `/stats` lists it as `hire_me_toptal · badge`.
| `project_click` | A project's title in Projects | `project` |
| `sample_report_click` | A link from `/audit` to the sample report | `placement` (`hero`, `screenshot`, `section`) |
| `sample_pdf` | The sample report's PDF | `placement` (`audit`, `sample`) |
| `sample_md` | The sample report's Markdown for AI agents | `placement` (`audit`, `sample`) |
| `prices_click` | "See prices" in `/audit`'s hero (naidenko.dev only) | — |
| `audit_order` | A package's order button under `/audit`'s prices (naidenko.dev only) | `placement` (`launch`, `full`, `diligence`, `custom`) |
| `github_auditdesk` | "Auditdesk on GitHub" on `/audit` | — |
| `sample_to_audit` | "How the audit works" on `/audit/sample` | — |
| `sample_filter` | A click in the sample report's filters | — |
| `copy_install` | The install-command copy button | — |
Expand Down
49 changes: 46 additions & 3 deletions e2e/site.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,17 @@ test("puts each client's photo and name above their words, both linked to their
}
});

test("the audit page offers no order, form or email, and its home link is nofollow", async ({ browser }) => {
test("the audit page orders only through its prices' links to the home page's form, with no form or email of its own, and its home link is nofollow", async ({
browser
}) => {
const context = await browser.newContext({ javaScriptEnabled: false });
const page = await context.newPage();
await page.goto("/audit");
await expect(page.getByRole("heading", { level: 1, name: "Code audits" })).toBeVisible();
await expect(page.getByText("Order an audit")).toHaveCount(0);
await expect(page.locator('a[href^="mailto:"], a[href*="#contact"], form, details#order')).toHaveCount(0);
await expect(page.locator('a[href^="mailto:"], form, details#order')).toHaveCount(0);
const orders = page.locator('a[href*="#contact"]');
await expect(orders).toHaveCount(4);
await expect(page.locator('section#pricing a[href^="/?order="][href$="#contact"]')).toHaveCount(4);
await expect(page.getByRole("link", { name: "← Andrii Naidenko" })).toHaveAttribute("rel", "nofollow");
await context.close();
});
Expand Down Expand Up @@ -386,6 +390,45 @@ test("the audit page links the sample report in HTML and PDF", async ({ page })
expect([pdf.status(), pdf.headers()["content-type"]]).toEqual([200, "application/pdf"]);
});

test("the audit page offers the sample as Markdown for AI agents, on the page and in the sample's bar", async ({ page }) => {
await page.goto("/audit");
await expect(page.locator("section#sample").getByRole("link", { name: "Markdown for AI agents" })).toHaveAttribute(
"href",
"/audit/sample-report.md"
);
await page.goto("/audit/sample");
await expect(page.getByRole("link", { name: "Markdown for AI", exact: true })).toHaveAttribute("href", "/audit/sample-report.md");
const md = await page.request.get("/audit/sample-report.md");
expect(md.status()).toBe(200);
expect(md.headers()["content-type"]).toMatch(/^text\/markdown/);
expect(await md.text()).toMatch(/^# Code audit: OWASP Juice Shop v20\.2\.0\n[\s\S]*## How to work through it/);
});

test("the audit page says why this audit, then gives its prices, each package ordered through the contact form", async ({ page }) => {
await page.goto("/audit");
await expect(page.locator("section#edge li")).toHaveCount(6);
await expect(page.locator("section#edge").getByRole("link", { name: "Auditdesk on GitHub" })).toHaveAttribute(
"href",
"https://github.com/anaidenko/auditdesk"
);
const prices = page.locator("section#pricing");
await page.locator("main header").getByRole("link", { name: "See prices" }).click();
await expect(prices.getByRole("heading", { name: "Prices" })).toBeInViewport();
await expect(prices.locator(":scope > ul > li")).toHaveCount(3);
await expect(prices).toContainText("$799");
await expect(prices.getByRole("link", { name: "Ask for a quote" })).toHaveAttribute("href", "/?order=custom#contact");
const order = prices.getByRole("link", { name: "Order a full audit" });
await expect(order).toHaveAttribute("href", "/?order=full#contact");
await order.click();
await hydrated(page);
await expect(page.locator("section#contact textarea[name=message]")).toHaveValue(
"I’d like the Full audit package. The repository, or a few lines about the product: "
);
await page.goto("/?order=nothing#contact");
await hydrated(page);
await expect(page.locator("section#contact textarea[name=message]")).toHaveValue("");
});

test("carries a link's tag from the audit page to the sample report and back", async ({ page }) => {
await page.goto("/audit?ref=e2e-check");
await expect(page.locator("section#sample").getByRole("link", { name: "Open the sample report" })).toHaveAttribute(
Expand Down
20 changes: 20 additions & 0 deletions e2e/toptal.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,17 @@ test.describe("naidenko.dev", () => {
await expect(page.locator("section#contact")).toContainText("Prefer to hire through Toptal?");
});

test("with the move turned off, a tagged visit to the audit page sees no prices", async ({ page, request }) => {
await page.route(
url => url.search === "?ref=toptal-e2e",
async route => route.fulfill({ response: await request.get("/audit") })
);
await page.goto("/audit?ref=toptal-e2e");
await expect(page.locator("section#pricing")).toBeHidden();
await expect(page.getByRole("link", { name: "See prices" })).toBeHidden();
await expect(page.locator("section#edge")).toBeVisible();
});

test("a visitor following an old Toptal link lands on the Toptal build, with no form or email", async ({ page }) => {
await page.goto("/?ref=toptal-e2e");
await expect(page).toHaveURL(`${TOPTAL_URL}/?ref=e2e`);
Expand Down Expand Up @@ -218,6 +229,15 @@ test.describe("the Toptal build", () => {
}
});

test("the audit page says why this audit, and names no price and no order, in the page and its scripts", async ({ page, request }) => {
await page.goto("/audit");
await expect(page.locator("section#edge")).toBeVisible();
await expect(page.locator("section#edge a")).toHaveCount(0);
await expect(page.locator("section#pricing")).toHaveCount(0);
await expect(page.getByRole("link", { name: "See prices" })).toHaveCount(0);
for (const text of await withScripts(request, "/audit")) expect(text).not.toMatch(/\$799|[?&]order=/);
});

test("the sample report links the Toptal host, and its PDF is there", async ({ page, request }) => {
await page.goto("/audit/sample");
await expect(page.locator("main.doc").getByRole("link", { name: "toptal.naidenko.dev/audit" })).toHaveAttribute(
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "naidenko-dev",
"version": "1.12.0",
"version": "1.13.0",
"private": true,
"scripts": {
"dev": "next dev",
Expand Down
2 changes: 2 additions & 0 deletions public/_headers
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@
Content-Type: text/plain; charset=utf-8
/robots.txt
Content-Type: text/plain; charset=utf-8
/audit/sample-report.md
Content-Type: text/markdown; charset=utf-8
Binary file modified public/audit/review.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 modified public/audit/run-form.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading