Skip to content

Commit fe8cef1

Browse files
committed
add test for whitepaper page pdf link
1 parent b9a0e1b commit fe8cef1

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

tests/e2e/whitepaper.spec.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { expect, request, test } from "@playwright/test"
2+
3+
const PAGE_URL = "/whitepaper"
4+
const PDF_LINK_TEXT = /whitepaper.*pdf/i
5+
const PDF_PATH =
6+
"/content/whitepaper/whitepaper-pdf/Ethereum_Whitepaper_-_Buterin_2014.pdf"
7+
8+
test.describe("Whitepaper Page", () => {
9+
test("whitepaper PDF link has correct href", async ({ page }) => {
10+
await page.goto(PAGE_URL)
11+
12+
const pdfLink = page.getByRole("link", { name: PDF_LINK_TEXT })
13+
await expect(pdfLink).toBeVisible()
14+
15+
const href = await pdfLink.getAttribute("href")
16+
expect(href).toContain(PDF_PATH)
17+
})
18+
19+
test("whitepaper PDF is accessible and served as PDF", async ({
20+
baseURL,
21+
}) => {
22+
const apiRequest = await request.newContext()
23+
const response = await apiRequest.get(baseURL + PDF_PATH)
24+
expect(response.status()).toBe(200)
25+
expect(response.headers()["content-type"]).toContain("application/pdf")
26+
await apiRequest.dispose()
27+
})
28+
})

0 commit comments

Comments
 (0)