File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { expect , request , test } from "@playwright/test"
2
+
3
+ const PAGE_URL = "/whitepaper"
4
+ const PDF_LINK_TEXT = / w h i t e p a p e r .* p d f / 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
+ } )
You can’t perform that action at this time.
0 commit comments